Fix find Boost when can not be found Boost that installed with Vcpkg (#2395)

* Fix find Boost when can not be found Boost that installed with Vcpkg

Fix find Boost when can not be found Boost that installed with Vcpkg.
Re-find package Boost uisng user specified options.

* Fix regex of generators

Fix regex of generators.
Add ending position.

* Fix Save and Resore Boost_COMPILER

* [vcpkg-cmake-integration] Expand saved boost variables
This commit is contained in:
Tsukasa Sugiura 2017-12-20 09:18:13 +09:00 committed by Robert Schumacher
parent 7e1a737ba4
commit 6cb6a61aaf

View File

@ -31,9 +31,9 @@ else()
set(_VCPKG_TARGET_TRIPLET_ARCH x86) set(_VCPKG_TARGET_TRIPLET_ARCH x86)
elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 15 2017 Win64$") elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 15 2017 Win64$")
set(_VCPKG_TARGET_TRIPLET_ARCH x64) set(_VCPKG_TARGET_TRIPLET_ARCH x64)
elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 15 2017 ARM") elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 15 2017 ARM$")
set(_VCPKG_TARGET_TRIPLET_ARCH arm) set(_VCPKG_TARGET_TRIPLET_ARCH arm)
elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 15 2017") elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 15 2017$")
set(_VCPKG_TARGET_TRIPLET_ARCH x86) set(_VCPKG_TARGET_TRIPLET_ARCH x86)
else() else()
find_program(_VCPKG_CL cl) find_program(_VCPKG_CL cl)
@ -165,11 +165,22 @@ endfunction()
macro(find_package name) macro(find_package name)
if("${name}" STREQUAL "Boost") if("${name}" STREQUAL "Boost")
set(_Boost_USE_STATIC_LIBS ${Boost_USE_STATIC_LIBS})
set(_Boost_USE_MULTITHREADED ${Boost_USE_MULTITHREADED})
set(_Boost_USE_STATIC_RUNTIME ${Boost_USE_STATIC_RUNTIME})
set(_Boost_COMPILER ${Boost_COMPILER})
unset(Boost_USE_STATIC_LIBS) unset(Boost_USE_STATIC_LIBS)
unset(Boost_USE_MULTITHREADED) unset(Boost_USE_MULTITHREADED)
unset(Boost_USE_STATIC_RUNTIME) unset(Boost_USE_STATIC_RUNTIME)
set(Boost_COMPILER "-vc140") set(Boost_COMPILER "-vc140")
_find_package(${ARGV}) _find_package(${ARGV})
if(NOT Boost_FOUND)
set(Boost_USE_STATIC_LIBS ${_Boost_USE_STATIC_LIBS})
set(Boost_USE_MULTITHREADED ${_Boost_USE_MULTITHREADED})
set(Boost_USE_STATIC_RUNTIME ${_Boost_USE_STATIC_RUNTIME})
set(Boost_COMPILER ${_Boost_COMPILER})
_find_package(${ARGV})
endif()
elseif("${name}" STREQUAL "ICU") elseif("${name}" STREQUAL "ICU")
function(_vcpkg_find_in_list) function(_vcpkg_find_in_list)
list(FIND ARGV "COMPONENTS" COMPONENTS_IDX) list(FIND ARGV "COMPONENTS" COMPONENTS_IDX)