mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-26 02:38:37 -06:00
FindBoost: Add explicit Boost_ARCHITECTURE option
Boost 1.66 and above built with `--layout=versioned` add an architecture tag to the library file names. We already try to compute this tag automatically when `CMAKE_CXX_COMPILER_ARCHITECTURE_ID` is available, but that is currently not computed everywhere. Add an explicit `Boost_ARCHITECTURE` option that a user can set to specify the architecture tag. Issue: #17701
This commit is contained in:
@@ -138,6 +138,9 @@ Properties
|
|||||||
Modules
|
Modules
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
* The :module:`FindBoost` module gained a ``Boost_ARCHITECTURE`` option
|
||||||
|
to specify a Boost architecture-specific library filename fragment.
|
||||||
|
|
||||||
* The :module:`FindCURL` module learned to find debug and release variants
|
* The :module:`FindCURL` module learned to find debug and release variants
|
||||||
separately.
|
separately.
|
||||||
|
|
||||||
|
|||||||
@@ -147,6 +147,9 @@
|
|||||||
# used if multiple compatible suffixes should
|
# used if multiple compatible suffixes should
|
||||||
# be tested for, in decreasing order of
|
# be tested for, in decreasing order of
|
||||||
# preference.
|
# preference.
|
||||||
|
# Boost_ARCHITECTURE - Set to the architecture-specific library suffix
|
||||||
|
# (e.g. "-x64"). Default is auto-computed for the
|
||||||
|
# C++ compiler in use.
|
||||||
# Boost_THREADAPI - Suffix for "thread" component library name,
|
# Boost_THREADAPI - Suffix for "thread" component library name,
|
||||||
# such as "pthread" or "win32". Names with
|
# such as "pthread" or "win32". Names with
|
||||||
# and without this suffix will both be tried.
|
# and without this suffix will both be tried.
|
||||||
@@ -1499,27 +1502,35 @@ endif()
|
|||||||
# -x86 Architecture and address model tag
|
# -x86 Architecture and address model tag
|
||||||
# First character is the architecture, then word-size, either 32 or 64
|
# First character is the architecture, then word-size, either 32 or 64
|
||||||
# Only used in 'versioned' layout, added in Boost 1.66.0
|
# Only used in 'versioned' layout, added in Boost 1.66.0
|
||||||
set(_boost_ARCHITECTURE_TAG "")
|
if(DEFINED Boost_ARCHITECTURE)
|
||||||
# {CMAKE_CXX_COMPILER_ARCHITECTURE_ID} is not currently set for all compilers
|
set(_boost_ARCHITECTURE_TAG "${Boost_ARCHITECTURE}")
|
||||||
if(NOT "x${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "x" AND NOT Boost_VERSION VERSION_LESS 106600)
|
if(Boost_DEBUG)
|
||||||
string(APPEND _boost_ARCHITECTURE_TAG "-")
|
message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
|
||||||
# This needs to be kept in-sync with the section of CMakePlatformId.h.in
|
"using user-specified Boost_ARCHITECTURE = ${_boost_ARCHITECTURE_TAG}")
|
||||||
# inside 'defined(_WIN32) && defined(_MSC_VER)'
|
|
||||||
if(CMAKE_CXX_COMPILER_ARCHITECTURE_ID STREQUAL "IA64")
|
|
||||||
string(APPEND _boost_ARCHITECTURE_TAG "i")
|
|
||||||
elseif(CMAKE_CXX_COMPILER_ARCHITECTURE_ID STREQUAL "X86"
|
|
||||||
OR CMAKE_CXX_COMPILER_ARCHITECTURE_ID STREQUAL "x64")
|
|
||||||
string(APPEND _boost_ARCHITECTURE_TAG "x")
|
|
||||||
elseif(CMAKE_CXX_COMPILER_ARCHITECTURE_ID MATCHES "^ARM")
|
|
||||||
string(APPEND _boost_ARCHITECTURE_TAG "a")
|
|
||||||
elseif(CMAKE_CXX_COMPILER_ARCHITECTURE_ID STREQUAL "MIPS")
|
|
||||||
string(APPEND _boost_ARCHITECTURE_TAG "m")
|
|
||||||
endif()
|
endif()
|
||||||
|
else()
|
||||||
|
set(_boost_ARCHITECTURE_TAG "")
|
||||||
|
# {CMAKE_CXX_COMPILER_ARCHITECTURE_ID} is not currently set for all compilers
|
||||||
|
if(NOT "x${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "x" AND NOT Boost_VERSION VERSION_LESS 106600)
|
||||||
|
string(APPEND _boost_ARCHITECTURE_TAG "-")
|
||||||
|
# This needs to be kept in-sync with the section of CMakePlatformId.h.in
|
||||||
|
# inside 'defined(_WIN32) && defined(_MSC_VER)'
|
||||||
|
if(CMAKE_CXX_COMPILER_ARCHITECTURE_ID STREQUAL "IA64")
|
||||||
|
string(APPEND _boost_ARCHITECTURE_TAG "i")
|
||||||
|
elseif(CMAKE_CXX_COMPILER_ARCHITECTURE_ID STREQUAL "X86"
|
||||||
|
OR CMAKE_CXX_COMPILER_ARCHITECTURE_ID STREQUAL "x64")
|
||||||
|
string(APPEND _boost_ARCHITECTURE_TAG "x")
|
||||||
|
elseif(CMAKE_CXX_COMPILER_ARCHITECTURE_ID MATCHES "^ARM")
|
||||||
|
string(APPEND _boost_ARCHITECTURE_TAG "a")
|
||||||
|
elseif(CMAKE_CXX_COMPILER_ARCHITECTURE_ID STREQUAL "MIPS")
|
||||||
|
string(APPEND _boost_ARCHITECTURE_TAG "m")
|
||||||
|
endif()
|
||||||
|
|
||||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||||
string(APPEND _boost_ARCHITECTURE_TAG "64")
|
string(APPEND _boost_ARCHITECTURE_TAG "64")
|
||||||
else()
|
else()
|
||||||
string(APPEND _boost_ARCHITECTURE_TAG "32")
|
string(APPEND _boost_ARCHITECTURE_TAG "32")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user