diff options
author | Alexander Neundorf <neundorf@kde.org> | 2007-07-18 14:52:53 (GMT) |
---|---|---|
committer | Alexander Neundorf <neundorf@kde.org> | 2007-07-18 14:52:53 (GMT) |
commit | ff9ed18dad7281c074ce80befa47d7d510d4476b (patch) | |
tree | 39bed389f59ffe540d112a5900202a9cbf259cde | |
parent | 27244a1fdef646ea791e28119cefc57c4c967564 (diff) | |
download | CMake-ff9ed18dad7281c074ce80befa47d7d510d4476b.zip CMake-ff9ed18dad7281c074ce80befa47d7d510d4476b.tar.gz CMake-ff9ed18dad7281c074ce80befa47d7d510d4476b.tar.bz2 |
ENH: if CMAKE_(C|CXX)_COMPILER is preset to a list of two elements, use the
first one as the compiler and the second one as ARG1 for the compiler
Alex
-rw-r--r-- | Modules/CMakeDetermineCCompiler.cmake | 10 | ||||
-rw-r--r-- | Modules/CMakeDetermineCXXCompiler.cmake | 9 |
2 files changed, 18 insertions, 1 deletions
diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake index cee4adf..6fdcf00 100644 --- a/Modules/CMakeDetermineCCompiler.cmake +++ b/Modules/CMakeDetermineCCompiler.cmake @@ -59,7 +59,15 @@ ELSE(NOT CMAKE_C_COMPILER) # we only get here if CMAKE_C_COMPILER was specified using -D or a pre-made CMakeCache.txt # (e.g. via ctest) or set in CMAKE_TOOLCHAIN_FILE - # + # if CMAKE_C_COMPILER is a list of length 2, use the first item as + # CMAKE_C_COMPILER and the 2nd one as CMAKE_C_COMPILER_ARG1 + + LIST(LENGTH CMAKE_C_COMPILER _CMAKE_C_COMPILER_LIST_LENGTH) + IF("${_CMAKE_C_COMPILER_LIST_LENGTH}" EQUAL 2) + LIST(GET CMAKE_C_COMPILER 1 CMAKE_C_COMPILER_ARG1) + LIST(GET CMAKE_C_COMPILER 0 CMAKE_C_COMPILER) + ENDIF("${_CMAKE_C_COMPILER_LIST_LENGTH}" EQUAL 2) + # if a compiler was specified by the user but without path, # now try to find it with the full path # if it is found, force it into the cache, diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake index 1efbc65..d5eb95a 100644 --- a/Modules/CMakeDetermineCXXCompiler.cmake +++ b/Modules/CMakeDetermineCXXCompiler.cmake @@ -59,6 +59,15 @@ ELSE(NOT CMAKE_CXX_COMPILER) # we only get here if CMAKE_CXX_COMPILER was specified using -D or a pre-made CMakeCache.txt # (e.g. via ctest) or set in CMAKE_TOOLCHAIN_FILE # +# if CMAKE_CXX_COMPILER is a list of length 2, use the first item as +# CMAKE_CXX_COMPILER and the 2nd one as CMAKE_CXX_COMPILER_ARG1 + + LIST(LENGTH CMAKE_CXX_COMPILER _CMAKE_CXX_COMPILER_LIST_LENGTH) + IF("${_CMAKE_CXX_COMPILER_LIST_LENGTH}" EQUAL 2) + LIST(GET CMAKE_CXX_COMPILER 1 CMAKE_CXX_COMPILER_ARG1) + LIST(GET CMAKE_CXX_COMPILER 0 CMAKE_CXX_COMPILER) + ENDIF("${_CMAKE_CXX_COMPILER_LIST_LENGTH}" EQUAL 2) + # if a compiler was specified by the user but without path, # now try to find it with the full path # if it is found, force it into the cache, |