summaryrefslogtreecommitdiff
path: root/Modules/CMakeDetermineCXXCompiler.cmake
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2005-07-20 15:44:55 -0400
committerBill Hoffman <bill.hoffman@kitware.com>2005-07-20 15:44:55 -0400
commitb8b298104b18486e65fd40ae410a327d9e6fe8f3 (patch)
treed447d9b5cbf635545721fd27046e9520e02f0a4b /Modules/CMakeDetermineCXXCompiler.cmake
parentff250565a2316b6bd639fba2db1c8180a8f590db (diff)
downloadcmake-b8b298104b18486e65fd40ae410a327d9e6fe8f3.tar.gz
ENH: make sure flags set in CC or CXX environment variables stay with the compiler
Diffstat (limited to 'Modules/CMakeDetermineCXXCompiler.cmake')
-rw-r--r--Modules/CMakeDetermineCXXCompiler.cmake3
1 files changed, 3 insertions, 0 deletions
diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake
index 465822933f..60cf283944 100644
--- a/Modules/CMakeDetermineCXXCompiler.cmake
+++ b/Modules/CMakeDetermineCXXCompiler.cmake
@@ -11,6 +11,9 @@ IF(NOT CMAKE_CXX_COMPILER)
# prefer the environment variable CXX
IF($ENV{CXX} MATCHES ".+")
GET_FILENAME_COMPONENT(CMAKE_CXX_COMPILER_INIT $ENV{CXX} PROGRAM PROGRAM_ARGS CMAKE_CXX_FLAGS_ENV_INIT)
+ IF(CMAKE_CXX_FLAGS_ENV_INIT)
+ SET(CMAKE_CXX_COMPILER_ARG1 ${CMAKE_CXX_FLAGS_ENV_INIT} CACHE STRING "First argument to CXX compiler")
+ ENDIF(CMAKE_CXX_FLAGS_ENV_INIT)
IF(EXISTS ${CMAKE_CXX_COMPILER_INIT})
ELSE(EXISTS ${CMAKE_CXX_COMPILER_INIT})
MESSAGE(FATAL_ERROR "Could not find compiler set in environment variable CXX:\n$ENV{CXX}.\n${CMAKE_CXX_COMPILER_INIT}")