summaryrefslogtreecommitdiffstats
path: root/Modules/CMakeCInformation.cmake
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2008-04-21 17:04:15 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2008-04-21 17:04:15 (GMT)
commitaa10b4e33cd4a0c304f3cd3ffd5f0f382a6b6178 (patch)
tree9f65728434ce0f45debaa6b5dcd0549574854663 /Modules/CMakeCInformation.cmake
parent2eb3653d79a523b1745bd6fc7f3abc7bd0738e06 (diff)
downloadCMake-aa10b4e33cd4a0c304f3cd3ffd5f0f382a6b6178.zip
CMake-aa10b4e33cd4a0c304f3cd3ffd5f0f382a6b6178.tar.gz
CMake-aa10b4e33cd4a0c304f3cd3ffd5f0f382a6b6178.tar.bz2
ENH: fix init flags getting stuffed into the compile line by force.
Diffstat (limited to 'Modules/CMakeCInformation.cmake')
-rw-r--r--Modules/CMakeCInformation.cmake12
1 files changed, 7 insertions, 5 deletions
diff --git a/Modules/CMakeCInformation.cmake b/Modules/CMakeCInformation.cmake
index 77df12e..e3a8d93 100644
--- a/Modules/CMakeCInformation.cmake
+++ b/Modules/CMakeCInformation.cmake
@@ -62,11 +62,13 @@ IF(NOT CMAKE_MODULE_EXISTS)
SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS})
ENDIF(NOT CMAKE_MODULE_EXISTS)
-SET (CMAKE_C_FLAGS "$ENV{CFLAGS}" CACHE STRING
- "Flags for C compiler.")
-IF (CMAKE_C_FLAGS_INIT)
- SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_INIT}")
-ENDIF (CMAKE_C_FLAGS_INIT)
+SET(CMAKE_C_FLAGS_INIT "$ENV{CFLAGS} ${CMAKE_C_FLAGS_INIT}")
+# avoid just having a space as the initial value for the cache
+IF(CMAKE_C_FLAGS_INIT STREQUAL " ")
+ SET(CMAKE_C_FLAGS_INIT)
+ENDIF(CMAKE_C_FLAGS_INIT STREQUAL " ")
+SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS_INIT}" CACHE STRING
+ "Flags used by the compiler during all build types.")
IF(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
# default build type is none