|
8 | 8 | # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the |
9 | 9 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
10 | 10 |
|
| 11 | +set(BOOST_SEARCH_HINTS) |
11 | 12 | if(WIN32) |
12 | 13 | if(DEFINED ENV{BOOST_ROOT}) |
13 | 14 | set(BOOST_ROOT $ENV{BOOST_ROOT}) |
14 | 15 | endif() |
| 16 | + if(DEFINED BOOST_ROOT AND MSVC) |
| 17 | + # insert a dot (.) character before last digit of MSVC_TOOLSET_VERSION |
| 18 | + # turn 143 into 14.3 |
| 19 | + string(LENGTH "${MSVC_TOOLSET_VERSION}" _BOOST_MSVC_TOOLSET_VERSION_LENGTH) |
| 20 | + math(EXPR _BOOST_MSVC_TOOLSET_VERSION_LENGTH "${_BOOST_MSVC_TOOLSET_VERSION_LENGTH} - 1" OUTPUT_FORMAT DECIMAL) |
| 21 | + string(SUBSTRING "${MSVC_TOOLSET_VERSION}" 0 ${_BOOST_MSVC_TOOLSET_VERSION_LENGTH} _BOOST_MSVC_TOOLSET_VERSION_MAJOR) |
| 22 | + string(SUBSTRING "${MSVC_TOOLSET_VERSION}" ${_BOOST_MSVC_TOOLSET_VERSION_LENGTH} -1 _BOOST_MSVC_TOOLSET_VERSION_MINOR) |
| 23 | + |
| 24 | + set(BOOST_SEARCH_HINTS "${BOOST_ROOT}/lib${PLATFORM}-msvc-${_BOOST_MSVC_TOOLSET_VERSION_MAJOR}.${_BOOST_MSVC_TOOLSET_VERSION_MINOR}/cmake") |
| 25 | + |
| 26 | + unset(_BOOST_MSVC_TOOLSET_VERSION_LENGTH) |
| 27 | + unset(_BOOST_MSVC_TOOLSET_VERSION_MAJOR) |
| 28 | + unset(_BOOST_MSVC_TOOLSET_VERSION_MINOR) |
| 29 | + endif() |
15 | 30 |
|
16 | 31 | set(Boost_USE_STATIC_LIBS ON) |
17 | 32 | set(Boost_USE_MULTITHREADED ON) |
18 | 33 | set(Boost_USE_STATIC_RUNTIME OFF) |
19 | 34 | endif() |
20 | 35 |
|
21 | | -set(Boost_NO_WARN_NEW_VERSIONS ON) |
22 | | - |
23 | 36 | if (WIN32) |
24 | 37 | # On windows the requirements are higher according to the wiki. |
25 | 38 | set(BOOST_REQUIRED_VERSION 1.78) |
26 | 39 | else() |
27 | 40 | set(BOOST_REQUIRED_VERSION 1.74) |
28 | 41 | endif() |
29 | 42 |
|
30 | | -find_package(Boost ${BOOST_REQUIRED_VERSION} REQUIRED system filesystem program_options iostreams regex locale) |
| 43 | +find_package(Boost ${BOOST_REQUIRED_VERSION} |
| 44 | + REQUIRED |
| 45 | + COMPONENTS |
| 46 | + system |
| 47 | + filesystem |
| 48 | + program_options |
| 49 | + iostreams |
| 50 | + regex |
| 51 | + locale |
| 52 | + CONFIG |
| 53 | + HINTS |
| 54 | + ${BOOST_SEARCH_HINTS}) |
31 | 55 |
|
32 | 56 | if(NOT Boost_FOUND) |
33 | 57 | if(NOT DEFINED ENV{BOOST_ROOT} AND NOT DEFINED Boost_DIR AND NOT DEFINED BOOST_ROOT AND NOT DEFINED BOOSTROOT) |
|
0 commit comments