Browse Source

ENH: use CFLAGS for testing for gnu

Bill Hoffman 22 years ago
parent
commit
e7295161f7
1 changed files with 7 additions and 1 deletions
  1. 7 1
      Modules/CMakeDetermineCCompiler.cmake

+ 7 - 1
Modules/CMakeDetermineCCompiler.cmake

@@ -48,7 +48,13 @@ MARK_AS_ADVANCED(CMAKE_RANLIB)
 
 IF(NOT CMAKE_COMPILER_IS_GNUCC_RUN)
   # test to see if the c compiler is gnu
-  EXEC_PROGRAM(${CMAKE_C_COMPILER} ARGS ${CMAKE_C_FLAGS} -E "\"${CMAKE_ROOT}/Modules/CMakeTestGNU.c\"" OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT RETURN_VALUE CMAKE_COMPILER_RETURN)
+  
+  IF(CMAKE_C_FLAGS)
+    SET(CMAKE_BOOT_C_FLAGS ${CMAKE_C_FLAGS})
+  ELSE(CMAKE_C_FLAGS)
+    SET(CMAKE_BOOT_C_FLAGS $ENV{CFLAGS})
+  ENDIF(CMAKE_C_FLAGS)
+  EXEC_PROGRAM(${CMAKE_C_COMPILER} ARGS ${CMAKE_BOOT_C_FLAGS} -E "\"${CMAKE_ROOT}/Modules/CMakeTestGNU.c\"" OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT RETURN_VALUE CMAKE_COMPILER_RETURN)
   SET(CMAKE_COMPILER_IS_GNUCC_RUN 1)
   IF(NOT CMAKE_COMPILER_RETURN)
     IF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_GNU.*" )