summaryrefslogtreecommitdiffstats
path: root/Modules/CMakeCInformation.cmake
diff options
context:
space:
mode:
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