diff options
author | Ruslan Baratov <ruslan_baratov@yahoo.com> | 2017-04-28 14:13:56 (GMT) |
---|---|---|
committer | Ruslan Baratov <ruslan_baratov@yahoo.com> | 2017-04-28 14:13:56 (GMT) |
commit | 7d057b2738e229192ae5afe71d50354681813235 (patch) | |
tree | bebcaf0fcca709a89a4d6e9dde390ef7003cef38 /Modules/Compiler/Clang-FindBinUtils.cmake | |
parent | d828d0eb084cf094119d2b47dae0053267aba138 (diff) | |
download | CMake-7d057b2738e229192ae5afe71d50354681813235.zip CMake-7d057b2738e229192ae5afe71d50354681813235.tar.gz CMake-7d057b2738e229192ae5afe71d50354681813235.tar.bz2 |
Clang IPO (LTO) support
Diffstat (limited to 'Modules/Compiler/Clang-FindBinUtils.cmake')
-rw-r--r-- | Modules/Compiler/Clang-FindBinUtils.cmake | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/Modules/Compiler/Clang-FindBinUtils.cmake b/Modules/Compiler/Clang-FindBinUtils.cmake new file mode 100644 index 0000000..c81e77a --- /dev/null +++ b/Modules/Compiler/Clang-FindBinUtils.cmake @@ -0,0 +1,25 @@ +if(NOT DEFINED _CMAKE_PROCESSING_LANGUAGE OR _CMAKE_PROCESSING_LANGUAGE STREQUAL "") + message(FATAL_ERROR "Internal error: _CMAKE_PROCESSING_LANGUAGE is not set") +endif() + +# 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) + +get_filename_component(__clang_hint_2 "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER}" DIRECTORY) + +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" + HINTS ${__clang_hints} + DOC "LLVM archiver" +) + +# 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" + HINTS ${__clang_hints} + DOC "Generate index for LLVM archive" +) |