diff options
-rw-r--r-- | Modules/CMakeCInformation.cmake | 12 | ||||
-rw-r--r-- | Modules/CMakeCXXInformation.cmake | 11 | ||||
-rw-r--r-- | Modules/CMakeFortranInformation.cmake | 12 |
3 files changed, 19 insertions, 16 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 diff --git a/Modules/CMakeCXXInformation.cmake b/Modules/CMakeCXXInformation.cmake index 6cd2ec7..65c5902 100644 --- a/Modules/CMakeCXXInformation.cmake +++ b/Modules/CMakeCXXInformation.cmake @@ -145,13 +145,14 @@ ENDFOREACH(type) # on the initial values computed in the platform/*.cmake files # use _INIT variables so that this only happens the first time # and you can set these flags in the cmake cache -SET (CMAKE_CXX_FLAGS "$ENV{CXXFLAGS}" CACHE STRING +SET(CMAKE_CXX_FLAGS_INIT "$ENV{CXXFLAGS} ${CMAKE_CXX_FLAGS_INIT}") +# avoid just having a space as the initial value for the cache +IF(CMAKE_CXX_FLAGS_INIT STREQUAL " ") + SET(CMAKE_CXX_FLAGS_INIT) +ENDIF(CMAKE_CXX_FLAGS_INIT STREQUAL " ") +SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_INIT}" CACHE STRING "Flags used by the compiler during all build types.") -IF (CMAKE_CXX_FLAGS_INIT) - SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_INIT}") -ENDIF (CMAKE_CXX_FLAGS_INIT) - IF(NOT CMAKE_NOT_USING_CONFIG_FLAGS) SET (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG_INIT}" CACHE STRING "Flags used by the compiler during debug builds.") diff --git a/Modules/CMakeFortranInformation.cmake b/Modules/CMakeFortranInformation.cmake index 93d58b8..cfde0e5 100644 --- a/Modules/CMakeFortranInformation.cmake +++ b/Modules/CMakeFortranInformation.cmake @@ -106,13 +106,13 @@ ENDIF(NOT CMAKE_INCLUDE_FLAG_SEP_Fortran) SET(CMAKE_VERBOSE_MAKEFILE FALSE CACHE BOOL "If this value is on, makefiles will be generated without the .SILENT directive, and all commands will be echoed to the console during the make. This is useful for debugging only. With Visual Studio IDE projects all commands are done without /nologo.") -SET (CMAKE_Fortran_FLAGS "$ENV{FFLAGS}" CACHE STRING +SET(CMAKE_Fortran_FLAGS_INIT "$ENV{FFFLAGS} ${CMAKE_Fortran_FLAGS_INIT}") +# avoid just having a space as the initial value for the cache +IF(CMAKE_Fortran_FLAGS_INIT STREQUAL " ") + SET(CMAKE_Fortran_FLAGS_INIT) +ENDIF(CMAKE_Fortran_FLAGS_INIT STREQUAL " ") +SET (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS_INIT}" CACHE STRING "Flags for Fortran compiler.") -IF (CMAKE_Fortran_FLAGS_INIT) - SET (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${CMAKE_Fortran_FLAGS_INIT}") -ENDIF (CMAKE_Fortran_FLAGS_INIT) - - INCLUDE(CMakeCommonLanguageInclude) |