diff --git a/Builds/CMake/FindBoost.cmake b/Builds/CMake/FindBoost.cmake index ce307fad7f..c02977fbd6 100644 --- a/Builds/CMake/FindBoost.cmake +++ b/Builds/CMake/FindBoost.cmake @@ -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() diff --git a/Builds/CMake/FindBoost.patch b/Builds/CMake/FindBoost.patch new file mode 100644 index 0000000000..34ce952c08 --- /dev/null +++ b/Builds/CMake/FindBoost.patch @@ -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() diff --git a/Builds/CMake/README.md b/Builds/CMake/README.md new file mode 100644 index 0000000000..7c3384f48f --- /dev/null +++ b/Builds/CMake/README.md @@ -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.