diff options
author | Ruslan Baratov <ruslan_baratov@yahoo.com> | 2017-03-08 03:25:47 (GMT) |
---|---|---|
committer | Ruslan Baratov <ruslan_baratov@yahoo.com> | 2017-03-08 20:28:01 (GMT) |
commit | b9d36826c5676bf3d0bb55fb47c6ce62f4f3470d (patch) | |
tree | 1f4f75b27fcc1d51852a7909e34ddbe22b95c955 /Modules/Compiler/GNU-FindBinUtils.cmake | |
parent | 52d39264b49c18f6f1e98a2348e69cd679e389bc (diff) | |
download | CMake-b9d36826c5676bf3d0bb55fb47c6ce62f4f3470d.zip CMake-b9d36826c5676bf3d0bb55fb47c6ce62f4f3470d.tar.gz CMake-b9d36826c5676bf3d0bb55fb47c6ce62f4f3470d.tar.bz2 |
Add 'CMAKE_GCC_AR' and 'CMAKE_GCC_RANLIB' variables
Diffstat (limited to 'Modules/Compiler/GNU-FindBinUtils.cmake')
-rw-r--r-- | Modules/Compiler/GNU-FindBinUtils.cmake | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/Modules/Compiler/GNU-FindBinUtils.cmake b/Modules/Compiler/GNU-FindBinUtils.cmake new file mode 100644 index 0000000..e314eb9 --- /dev/null +++ b/Modules/Compiler/GNU-FindBinUtils.cmake @@ -0,0 +1,27 @@ +cmake_policy(SET CMP0054 NEW) + +if("${_CMAKE_PROCESSING_LANGUAGE}" STREQUAL "") + message(FATAL_ERROR "Internal error: _CMAKE_PROCESSING_LANGUAGE is not set") +endif() + +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 GCC itself +get_filename_component(__gcc_hints "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER}" DIRECTORY) + +# http://manpages.ubuntu.com/manpages/wily/en/man1/gcc-ar.1.html +find_program(CMAKE_GCC_AR NAMES + "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ar" + "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ar-${__version_x_y}" + HINTS ${__gcc_hints} + DOC "A wrapper around 'ar' adding the appropriate '--plugin' option for the GCC compiler" +) + +# http://manpages.ubuntu.com/manpages/wily/en/man1/gcc-ranlib.1.html +find_program(CMAKE_GCC_RANLIB NAMES + "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ranlib" + "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ranlib-${__version_x_y}" + HINTS ${__gcc_hints} + DOC "A wrapper around 'ranlib' adding the appropriate '--plugin' option for the GCC compiler" +) |