ENH: make sure the c++ compiler is a c++ compiler

This commit is contained in:
Bill Hoffman 2004-10-11 11:55:39 -04:00
parent 37c5553818
commit e78a57563c
1 changed files with 5 additions and 1 deletions

View File

@ -5,7 +5,11 @@
# any makefiles or projects. # any makefiles or projects.
IF(NOT CMAKE_CXX_COMPILER_WORKS) IF(NOT CMAKE_CXX_COMPILER_WORKS)
MESSAGE(STATUS "Check for working CXX compiler: ${CMAKE_CXX_COMPILER}") MESSAGE(STATUS "Check for working CXX compiler: ${CMAKE_CXX_COMPILER}")
FILE(WRITE ${CMAKE_BINARY_DIR}/CMakeTmp/testCXXCompiler.cxx "int main(){return 0;}\n") FILE(WRITE ${CMAKE_BINARY_DIR}/CMakeTmp/testCXXCompiler.cxx
"#ifndef __cplusplus\n"
"# error \"The CMAKE_CXX_COMPILER is set to a C compiler\"\n"
"#endif\n"
"int main(){return 0;}\n")
TRY_COMPILE(CMAKE_CXX_COMPILER_WORKS ${CMAKE_BINARY_DIR} TRY_COMPILE(CMAKE_CXX_COMPILER_WORKS ${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}/CMakeTmp/testCXXCompiler.cxx ${CMAKE_BINARY_DIR}/CMakeTmp/testCXXCompiler.cxx
OUTPUT_VARIABLE OUTPUT) OUTPUT_VARIABLE OUTPUT)