summaryrefslogtreecommitdiffstats
path: root/Modules/CMakeDetermineCCompiler.cmake
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2002-10-22 22:17:07 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2002-10-22 22:17:07 (GMT)
commitda460f9008f5a949f663e749455e15fb5959d803 (patch)
treeb4e9e7f1df292d53b2c8ab8274d87510fe5a6f64 /Modules/CMakeDetermineCCompiler.cmake
parent0692323fe0f0bbbb5ba325e21d0f155717436f84 (diff)
downloadCMake-da460f9008f5a949f663e749455e15fb5959d803.zip
CMake-da460f9008f5a949f663e749455e15fb5959d803.tar.gz
CMake-da460f9008f5a949f663e749455e15fb5959d803.tar.bz2
test for gnu compiler
Diffstat (limited to 'Modules/CMakeDetermineCCompiler.cmake')
-rw-r--r--Modules/CMakeDetermineCCompiler.cmake12
1 files changed, 8 insertions, 4 deletions
diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake
index c1fc85c..1035f1b 100644
--- a/Modules/CMakeDetermineCCompiler.cmake
+++ b/Modules/CMakeDetermineCCompiler.cmake
@@ -4,8 +4,12 @@
FIND_PROGRAM(CMAKE_C_COMPILER NAMES $ENV{CC} gcc cc cl bcc PATHS /bin /usr/bin /usr/local/bin )
+# test to see if the c compiler is gnu
+EXEC_PROGRAM(${CMAKE_C_COMPILER} ARGS -E ${CMAKE_ROOT}/Modules/CMakeTestGNU.c OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT RETURN_VALUE CMAKE_COMPILER_RETURN)
+
+IF(NOT CMAKE_COMPILER_RETURN)
+ IF(${CMAKE_COMPILER_OUTPUT} MATCHES ".*THIS_IS_GNU.*" )
+ SET(CMAKE_COMPILER_IS_GNUGCC 1)
+ ENDIF(${CMAKE_COMPILER_OUTPUT} MATCHES ".*THIS_IS_GNU.*" )
+ENDIF(NOT CMAKE_COMPILER_RETURN)
-# to check for is gnu we need to compile this:
-# #ifdef __GNUC__
-# yes;
-# #endif