summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorAlex Turbov <i.zaufi@gmail.com>2016-06-03 06:32:10 (GMT)
committerBrad King <brad.king@kitware.com>2016-06-03 15:15:02 (GMT)
commitc3a281fd327cce529ca3507f00a62608b26627ee (patch)
treef2251ef516972bf8ba73fe49e02dadadac1ad015 /Modules
parent3720d5f4a3c6edfdb1533ac60c9ade0adee92e09 (diff)
downloadCMake-c3a281fd327cce529ca3507f00a62608b26627ee.zip
CMake-c3a281fd327cce529ca3507f00a62608b26627ee.tar.gz
CMake-c3a281fd327cce529ca3507f00a62608b26627ee.tar.bz2
FindBoost: Search in official Windows prebuilt binary library directory
Avoid the need to specify `BOOST_LIBRARYDIR` along with `BOOST_ROOT` when using prebuilt binaries such as these: https://sourceforge.net/projects/boost/files/boost-binaries/
Diffstat (limited to 'Modules')
-rw-r--r--Modules/FindBoost.cmake34
1 files changed, 34 insertions, 0 deletions
diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
index 25840b3..6bf6401 100644
--- a/Modules/FindBoost.cmake
+++ b/Modules/FindBoost.cmake
@@ -209,6 +209,7 @@
# Copyright 2007 Mike Jackson
# Copyright 2008 Andreas Pakulat <apaku@gmx.de>
# Copyright 2008-2012 Philip Lowman <philip@yhbt.com>
+# Copyright 2016 Alex Turbov <i.zaufi@gmail.com>
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@@ -864,6 +865,37 @@ function(_Boost_MISSING_DEPENDENCIES componentvar extravar)
endfunction()
#
+# Update library search directory hint variable with paths used by prebuilt boost binaries.
+#
+# Prebuilt windows binaries (https://sourceforge.net/projects/boost/files/boost-binaries/)
+# have library directories named using MSVC compiler version and architecture.
+# This function would append corresponding directories if MSVC is a current compiler,
+# so having `BOOST_ROOT` would be enough to specify to find everything.
+#
+macro(_Boost_UPDATE_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)
+ 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()
+ endif()
+endmacro()
+
+#
# End functions/macros
#
#-------------------------------------------------------------------------------
@@ -1322,8 +1354,10 @@ foreach(c DEBUG RELEASE)
if(BOOST_ROOT)
list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${BOOST_ROOT}/lib ${BOOST_ROOT}/stage/lib)
+ _Boost_UPDATE_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS(_boost_LIBRARY_SEARCH_DIRS_${c} BOOST_ROOT)
elseif(_ENV_BOOST_ROOT)
list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${_ENV_BOOST_ROOT}/lib ${_ENV_BOOST_ROOT}/stage/lib)
+ _Boost_UPDATE_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS(_boost_LIBRARY_SEARCH_DIRS_${c} _ENV_BOOST_ROOT)
endif()
list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c}