diff options
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/CMakeDetermineCCompiler.cmake | 2 | ||||
-rw-r--r-- | Modules/CMakeDetermineCXXCompiler.cmake | 6 | ||||
-rw-r--r-- | Modules/CMakeTestCCompiler.cmake | 19 | ||||
-rw-r--r-- | Modules/CMakeTestCXXCompiler.cmake | 19 |
4 files changed, 44 insertions, 2 deletions
diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake index 7870ef30c4..6c7d4c728c 100644 --- a/Modules/CMakeDetermineCCompiler.cmake +++ b/Modules/CMakeDetermineCCompiler.cmake @@ -13,7 +13,7 @@ IF(NOT CMAKE_C_COMPILER) GET_FILENAME_COMPONENT(CMAKE_C_COMPILER_INIT $ENV{CC} PROGRAM PROGRAM_ARGS CMAKE_C_FLAGS_ENV_INIT) IF(EXISTS ${CMAKE_C_COMPILER_INIT}) ELSE(EXISTS ${CMAKE_C_COMPILER_INIT}) - MESSAGE(SEND_ERROR "Could not find compiler set in environment variable CC:\n$ENV{CC}.") + MESSAGE(FATAL_ERROR "Could not find compiler set in environment variable CC:\n$ENV{CC}.") ENDIF(EXISTS ${CMAKE_C_COMPILER_INIT}) ENDIF($ENV{CC} MATCHES ".+") diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake index e7dcf8715a..3de759b872 100644 --- a/Modules/CMakeDetermineCXXCompiler.cmake +++ b/Modules/CMakeDetermineCXXCompiler.cmake @@ -13,7 +13,7 @@ IF(NOT CMAKE_CXX_COMPILER) GET_FILENAME_COMPONENT(CMAKE_CXX_COMPILER_INIT $ENV{CXX} PROGRAM PROGRAM_ARGS CMAKE_CXX_FLAGS_ENV_INIT) IF(EXISTS ${CMAKE_CXX_COMPILER_INIT}) ELSE(EXISTS ${CMAKE_CXX_COMPILER_INIT}) - MESSAGE(SEND_ERROR "Could not find compiler set in environment variable CXX:\n$ENV{CXX}.\n${CMAKE_CXX_COMPILER_INIT}") + MESSAGE(FATAL_ERROR "Could not find compiler set in environment variable CXX:\n$ENV{CXX}.\n${CMAKE_CXX_COMPILER_INIT}") ENDIF(EXISTS ${CMAKE_CXX_COMPILER_INIT}) ENDIF($ENV{CXX} MATCHES ".+") @@ -50,3 +50,7 @@ ENDIF(NOT CMAKE_COMPILER_RETURN) CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeCXXCompiler.cmake.in ${CMAKE_BINARY_DIR}/CMakeCXXCompiler.cmake IMMEDIATE) MARK_AS_ADVANCED(CMAKE_CXX_COMPILER_FULLPATH) + + + + diff --git a/Modules/CMakeTestCCompiler.cmake b/Modules/CMakeTestCCompiler.cmake new file mode 100644 index 0000000000..8e88c0afe7 --- /dev/null +++ b/Modules/CMakeTestCCompiler.cmake @@ -0,0 +1,19 @@ +# This file is used by EnableLanguage in cmGlobalGenerator to +# determine that that selected C compiler can actually compile +# and like the most basic of programs. If not, a fatel error +# is set and cmake stops processing commands and will not generate +# any makefiles or projects. +MESSAGE(STATUS "Check for working C compiler: ${CMAKE_C_COMPILER}") +WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeTmp/testCCompiler.c "int main(){return 0;}") +TRY_COMPILE(CMAKE_C_COMPILER_WORKS ${CMAKE_BINARY_DIR} + ${CMAKE_BINARY_DIR}/CMakeTmp/testCCompiler.c + OUTPUT_VARIABLE OUTPUT) +IF(NOT CMAKE_C_COMPILER_WORKS) + MESSAGE(STATUS "Check for working C compiler: ${CMAKE_C_COMPILER} -- broken") + MESSAGE(FATAL_ERROR "The C compiler \"${CMAKE_C_COMPILER}\" " + "is not able to compile a simple tests program.\nIt fails " + "with the following output:\n ${OUTPUT}\n\n" + "CMake will not be able to correctly generate this project.") +ELSE(NOT CMAKE_C_COMPILER_WORKS) + MESSAGE(STATUS "Check for working C compiler: ${CMAKE_C_COMPILER} -- works") +ENDIF(NOT CMAKE_C_COMPILER_WORKS) diff --git a/Modules/CMakeTestCXXCompiler.cmake b/Modules/CMakeTestCXXCompiler.cmake new file mode 100644 index 0000000000..5609c963f6 --- /dev/null +++ b/Modules/CMakeTestCXXCompiler.cmake @@ -0,0 +1,19 @@ +# This file is used by EnableLanguage in cmGlobalGenerator to +# determine that that selected C++ compiler can actually compile +# and like the most basic of programs. If not, a fatel error +# is set and cmake stops processing commands and will not generate +# any makefiles or projects. +MESSAGE(STATUS "Check for working CXX compiler: ${CMAKE_CXX_COMPILER}") +WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeTmp/testCXXCompiler.cxx "int main(){return 0;}") +TRY_COMPILE(CMAKE_CXX_COMPILER_WORKS ${CMAKE_BINARY_DIR} + ${CMAKE_BINARY_DIR}/CMakeTmp/testCXXCompiler.cxx + OUTPUT_VARIABLE OUTPUT) +IF(NOT CMAKE_CXX_COMPILER_WORKS) + MESSAGE(STATUS "Check for working CXX compiler: ${CMAKE_CXX_COMPILER} -- broken") + MESSAGE(FATAL_ERROR "The C++ compiler \"${CMAKE_CXX_COMPILER}\" " + "is not able to compile a simple tests program.\nIt fails " + "with the following output:\n ${OUTPUT}\n\n" + "CMake will not be able to correctly generate this project.") +ELSE(NOT CMAKE_CXX_COMPILER_WORKS) + MESSAGE(STATUS "Check for working CXX compiler: ${CMAKE_CXX_COMPILER} -- works") +ENDIF(NOT CMAKE_CXX_COMPILER_WORKS) |