diff options
author | Brad King <brad.king@kitware.com> | 2014-03-10 20:51:41 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-03-10 21:12:00 (GMT) |
commit | 6852fb8034d30d14498dc874378881696a6ada23 (patch) | |
tree | 59345bdceb1b7894b2ff919aaeeb240e776755c1 /Modules/CMakeDetermineCXXCompiler.cmake | |
parent | a7c956b86736ea82ade88bea6414cd6a8c84e307 (diff) | |
download | CMake-6852fb8034d30d14498dc874378881696a6ada23.zip CMake-6852fb8034d30d14498dc874378881696a6ada23.tar.gz CMake-6852fb8034d30d14498dc874378881696a6ada23.tar.bz2 |
CMakeDetermine*Compiler: Factor out search for compiler in PATH
Factor out a _cmake_find_compiler_path helper macro to avoid duplication
of the search for a full path to the compiler.
Diffstat (limited to 'Modules/CMakeDetermineCXXCompiler.cmake')
-rw-r--r-- | Modules/CMakeDetermineCXXCompiler.cmake | 27 |
1 files changed, 1 insertions, 26 deletions
diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake index 21864f1..d60cff3 100644 --- a/Modules/CMakeDetermineCXXCompiler.cmake +++ b/Modules/CMakeDetermineCXXCompiler.cmake @@ -70,32 +70,7 @@ else() _cmake_find_compiler(CXX) else() - - # 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() - - # 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, - # if not, don't overwrite the setting (which was given by the user) with "NOTFOUND" - # if the CXX compiler already had a path, reuse it for searching the C compiler - get_filename_component(_CMAKE_USER_CXX_COMPILER_PATH "${CMAKE_CXX_COMPILER}" PATH) - if(NOT _CMAKE_USER_CXX_COMPILER_PATH) - find_program(CMAKE_CXX_COMPILER_WITH_PATH NAMES ${CMAKE_CXX_COMPILER}) - if(CMAKE_CXX_COMPILER_WITH_PATH) - set(CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER_WITH_PATH} CACHE STRING "CXX compiler" FORCE) - endif() - unset(CMAKE_CXX_COMPILER_WITH_PATH CACHE) - endif() + _cmake_find_compiler_path(CXX) endif() mark_as_advanced(CMAKE_CXX_COMPILER) |