diff options
author | Norbert Lange <nolange79@gmail.com> | 2019-07-23 21:57:45 (GMT) |
---|---|---|
committer | Norbert Lange <nolange79@gmail.com> | 2019-07-23 21:57:45 (GMT) |
commit | 3a82ef78eb8895016e57758c5ee943270024dbeb (patch) | |
tree | 1322bf4e1908b9b181e5cc03910632d54948f6b9 /Modules | |
parent | 0c6e27bff1dc362993c2e1f5271424b4c881140a (diff) | |
download | CMake-3a82ef78eb8895016e57758c5ee943270024dbeb.zip CMake-3a82ef78eb8895016e57758c5ee943270024dbeb.tar.gz CMake-3a82ef78eb8895016e57758c5ee943270024dbeb.tar.bz2 |
CMakeFindBinUtils: Rename and unset variables for additional names
use the name pattern `_CMAKE_ADDITIONAL_<PROGRAM_NAME>_NAMES`,
and unset those variables at the end of the function
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/CMakeFindBinUtils.cmake | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake index 0e84116..db183e8 100644 --- a/Modules/CMakeFindBinUtils.cmake +++ b/Modules/CMakeFindBinUtils.cmake @@ -72,7 +72,7 @@ if(("x${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_SIMULATE_ID}" STREQUAL "xMSVC" AND find_program(CMAKE_LINKER NAMES link HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) find_program(CMAKE_MT NAMES mt HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) - list(APPEND _CMAKE_TOOL_VARS CMAKE_LINKER CMAKE_MT) + list(APPEND _CMAKE_TOOL_VARS LINKER MT) # in all other cases search for ar, ranlib, etc. else() @@ -84,27 +84,27 @@ else() endif() if("${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ID}" STREQUAL Clang) - set(LLVM_OBJDUMP "llvm-objdump") - set(LLVM_LLD "ld.lld") - set(LLVM_RANLIB "llvm-ranlib") - set(LLVM_AR "llvm-ar") + set(_CMAKE_ADDITIONAL_OBJDUMP_NAMES "llvm-objdump") + set(_CMAKE_ADDITIONAL_LINKER_NAMES "ld.lld") + set(_CMAKE_ADDITIONAL_RANLIB_NAMES "llvm-ranlib") + set(_CMAKE_ADDITIONAL_AR_NAMES "llvm-ar") endif() - find_program(CMAKE_AR NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ar${_CMAKE_TOOLCHAIN_SUFFIX} ${LLVM_AR} HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) + find_program(CMAKE_AR NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ar${_CMAKE_TOOLCHAIN_SUFFIX} ${_CMAKE_ADDITIONAL_AR_NAMES} HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) - find_program(CMAKE_RANLIB NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ranlib ${LLVM_RANLIB} HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) + find_program(CMAKE_RANLIB NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ranlib ${_CMAKE_ADDITIONAL_RANLIB_NAMES} HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) if(NOT CMAKE_RANLIB) set(CMAKE_RANLIB : CACHE INTERNAL "noop for ranlib") endif() find_program(CMAKE_STRIP NAMES ${_CMAKE_TOOLCHAIN_PREFIX}strip${_CMAKE_TOOLCHAIN_SUFFIX} HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) - find_program(CMAKE_LINKER NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ld ${LLVM_LLD} HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) + find_program(CMAKE_LINKER NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ld ${_CMAKE_ADDITIONAL_LINKER_NAMES} HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) find_program(CMAKE_NM NAMES ${_CMAKE_TOOLCHAIN_PREFIX}nm HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) - find_program(CMAKE_OBJDUMP NAMES ${_CMAKE_TOOLCHAIN_PREFIX}objdump ${LLVM_OBJDUMP} HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) + find_program(CMAKE_OBJDUMP NAMES ${_CMAKE_TOOLCHAIN_PREFIX}objdump ${_CMAKE_ADDITIONAL_OBJDUMP_NAMES} HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) find_program(CMAKE_OBJCOPY NAMES ${_CMAKE_TOOLCHAIN_PREFIX}objcopy HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) - list(APPEND _CMAKE_TOOL_VARS CMAKE_AR CMAKE_RANLIB CMAKE_STRIP CMAKE_LINKER CMAKE_NM CMAKE_OBJDUMP CMAKE_OBJCOPY) + list(APPEND _CMAKE_TOOL_VARS AR RANLIB STRIP LINKER NM OBJDUMP OBJCOPY) endif() @@ -115,15 +115,16 @@ if(CMAKE_PLATFORM_HAS_INSTALLNAME) message(FATAL_ERROR "Could not find install_name_tool, please check your installation.") endif() - list(APPEND _CMAKE_TOOL_VARS CMAKE_INSTALL_NAME_TOOL) + list(APPEND _CMAKE_TOOL_VARS INSTALL_NAME_TOOL) endif() # Mark any tool cache entries as advanced. foreach(var IN LISTS _CMAKE_TOOL_VARS) - get_property(_CMAKE_TOOL_CACHED CACHE ${var} PROPERTY TYPE) + get_property(_CMAKE_TOOL_CACHED CACHE CMAKE_${var} PROPERTY TYPE) if(_CMAKE_TOOL_CACHED) - mark_as_advanced(${var}) + mark_as_advanced(CMAKE_${var}) endif() + unset(_CMAKE_ADDITIONAL_${var}_NAMES) endforeach() unset(_CMAKE_TOOL_VARS) unset(_CMAKE_TOOL_CACHED) |