summaryrefslogtreecommitdiffstats
path: root/Modules/CMakeTestCXXCompiler.cmake
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2004-10-11 15:55:39 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2004-10-11 15:55:39 (GMT)
commite78a57563cf3900c0a42ee580cb3787533a7f67c (patch)
tree612e729524c8e2619e043312270da91d8a28461a /Modules/CMakeTestCXXCompiler.cmake
parent37c555381899b52c7ddbe3aa5838101ba571fdf2 (diff)
downloadCMake-e78a57563cf3900c0a42ee580cb3787533a7f67c.zip
CMake-e78a57563cf3900c0a42ee580cb3787533a7f67c.tar.gz
CMake-e78a57563cf3900c0a42ee580cb3787533a7f67c.tar.bz2
ENH: make sure the c++ compiler is a c++ compiler
Diffstat (limited to 'Modules/CMakeTestCXXCompiler.cmake')
-rw-r--r--Modules/CMakeTestCXXCompiler.cmake6
1 files changed, 5 insertions, 1 deletions
diff --git a/Modules/CMakeTestCXXCompiler.cmake b/Modules/CMakeTestCXXCompiler.cmake
index 924a7c9..49bf695 100644
--- a/Modules/CMakeTestCXXCompiler.cmake
+++ b/Modules/CMakeTestCXXCompiler.cmake
@@ -5,7 +5,11 @@
# any makefiles or projects.
IF(NOT CMAKE_CXX_COMPILER_WORKS)
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}
${CMAKE_BINARY_DIR}/CMakeTmp/testCXXCompiler.cxx
OUTPUT_VARIABLE OUTPUT)