CheckCompilerFlag.cmake 708 B

1234567891011121314151617181920212223
  1. # Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. # file Copyright.txt or https://cmake.org/licensing for details.
  3. include_guard(GLOBAL)
  4. include(Internal/CheckFlagCommonConfig)
  5. include(Internal/CheckSourceCompiles)
  6. include(CMakeCheckCompilerFlagCommonPatterns)
  7. function(CMAKE_CHECK_COMPILER_FLAG _lang _flag _var)
  8. cmake_check_flag_common_init("check_compiler_flag" ${_lang} _lang_src _lang_fail_regex)
  9. set(CMAKE_REQUIRED_DEFINITIONS ${_flag})
  10. check_compiler_flag_common_patterns(_common_patterns)
  11. cmake_check_source_compiles(${_lang}
  12. "${_lang_src}"
  13. ${_var}
  14. ${_lang_fail_regex}
  15. ${_common_patterns}
  16. )
  17. cmake_check_flag_common_finish()
  18. endfunction()