Commit 21f53ec9 authored by A. Joël Lamotte (Klaim)'s avatar A. Joël Lamotte (Klaim)
Browse files

FindBoost: Upgrade to Boost 1.66.0 and allow new library files names layout.

Boost default file name layout at least on Windows will now contain
the architecture bits (32 or 64) to help tools chose the right version
instead of having a random default that forces the user to specify
Boost_LIBRARYDIR if the default doesn't match their need (after
they got a link-time error, far too late, instead of a build time error,
as in this patch by default).

This patch will manage the new file name layout in addition to the previous
ones. It will also make FindBoost look for the version of the libraries
that match the architecture associated with the chosen generator.
This will mainly impact Windows users by allowing them to
not have to build for each arch separately and have to specify
Boost_LIBRARYDIR. Instead they can now just build all in the same
directory and FindBoost will link with the right libraries.

Fixes #17575
parent 77f6fdfc
......@@ -924,8 +924,8 @@ endfunction()
# `${Boost_ROOT}/libs/fiber/build/Jamfile.v2`.
#
function(_Boost_COMPILER_FEATURES component _ret)
# Boost >= 1.62 and < 1.65
if(NOT Boost_VERSION VERSION_LESS 106200 AND Boost_VERSION VERSION_LESS 106500)
# Boost >= 1.62 and < 1.66
if(NOT Boost_VERSION VERSION_LESS 106200 AND Boost_VERSION VERSION_LESS 106600)
set(_Boost_FIBER_COMPILER_FEATURES
cxx_alias_templates
cxx_auto_type
......@@ -944,6 +944,13 @@ function(_Boost_COMPILER_FEATURES component _ret)
set(${_ret} ${_Boost_${uppercomponent}_COMPILER_FEATURES} PARENT_SCOPE)
endfunction()
# Architecture name will be useful for finding library names starting 1.66.0
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(_arch_suffix 64)
else()
set(_arch_suffix 32)
endif()
#
# Update library search directory hint variable with paths used by prebuilt boost binaries.
#
......@@ -954,11 +961,7 @@ endfunction()
#
function(_Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS componentlibvar basedir)
if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC")
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(_arch_suffix 64)
else()
set(_arch_suffix 32)
endif()
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.10)
list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-14.1)
list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-14.0)
......@@ -1031,7 +1034,7 @@ else()
# _Boost_COMPONENT_HEADERS. See the instructions at the top of
# _Boost_COMPONENT_DEPENDENCIES.
set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS}
"1.65.1" "1.65.0" "1.65"
"1.65.1" "1.65.0" "1.65" "1.66.1" "1.66.0" "1.66"
"1.64.0" "1.64" "1.63.0" "1.63" "1.62.0" "1.62" "1.61.0" "1.61" "1.60.0" "1.60"
"1.59.0" "1.59" "1.58.0" "1.58" "1.57.0" "1.57" "1.56.0" "1.56" "1.55.0" "1.55"
"1.54.0" "1.54" "1.53.0" "1.53" "1.52.0" "1.52" "1.51.0" "1.51"
......@@ -1609,10 +1612,12 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS})
unset(_boost_RELEASE_NAMES)
foreach(compiler IN LISTS _boost_COMPILER)
list(APPEND _boost_RELEASE_NAMES
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-x${_arch_suffix}-${Boost_LIB_VERSION}
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION}
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG} )
endforeach()
list(APPEND _boost_RELEASE_NAMES
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-x${_arch_suffix}-${Boost_LIB_VERSION}
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION}
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT} )
......@@ -1620,10 +1625,12 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS})
set(_boost_RELEASE_STATIC_ABI_TAG "-s${_boost_RELEASE_ABI_TAG}")
foreach(compiler IN LISTS _boost_COMPILER)
list(APPEND _boost_RELEASE_NAMES
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-x${_arch_suffix}-${Boost_LIB_VERSION}
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} )
endforeach()
list(APPEND _boost_RELEASE_NAMES
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-x${_arch_suffix}-${Boost_LIB_VERSION}
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} )
endif()
......@@ -1659,10 +1666,12 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS})
unset(_boost_DEBUG_NAMES)
foreach(compiler IN LISTS _boost_COMPILER)
list(APPEND _boost_DEBUG_NAMES
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-x${_arch_suffix}-${Boost_LIB_VERSION}
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION}
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG} )
endforeach()
list(APPEND _boost_DEBUG_NAMES
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-x${_arch_suffix}-${Boost_LIB_VERSION}
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION}
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}
......@@ -1671,10 +1680,12 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS})
set(_boost_DEBUG_STATIC_ABI_TAG "-s${_boost_DEBUG_ABI_TAG}")
foreach(compiler IN LISTS _boost_COMPILER)
list(APPEND _boost_DEBUG_NAMES
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-x${_arch_suffix}-${Boost_LIB_VERSION}
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} )
endforeach()
list(APPEND _boost_DEBUG_NAMES
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-x${_arch_suffix}-${Boost_LIB_VERSION}
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} )
endif()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment