diff options
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/CMakeDetermineCCompiler.cmake | 11 | ||||
-rw-r--r-- | Modules/CMakeDetermineCXXCompiler.cmake | 11 | ||||
-rw-r--r-- | Modules/CMakeSystemSpecificInformation.cmake | 4 |
3 files changed, 12 insertions, 14 deletions
diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake index 5d48546..72a2a03 100644 --- a/Modules/CMakeDetermineCCompiler.cmake +++ b/Modules/CMakeDetermineCCompiler.cmake @@ -8,12 +8,11 @@ IF(NOT CMAKE_C_COMPILER) # if the user has specified CC via the environment, then use that without checking IF($ENV{CC} MATCHES ".+") - SET(CMAKE_C_COMPILER_INIT $ENV{CC}) - # make sure we can find it - FIND_PROGRAM(CMAKE_C_COMPILER_FULLPATH NAMES $ENV{CC}) - IF(NOT CMAKE_C_COMPILER_FULLPATH) - MESSAGE(SEND_ERROR "Could not find compiler set in environment variable CC:\n$ENV{CC}, make sure CC does not have flags in it, use CFLAGS instead.") - ENDIF(NOT CMAKE_C_COMPILER_FULLPATH) + GET_FILENAME_COMPONENT(CMAKE_C_COMPILER_INIT $ENV{CC} PROGRAM PROGRAM_ARGS CMAKE_C_FLAGS_ENV_INIT) + IF(EXISTS ${CMAKE_C_COMPILER_INIT}) + ELSE(EXISTS ${CMAKE_C_COMPILER_INIT}) + MESSAGE(SEND_ERROR "Could not find compiler set in environment variable CC:\n$ENV{CC}.") + ENDIF(EXISTS ${CMAKE_C_COMPILER_INIT}) ELSE($ENV{CC} MATCHES ".+") # if not in the envionment then search for the compiler in the path SET(CMAKE_C_COMPILER_LIST ${CMAKE_GENERATOR_CC} gcc cc cl bcc ) diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake index 24ba288..101786a 100644 --- a/Modules/CMakeDetermineCXXCompiler.cmake +++ b/Modules/CMakeDetermineCXXCompiler.cmake @@ -8,12 +8,11 @@ IF(NOT CMAKE_CXX_COMPILER) # if the user has specified CC via the environment, then use that without checking IF($ENV{CXX} MATCHES ".+") - SET(CMAKE_CXX_COMPILER_INIT $ENV{CXX}) - # make sure we can find it - FIND_PROGRAM(CMAKE_CXX_COMPILER_FULLPATH NAMES $ENV{CXX}) - IF(NOT CMAKE_CXX_COMPILER_FULLPATH) - MESSAGE(SEND_ERROR "Could not find compiler set in environment variable CXX:\n$ENV{CXX}, make sure CXX does not have flags in it, use CXXFLAGS instead.") - ENDIF(NOT CMAKE_CXX_COMPILER_FULLPATH) + GET_FILENAME_COMPONENT(CMAKE_CXX_COMPILER_INIT $ENV{CXX} PROGRAM PROGRAM_ARGS CMAKE_CXX_FLAGS_ENV_INIT) + IF(EXISTS ${CMAKE_CXX_COMPILER_INIT}) + ELSE(EXISTS ${CMAKE_CXX_COMPILER_INIT}) + MESSAGE(SEND_ERROR "Could not find compiler set in environment variable CXX:\n$ENV{CXX}.") + ENDIF(EXISTS ${CMAKE_CXX_COMPILER_INIT}) ELSE($ENV{CXX} MATCHES ".+") # if not in the envionment then search for the compiler in the path SET(CMAKE_CXX_COMPILER_LIST ${CMAKE_GENERATOR_CXX} c++ g++ CC aCC cl bcc ) diff --git a/Modules/CMakeSystemSpecificInformation.cmake b/Modules/CMakeSystemSpecificInformation.cmake index a6ef2e2..5b70da6 100644 --- a/Modules/CMakeSystemSpecificInformation.cmake +++ b/Modules/CMakeSystemSpecificInformation.cmake @@ -158,7 +158,7 @@ SET (CMAKE_INSTALL_PREFIX /usr/local CACHE PATH # 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} ${CMAKE_CXX_FLAGS_INIT}" CACHE STRING +SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_ENV_INIT} $ENV{CXXFLAGS} ${CMAKE_CXX_FLAGS_INIT}" CACHE STRING "Flags used by the compiler during all build types.") SET (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG_INIT}" CACHE STRING "Flags used by the compiler during debug builds.") @@ -168,7 +168,7 @@ SET (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE_INIT}" CACHE STRING "Flags used by the compiler during release builds (/MD /Ob1 /Oi /Ot /Oy /Gs will produce slightly less optimized but smaller files).") SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING "Flags used by the compiler during Release with Debug Info builds.") -SET (CMAKE_C_FLAGS " $ENV{CFLAGS} ${CMAKE_C_FLAGS_INIT}" CACHE STRING +SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS_ENV_INIT} $ENV{CFLAGS} ${CMAKE_C_FLAGS_INIT}" CACHE STRING "Flags for C compiler.") SET (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG_INIT}" CACHE STRING "Flags used by the compiler during debug builds.") |