diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2002-11-19 20:55:19 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2002-11-19 20:55:19 (GMT) |
commit | 7140c6f364c55084d5e581cc7e603032ec4087b9 (patch) | |
tree | 1399d66996e9d3dd2a99405cd3d223ce6dab7568 /Modules/CMakeDetermineCXXCompiler.cmake | |
parent | 76fca308d3e04bc33cb8d03a8d10737e875791be (diff) | |
download | CMake-7140c6f364c55084d5e581cc7e603032ec4087b9.zip CMake-7140c6f364c55084d5e581cc7e603032ec4087b9.tar.gz CMake-7140c6f364c55084d5e581cc7e603032ec4087b9.tar.bz2 |
fixes to better honor env CC and CXX
Diffstat (limited to 'Modules/CMakeDetermineCXXCompiler.cmake')
-rw-r--r-- | Modules/CMakeDetermineCXXCompiler.cmake | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake index 1fcdbec..24ba288 100644 --- a/Modules/CMakeDetermineCXXCompiler.cmake +++ b/Modules/CMakeDetermineCXXCompiler.cmake @@ -6,20 +6,23 @@ # as a default compiler IF(NOT CMAKE_CXX_COMPILER) - SET(CMAKE_CXX_COMPILER_LIST ${CMAKE_GENERATOR_CXX} c++ g++ CC aCC cl bcc ) + # if the user has specified CC via the environment, then use that without checking IF($ENV{CXX} MATCHES ".+") - SET(CMAKE_CXX_COMPILER_LIST $ENV{CXX}) + 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) + 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 ) + FIND_PROGRAM(CMAKE_CXX_COMPILER_FULLPATH NAMES ${CMAKE_CXX_COMPILER_LIST}) + GET_FILENAME_COMPONENT(CMAKE_CXX_COMPILER_INIT + ${CMAKE_CXX_COMPILER_FULLPATH} NAME) ENDIF($ENV{CXX} MATCHES ".+") - FIND_PROGRAM(CMAKE_CXX_COMPILER_FULLPATH NAMES ${CMAKE_CXX_COMPILER_LIST}) - GET_FILENAME_COMPONENT(CMAKE_CXX_COMPILER_INIT - ${CMAKE_CXX_COMPILER_FULLPATH} NAME) SET(CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER_INIT} CACHE STRING "C++ compiler") - IF($ENV{CXX} MATCHES ".+") - IF(NOT CMAKE_CXX_COMPILER) - 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) - ENDIF($ENV{CXX} MATCHES ".+") ENDIF(NOT CMAKE_CXX_COMPILER) MARK_AS_ADVANCED(CMAKE_CXX_COMPILER) |