Provide patch for FindBoost and apply it

This commit is contained in:
Mike Ellery
2018-12-12 13:39:48 -08:00
committed by Nik Bougalis
parent 9695fd44ba
commit 3fb13233a9
3 changed files with 130 additions and 4 deletions

View File

@@ -466,10 +466,32 @@ function(_Boost_GUESS_COMPILER_PREFIX _ret)
elseif (GHSMULTI)
set(_boost_COMPILER "-ghs")
elseif("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC")
if(MSVC_TOOLSET_VERSION GREATER_EQUAL 141)
#[========================================================[
NOTE: newer versions of FindBoost from kitware
change this version check to use MSVC_TOOLSET_VERSION.
That variable only exists in make 3.12 or greater, so
until all envs (including bundled visual studio) have
this min version of cmake, stick with this
CMAKE_CXX_COMPILER_VERSION check
#]========================================================]
if(DEFINED MSVC_TOOLSET_VERSION AND MSVC_TOOLSET_VERSION GREATER_EQUAL 141)
set(_boost_COMPILER "-vc141;-vc140")
elseif(MSVC_TOOLSET_VERSION GREATER_EQUAL 80)
elseif(DEFINED MSVC_TOOLSET_VERSION AND MSVC_TOOLSET_VERSION GREATER_EQUAL 80)
set(_boost_COMPILER "-vc${MSVC_TOOLSET_VERSION}")
elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.10)
set(_boost_COMPILER "-vc141;-vc140")
elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19)
set(_boost_COMPILER "-vc140")
elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18)
set(_boost_COMPILER "-vc120")
elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 17)
set(_boost_COMPILER "-vc110")
elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16)
set(_boost_COMPILER "-vc100")
elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15)
set(_boost_COMPILER "-vc90")
elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 14)
set(_boost_COMPILER "-vc80")
elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13.10)
set(_boost_COMPILER "-vc71")
elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13) # Good luck!
@@ -1063,12 +1085,27 @@ function(_Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS component
else()
set(_arch_suffix 32)
endif()
if(MSVC_TOOLSET_VERSION GREATER_EQUAL 141)
if(DEFINED MSVC_TOOLSET_VERSION AND MSVC_TOOLSET_VERSION GREATER_EQUAL 141)
list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-14.1)
list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-14.0)
elseif(MSVC_TOOLSET_VERSION GREATER_EQUAL 80)
elseif(DEFINED MSVC_TOOLSET_VERSION AND MSVC_TOOLSET_VERSION GREATER_EQUAL 80)
math(EXPR _toolset_major_version "${MSVC_TOOLSET_VERSION} / 10")
list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-${_toolset_major_version}.0)
elseif(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)
elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19)
list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-14.0)
elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18)
list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-12.0)
elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 17)
list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-11.0)
elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16)
list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-10.0)
elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15)
list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-9.0)
elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 14)
list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-8.0)
endif()
set(${componentlibvar} ${${componentlibvar}} PARENT_SCOPE)
endif()

View File

@@ -0,0 +1,67 @@
--- FindBoost.cmake 2018-12-12 11:15:12.000000000 -0800
+++ FindBoost_patched.cmake 2018-12-12 11:53:19.000000000 -0800
@@ -458,10 +458,32 @@
elseif (GHSMULTI)
set(_boost_COMPILER "-ghs")
elseif("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC")
- if(MSVC_TOOLSET_VERSION GREATER_EQUAL 141)
+ #[========================================================[
+ NOTE: newer versions of FindBoost from kitware
+ change this version check to use MSVC_TOOLSET_VERSION.
+ That variable only exists in make 3.12 or greater, so
+ until all envs (including bundled visual studio) have
+ this min version of cmake, stick with this
+ CMAKE_CXX_COMPILER_VERSION check
+ #]========================================================]
+ if(DEFINED MSVC_TOOLSET_VERSION AND MSVC_TOOLSET_VERSION GREATER_EQUAL 141)
set(_boost_COMPILER "-vc141;-vc140")
- elseif(MSVC_TOOLSET_VERSION GREATER_EQUAL 80)
+ elseif(DEFINED MSVC_TOOLSET_VERSION AND MSVC_TOOLSET_VERSION GREATER_EQUAL 80)
set(_boost_COMPILER "-vc${MSVC_TOOLSET_VERSION}")
+ elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.10)
+ set(_boost_COMPILER "-vc141;-vc140")
+ elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19)
+ set(_boost_COMPILER "-vc140")
+ elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18)
+ set(_boost_COMPILER "-vc120")
+ elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 17)
+ set(_boost_COMPILER "-vc110")
+ elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16)
+ set(_boost_COMPILER "-vc100")
+ elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15)
+ set(_boost_COMPILER "-vc90")
+ elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 14)
+ set(_boost_COMPILER "-vc80")
elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13.10)
set(_boost_COMPILER "-vc71")
elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13) # Good luck!
@@ -1018,12 +1040,27 @@
else()
set(_arch_suffix 32)
endif()
- if(MSVC_TOOLSET_VERSION GREATER_EQUAL 141)
+ if(DEFINED MSVC_TOOLSET_VERSION AND MSVC_TOOLSET_VERSION GREATER_EQUAL 141)
list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-14.1)
list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-14.0)
- elseif(MSVC_TOOLSET_VERSION GREATER_EQUAL 80)
+ elseif(DEFINED MSVC_TOOLSET_VERSION AND MSVC_TOOLSET_VERSION GREATER_EQUAL 80)
math(EXPR _toolset_major_version "${MSVC_TOOLSET_VERSION} / 10")
list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-${_toolset_major_version}.0)
+ elseif(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)
+ elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19)
+ list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-14.0)
+ elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18)
+ list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-12.0)
+ elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 17)
+ list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-11.0)
+ elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16)
+ list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-10.0)
+ elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15)
+ list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-9.0)
+ elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 14)
+ list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-8.0)
endif()
set(${componentlibvar} ${${componentlibvar}} PARENT_SCOPE)
endif()

22
Builds/CMake/README.md Normal file
View File

@@ -0,0 +1,22 @@
These are modules and sources that support our CMake build.
== FindBoost.cmake ==
In order to facilitate updating to latest releases of boost, we've made a local
copy of this cmake module in our repo. The latest official version can
generally be obtained
[here](https://github.com/Kitware/CMake/blob/master/Modules/FindBoost.cmake).
The latest version provided by Kitware can be tailored for use with the
version of CMake that it ships with (typically the next upcoming CMake
release). Our local version, however, cannot necessarily assume a
specific version of CMake and might need to accommodate older versions,
depending on the min version we support for our project. As such, we need to
patch the stock FindBoost module. There is currently one patch file provided
here to accommodate CMake versions prior to 3.12 on windows. When updating to a
newer FindBoost, apply this patch via `patch < FindBoost.patch` after
downloading the latest `FindBoost.cmake` file. If the patch does not apply,
it's possible the applicable section of the original has changed: more
investigation will be required to resolve such a situation. Any backup files
created by `patch` can be deleted if/when the patch applies cleanly.