CheckCXXCompilerFlag.cmake 753 B

123456789101112131415161718192021
  1. # - Check whether the CXX compiler supports a given flag.
  2. # CHECK_CXX_COMPILER_FLAG(FLAG VARIABLE)
  3. #
  4. # FLAG - the compiler flag
  5. # VARIABLE - variable to store the result
  6. # Copyright (c) 2006, Alexander Neundorf, <[email protected]>
  7. #
  8. # Redistribution and use is allowed according to the terms of the BSD license.
  9. # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
  10. INCLUDE(CheckCXXSourceCompiles)
  11. MACRO (CHECK_CXX_COMPILER_FLAG _FLAG _RESULT)
  12. SET(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}")
  13. SET(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}")
  14. CHECK_CXX_SOURCE_COMPILES("int main() { return 0;}" ${_RESULT})
  15. SET (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}")
  16. ENDMACRO (CHECK_CXX_COMPILER_FLAG)