CMakeTestCXXCompiler.cmake 1.1 KB

12345678910111213141516171819
  1. # This file is used by EnableLanguage in cmGlobalGenerator to
  2. # determine that that selected C++ compiler can actually compile
  3. # and like the most basic of programs. If not, a fatel error
  4. # is set and cmake stops processing commands and will not generate
  5. # any makefiles or projects.
  6. MESSAGE(STATUS "Check for working CXX compiler: ${CMAKE_CXX_COMPILER}")
  7. WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeTmp/testCXXCompiler.cxx "int main(){return 0;}")
  8. TRY_COMPILE(CMAKE_CXX_COMPILER_WORKS ${CMAKE_BINARY_DIR}
  9. ${CMAKE_BINARY_DIR}/CMakeTmp/testCXXCompiler.cxx
  10. OUTPUT_VARIABLE OUTPUT)
  11. IF(NOT CMAKE_CXX_COMPILER_WORKS)
  12. MESSAGE(STATUS "Check for working CXX compiler: ${CMAKE_CXX_COMPILER} -- broken")
  13. MESSAGE(FATAL_ERROR "The C++ compiler \"${CMAKE_CXX_COMPILER}\" "
  14. "is not able to compile a simple tests program.\nIt fails "
  15. "with the following output:\n ${OUTPUT}\n\n"
  16. "CMake will not be able to correctly generate this project.")
  17. ELSE(NOT CMAKE_CXX_COMPILER_WORKS)
  18. MESSAGE(STATUS "Check for working CXX compiler: ${CMAKE_CXX_COMPILER} -- works")
  19. ENDIF(NOT CMAKE_CXX_COMPILER_WORKS)