From 802cc383443d01890a3da18095b426e6ad758a4c Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 21 Jan 2004 15:11:48 -0500 Subject: BUG#530: Using #error to report a nice error message if the C compiler is set to a C++ compiler. --- Modules/CMakeTestCCompiler.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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) -- cgit v0.12