Merge topic 'pr.gcc_ar'

b9d36826 Add 'CMAKE_GCC_AR' and 'CMAKE_GCC_RANLIB' variables

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !550
This commit is contained in:
Brad King 2017-03-10 13:40:52 +00:00 committed by Kitware Robot
commit 29ec8d65f2
12 changed files with 70 additions and 0 deletions

View File

@ -40,6 +40,8 @@ Variables that Provide Information
/variable/CMAKE_FIND_PACKAGE_NAME
/variable/CMAKE_FIND_PACKAGE_SORT_DIRECTION
/variable/CMAKE_FIND_PACKAGE_SORT_ORDER
/variable/CMAKE_GCC_AR
/variable/CMAKE_GCC_RANLIB
/variable/CMAKE_GENERATOR
/variable/CMAKE_GENERATOR_PLATFORM
/variable/CMAKE_GENERATOR_TOOLSET

View File

@ -0,0 +1,8 @@
gcc_archiving_tools
-------------------
* The :variable:`CMAKE_GCC_AR` variable with the path to GCC wrapper of ``ar``
utility was added.
* The :variable:`CMAKE_GCC_RANLIB` variable with the path to GCC wrapper of
``ranlib`` utility was added.

View File

@ -0,0 +1,7 @@
CMAKE_GCC_AR
------------
A wrapper around ``ar`` adding the appropriate ``--plugin`` option for the
GCC compiler. For other compilers variable is not defined.
See also :variable:`CMAKE_AR`.

View File

@ -0,0 +1,7 @@
CMAKE_GCC_RANLIB
----------------
A wrapper around ``ranlib`` adding the appropriate ``--plugin`` option for the
GCC compiler. For other compilers variable is not defined.
See also :variable:`CMAKE_RANLIB`.

View File

@ -1,7 +1,9 @@
set(CMAKE_ASM@ASM_DIALECT@_COMPILER "@_CMAKE_ASM_COMPILER@")
set(CMAKE_ASM@ASM_DIALECT@_COMPILER_ARG1 "@_CMAKE_ASM_COMPILER_ARG1@")
set(CMAKE_AR "@CMAKE_AR@")
set(CMAKE_GCC_AR "@CMAKE_GCC_AR@")
set(CMAKE_RANLIB "@CMAKE_RANLIB@")
set(CMAKE_GCC_RANLIB "@CMAKE_GCC_RANLIB@")
set(CMAKE_LINKER "@CMAKE_LINKER@")
set(CMAKE_ASM@ASM_DIALECT@_COMPILER_LOADED 1)
set(CMAKE_ASM@ASM_DIALECT@_COMPILER_ID "@_CMAKE_ASM_COMPILER_ID@")

View File

@ -14,7 +14,9 @@ set(CMAKE_C_SIMULATE_ID "@CMAKE_C_SIMULATE_ID@")
set(CMAKE_C_SIMULATE_VERSION "@CMAKE_C_SIMULATE_VERSION@")
@SET_MSVC_C_ARCHITECTURE_ID@
set(CMAKE_AR "@CMAKE_AR@")
set(CMAKE_GCC_AR "@CMAKE_GCC_AR@")
set(CMAKE_RANLIB "@CMAKE_RANLIB@")
set(CMAKE_GCC_RANLIB "@CMAKE_GCC_RANLIB@")
set(CMAKE_LINKER "@CMAKE_LINKER@")
set(CMAKE_COMPILER_IS_GNUCC @CMAKE_COMPILER_IS_GNUCC@)
set(CMAKE_C_COMPILER_LOADED 1)

View File

@ -15,7 +15,9 @@ set(CMAKE_CXX_SIMULATE_ID "@CMAKE_CXX_SIMULATE_ID@")
set(CMAKE_CXX_SIMULATE_VERSION "@CMAKE_CXX_SIMULATE_VERSION@")
@SET_MSVC_CXX_ARCHITECTURE_ID@
set(CMAKE_AR "@CMAKE_AR@")
set(CMAKE_GCC_AR "@CMAKE_GCC_AR@")
set(CMAKE_RANLIB "@CMAKE_RANLIB@")
set(CMAKE_GCC_RANLIB "@CMAKE_GCC_RANLIB@")
set(CMAKE_LINKER "@CMAKE_LINKER@")
set(CMAKE_COMPILER_IS_GNUCXX @CMAKE_COMPILER_IS_GNUCXX@)
set(CMAKE_CXX_COMPILER_LOADED 1)

View File

@ -166,6 +166,10 @@ if (CMAKE_CROSSCOMPILING AND NOT _CMAKE_TOOLCHAIN_PREFIX)
endif ()
include(CMakeFindBinUtils)
set(_CMAKE_PROCESSING_LANGUAGE "C")
include(Compiler/${CMAKE_C_COMPILER_ID}-FindBinUtils OPTIONAL)
unset(_CMAKE_PROCESSING_LANGUAGE)
if(MSVC_C_ARCHITECTURE_ID)
set(SET_MSVC_C_ARCHITECTURE_ID
"set(MSVC_C_ARCHITECTURE_ID ${MSVC_C_ARCHITECTURE_ID})")

View File

@ -161,6 +161,10 @@ if (CMAKE_CROSSCOMPILING AND NOT _CMAKE_TOOLCHAIN_PREFIX)
endif ()
include(CMakeFindBinUtils)
set(_CMAKE_PROCESSING_LANGUAGE "CXX")
include(Compiler/${CMAKE_CXX_COMPILER_ID}-FindBinUtils OPTIONAL)
unset(_CMAKE_PROCESSING_LANGUAGE)
if(MSVC_CXX_ARCHITECTURE_ID)
set(SET_MSVC_CXX_ARCHITECTURE_ID
"set(MSVC_CXX_ARCHITECTURE_ID ${MSVC_CXX_ARCHITECTURE_ID})")

View File

@ -255,6 +255,9 @@ if (CMAKE_CROSSCOMPILING AND NOT _CMAKE_TOOLCHAIN_PREFIX)
endif ()
include(CMakeFindBinUtils)
set(_CMAKE_PROCESSING_LANGUAGE "Fortran")
include(Compiler/${CMAKE_Fortran_COMPILER_ID}-FindBinUtils OPTIONAL)
unset(_CMAKE_PROCESSING_LANGUAGE)
if(MSVC_Fortran_ARCHITECTURE_ID)
set(SET_MSVC_Fortran_ARCHITECTURE_ID

View File

@ -8,7 +8,9 @@ set(CMAKE_Fortran_SIMULATE_ID "@CMAKE_Fortran_SIMULATE_ID@")
set(CMAKE_Fortran_SIMULATE_VERSION "@CMAKE_Fortran_SIMULATE_VERSION@")
@SET_MSVC_Fortran_ARCHITECTURE_ID@
set(CMAKE_AR "@CMAKE_AR@")
set(CMAKE_GCC_AR "@CMAKE_GCC_AR@")
set(CMAKE_RANLIB "@CMAKE_RANLIB@")
set(CMAKE_GCC_RANLIB "@CMAKE_GCC_RANLIB@")
set(CMAKE_COMPILER_IS_GNUG77 @CMAKE_COMPILER_IS_GNUG77@)
set(CMAKE_Fortran_COMPILER_LOADED 1)
set(CMAKE_Fortran_COMPILER_WORKS @CMAKE_Fortran_COMPILER_WORKS@)

View File

@ -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"
)