diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2002-12-06 15:02:19 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2002-12-06 15:02:19 (GMT) |
commit | 35fb6f22baa7b3f1ca9f7e29be41c4b91b14554a (patch) | |
tree | efede790843f1b48a7eaddd52a919886970ce841 | |
parent | 19aa18fd2622ae22934a4a831c6de3b6af20f151 (diff) | |
download | CMake-35fb6f22baa7b3f1ca9f7e29be41c4b91b14554a.zip CMake-35fb6f22baa7b3f1ca9f7e29be41c4b91b14554a.tar.gz CMake-35fb6f22baa7b3f1ca9f7e29be41c4b91b14554a.tar.bz2 |
fix for generator picked compilers
-rw-r--r-- | Modules/CMakeDetermineCCompiler.cmake | 16 | ||||
-rw-r--r-- | Modules/CMakeDetermineCXXCompiler.cmake | 18 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio6Generator.cxx | 2 |
3 files changed, 29 insertions, 7 deletions
diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake index 72a2a03..2198675 100644 --- a/Modules/CMakeDetermineCCompiler.cmake +++ b/Modules/CMakeDetermineCCompiler.cmake @@ -6,6 +6,8 @@ # as a default compiler IF(NOT CMAKE_C_COMPILER) + SET(CMAKE_CXX_COMPILER_INIT NOTFOUND) + # if the user has specified CC via the environment, then use that without checking IF($ENV{CC} MATCHES ".+") GET_FILENAME_COMPONENT(CMAKE_C_COMPILER_INIT $ENV{CC} PROGRAM PROGRAM_ARGS CMAKE_C_FLAGS_ENV_INIT) @@ -13,13 +15,21 @@ IF(NOT CMAKE_C_COMPILER) 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 ".+") + ENDIF($ENV{CC} MATCHES ".+") + + IF(CMAKE_GENERATOR_CC) + IF(NOT CMAKE_CC_COMPILER_INIT) + SET(CMAKE_CC_COMPILER_INIT ${CMAKE_GENERATOR_CC}) + ENDIF(NOT CMAKE_CC_COMPILER_INIT) + ENDIF(CMAKE_GENERATOR_CC) + + IF(NOT CMAKE_CC_COMPILER_INIT) # 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 ) + SET(CMAKE_C_COMPILER_LIST gcc cc cl bcc ) FIND_PROGRAM(CMAKE_C_COMPILER_FULLPATH NAMES ${CMAKE_C_COMPILER_LIST} ) GET_FILENAME_COMPONENT(CMAKE_C_COMPILER_INIT ${CMAKE_C_COMPILER_FULLPATH} NAME) - ENDIF($ENV{CC} MATCHES ".+") + ENDIF(NOT CMAKE_CC_COMPILER_INIT) # set this to notfound right after so that it is searched for each time this # file is included SET(CMAKE_C_COMPILER ${CMAKE_C_COMPILER_INIT} CACHE STRING "C compiler") diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake index 101786a..6651943 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) diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx index a3d5f84..ea3245a 100644 --- a/Source/cmGlobalVisualStudio6Generator.cxx +++ b/Source/cmGlobalVisualStudio6Generator.cxx @@ -27,6 +27,8 @@ cmGlobalVisualStudio6Generator::cmGlobalVisualStudio6Generator() void cmGlobalVisualStudio6Generator::EnableLanguage(const char* lang, cmMakefile *mf) { + mf->AddDefinition("CMAKE_GENERATOR_CC", "cl"); + mf->AddDefinition("CMAKE_GENERATOR_CXX", "cl"); this->cmGlobalGenerator::EnableLanguage(lang, mf); } |