summaryrefslogtreecommitdiff
path: root/Modules/CMakeDetermineCXXCompiler.cmake
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2002-12-06 10:02:19 -0500
committerBill Hoffman <bill.hoffman@kitware.com>2002-12-06 10:02:19 -0500
commit35fb6f22baa7b3f1ca9f7e29be41c4b91b14554a (patch)
treeefede790843f1b48a7eaddd52a919886970ce841 /Modules/CMakeDetermineCXXCompiler.cmake
parent19aa18fd2622ae22934a4a831c6de3b6af20f151 (diff)
downloadcmake-35fb6f22baa7b3f1ca9f7e29be41c4b91b14554a.tar.gz
fix for generator picked compilers
Diffstat (limited to 'Modules/CMakeDetermineCXXCompiler.cmake')
-rw-r--r--Modules/CMakeDetermineCXXCompiler.cmake18
1 files changed, 14 insertions, 4 deletions
diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake
index 101786a3f7..6651943c4a 100644
--- a/Modules/CMakeDetermineCXXCompiler.cmake
+++ b/Modules/CMakeDetermineCXXCompiler.cmake
@@ -6,20 +6,30 @@
# as a default compiler
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
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})
ELSE(EXISTS ${CMAKE_CXX_COMPILER_INIT})
- MESSAGE(SEND_ERROR "Could not find compiler set in environment variable CXX:\n$ENV{CXX}.")
+ MESSAGE(SEND_ERROR "Could not find compiler set in environment variable CXX:\n$ENV{CXX}.\n${CMAKE_CXX_COMPILER_INIT}")
ENDIF(EXISTS ${CMAKE_CXX_COMPILER_INIT})
- ELSE($ENV{CXX} MATCHES ".+")
+ ENDIF($ENV{CXX} MATCHES ".+")
+
+ 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(NOT CMAKE_CXX_COMPILER_INIT)
# 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 )
+ SET(CMAKE_CXX_COMPILER_LIST 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 ".+")
+ ENDIF(NOT CMAKE_CXX_COMPILER_INIT)
SET(CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER_INIT}
CACHE STRING "C++ compiler")
ENDIF(NOT CMAKE_CXX_COMPILER)