mirror of
https://github.com/Kitware/CMake.git
synced 2026-07-03 13:18:11 +00:00
Clang: Find version-suffixed LLVM/Clang binutils
Debian renames all LLVM/Clang binaries with a version suffix to allow multiple versions to be installed at the same time. While there is a version-agnostic package that adds a symlink to provide the standard binary names, if only the versioned packages are installed, binaries must be found as `binary-x.y`. In any case, using the same version of the `binutils` as the compiler seems better.
This commit is contained in:
committed by
Brad King
parent
fca4423786
commit
630235bd9e
@@ -2,6 +2,12 @@ if(NOT DEFINED _CMAKE_PROCESSING_LANGUAGE OR _CMAKE_PROCESSING_LANGUAGE STREQUAL
|
||||
message(FATAL_ERROR "Internal error: _CMAKE_PROCESSING_LANGUAGE is not set")
|
||||
endif()
|
||||
|
||||
# Debian:
|
||||
# * /usr/bin/llvm-ar-4.0
|
||||
# * /usr/bin/llvm-ranlib-4.0
|
||||
string(REGEX MATCH "^([0-9]+\\.[0-9]+)" __version_x_y
|
||||
"${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_VERSION}")
|
||||
|
||||
# Try to find tools in the same directory as Clang itself
|
||||
get_filename_component(__clang_hint_1 "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER}" REALPATH)
|
||||
get_filename_component(__clang_hint_1 "${__clang_hint_1}" DIRECTORY)
|
||||
@@ -12,6 +18,7 @@ set(__clang_hints ${__clang_hint_1} ${__clang_hint_2})
|
||||
|
||||
# http://manpages.ubuntu.com/manpages/precise/en/man1/llvm-ar.1.html
|
||||
find_program(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_AR NAMES
|
||||
"${_CMAKE_TOOLCHAIN_PREFIX}llvm-ar-${__version_x_y}"
|
||||
"${_CMAKE_TOOLCHAIN_PREFIX}llvm-ar"
|
||||
HINTS ${__clang_hints}
|
||||
DOC "LLVM archiver"
|
||||
@@ -20,6 +27,7 @@ mark_as_advanced(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_AR)
|
||||
|
||||
# http://manpages.ubuntu.com/manpages/precise/en/man1/llvm-ranlib.1.html
|
||||
find_program(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_RANLIB NAMES
|
||||
"${_CMAKE_TOOLCHAIN_PREFIX}llvm-ranlib-${__version_x_y}"
|
||||
"${_CMAKE_TOOLCHAIN_PREFIX}llvm-ranlib"
|
||||
HINTS ${__clang_hints}
|
||||
DOC "Generate index for LLVM archive"
|
||||
|
||||
Reference in New Issue
Block a user