summaryrefslogtreecommitdiffstats
path: root/Modules/CMakeDetermineCXXCompiler.cmake
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2002-12-06 15:09:41 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2002-12-06 15:09:41 (GMT)
commitb3ca217a2323ece7bca802107f9476ec81cb1ef5 (patch)
tree98517690a76635d63ea2b53ec317f106d69db1d4 /Modules/CMakeDetermineCXXCompiler.cmake
parent35fb6f22baa7b3f1ca9f7e29be41c4b91b14554a (diff)
downloadCMake-b3ca217a2323ece7bca802107f9476ec81cb1ef5.zip
CMake-b3ca217a2323ece7bca802107f9476ec81cb1ef5.tar.gz
CMake-b3ca217a2323ece7bca802107f9476ec81cb1ef5.tar.bz2
clean up compiler picking code
Diffstat (limited to 'Modules/CMakeDetermineCXXCompiler.cmake')
-rw-r--r--Modules/CMakeDetermineCXXCompiler.cmake8
1 files changed, 3 insertions, 5 deletions
diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake
index 6651943..fa234fd 100644
--- a/Modules/CMakeDetermineCXXCompiler.cmake
+++ b/Modules/CMakeDetermineCXXCompiler.cmake
@@ -8,7 +8,7 @@
IF(NOT CMAKE_CXX_COMPILER)
SET(CMAKE_CXX_COMPILER_INIT NOTFOUND)
- # if the user has specified CC via the environment, then use that without checking
+ # 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(EXISTS ${CMAKE_CXX_COMPILER_INIT})
@@ -17,12 +17,14 @@ IF(NOT CMAKE_CXX_COMPILER)
ENDIF(EXISTS ${CMAKE_CXX_COMPILER_INIT})
ENDIF($ENV{CXX} MATCHES ".+")
+ # next prefer the generator specified compiler
IF(CMAKE_GENERATOR_CXX)
IF(NOT CMAKE_CXX_COMPILER_INIT)
SET(CMAKE_CXX_COMPILER_INIT ${CMAKE_GENERATOR_CXX})
ENDIF(NOT CMAKE_CXX_COMPILER_INIT)
ENDIF(CMAKE_GENERATOR_CXX)
+ # if no compiler has been found yet, then try to find one
IF(NOT CMAKE_CXX_COMPILER_INIT)
# if not in the envionment then search for the compiler in the path
SET(CMAKE_CXX_COMPILER_LIST c++ g++ CC aCC cl bcc )
@@ -35,10 +37,6 @@ IF(NOT CMAKE_CXX_COMPILER)
ENDIF(NOT CMAKE_CXX_COMPILER)
MARK_AS_ADVANCED(CMAKE_CXX_COMPILER)
-# set this to notfound right after so that it is searched for each time this
-# file is included
-SET(CMAKE_CXX_COMPILER_FULLPATH NOTFOUND CACHE INTERNAL "full path to cxx compiler" FORCE)
-
# test to see if the cxx compiler is gnu
EXEC_PROGRAM(${CMAKE_CXX_COMPILER} ARGS -E ${CMAKE_ROOT}/Modules/CMakeTestGNU.c OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT RETURN_VALUE CMAKE_COMPILER_RETURN)