summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorRobert Maynard <robert.maynard@kitware.com>2020-08-18 14:41:22 (GMT)
committerBrad King <brad.king@kitware.com>2020-08-18 17:19:24 (GMT)
commit6896e50967c65ec648c07ba61c796d6660929a91 (patch)
tree3cf76fbf725b807a1be8010237bc617c2f8ba584 /Modules
parentacd15bf146616517df7ac7f55f9c270657cad0d5 (diff)
downloadCMake-6896e50967c65ec648c07ba61c796d6660929a91.zip
CMake-6896e50967c65ec648c07ba61c796d6660929a91.tar.gz
CMake-6896e50967c65ec648c07ba61c796d6660929a91.tar.bz2
CMakeFindBinUtils: Always consider plain binutils when not cross-compiling
Since commit c5dd2ca538 (DetermineCompiler: Relax _CMAKE_TOOLCHAIN_PREFIX detection, 2020-03-25, v3.18.0-rc1~430^2), `_CMAKE_TOOLCHAIN_PREFIX` may be set even when not cross-compiling. In this case we may still need to use binutils without any prefix. Fixes: #21103
Diffstat (limited to 'Modules')
-rw-r--r--Modules/CMakeFindBinUtils.cmake13
1 files changed, 13 insertions, 0 deletions
diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake
index de9ef9a..b2004f1 100644
--- a/Modules/CMakeFindBinUtils.cmake
+++ b/Modules/CMakeFindBinUtils.cmake
@@ -102,6 +102,19 @@ else()
set(_CMAKE_ADDITIONAL_ADDR2LINE_NAMES "llvm-addr2line")
endif()
+ if(NOT CMAKE_CROSSCOMPILING AND NOT "${_CMAKE_TOOLCHAIN_PREFIX}" STREQUAL "")
+ list(APPEND _CMAKE_ADDITIONAL_AR_NAMES "ar")
+ list(APPEND _CMAKE_ADDITIONAL_RANLIB_NAMES "ranlib")
+ list(APPEND _CMAKE_ADDITIONAL_STRIP_NAMES "strip")
+ list(APPEND _CMAKE_ADDITIONAL_LINKER_NAMES "ld")
+ list(APPEND _CMAKE_ADDITIONAL_NM_NAMES "nm")
+ list(APPEND _CMAKE_ADDITIONAL_OBJDUMP_NAMES "objdump")
+ list(APPEND _CMAKE_ADDITIONAL_OBJCOPY_NAMES "objcopy")
+ list(APPEND _CMAKE_ADDITIONAL_READELF_NAMES "readelf")
+ list(APPEND _CMAKE_ADDITIONAL_DLLTOOL_NAMES "dlltool")
+ list(APPEND _CMAKE_ADDITIONAL_ADDR2LINE_NAMES "addr2line")
+ endif()
+
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 ${_CMAKE_ADDITIONAL_RANLIB_NAMES} HINTS ${_CMAKE_TOOLCHAIN_LOCATION})