summaryrefslogtreecommitdiffstats
path: root/Modules/CMakeTestCCompiler.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2004-01-21 20:11:48 (GMT)
committerBrad King <brad.king@kitware.com>2004-01-21 20:11:48 (GMT)
commit802cc383443d01890a3da18095b426e6ad758a4c (patch)
tree5c03b76e88545dcd3a51a37a099c7ecf0a87b4f4 /Modules/CMakeTestCCompiler.cmake
parentaf81df2542d86bd19f071e7e790bdcfdcf3c3f0e (diff)
downloadCMake-802cc383443d01890a3da18095b426e6ad758a4c.zip
CMake-802cc383443d01890a3da18095b426e6ad758a4c.tar.gz
CMake-802cc383443d01890a3da18095b426e6ad758a4c.tar.bz2
BUG#530: Using #error to report a nice error message if the C compiler is set to a C++ compiler.
Diffstat (limited to 'Modules/CMakeTestCCompiler.cmake')
-rw-r--r--Modules/CMakeTestCCompiler.cmake6
1 files changed, 5 insertions, 1 deletions
diff --git a/Modules/CMakeTestCCompiler.cmake b/Modules/CMakeTestCCompiler.cmake
index 5484ce1..fc5791a 100644
--- a/Modules/CMakeTestCCompiler.cmake
+++ b/Modules/CMakeTestCCompiler.cmake
@@ -5,7 +5,11 @@
# any makefiles or projects.
IF(NOT CMAKE_C_COMPILER_WORKS)
MESSAGE(STATUS "Check for working C compiler: ${CMAKE_C_COMPILER}")
- FILE(WRITE ${CMAKE_BINARY_DIR}/CMakeTmp/testCCompiler.c "int main(){return 0;}\n")
+ FILE(WRITE ${CMAKE_BINARY_DIR}/CMakeTmp/testCCompiler.c
+ "#ifdef __cplusplus\n"
+ "# error \"The CMAKE_C_COMPILER is set to a C++ compiler\"\n"
+ "#endif\n"
+ "int main(){return 0;}\n")
TRY_COMPILE(CMAKE_C_COMPILER_WORKS ${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}/CMakeTmp/testCCompiler.c
OUTPUT_VARIABLE OUTPUT)