From 6cb6a61aaf5ef2c143f974e9f731778bcd3f5cbe Mon Sep 17 00:00:00 2001 From: Tsukasa Sugiura Date: Wed, 20 Dec 2017 09:18:13 +0900 Subject: [PATCH] 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 --- scripts/buildsystems/vcpkg.cmake | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/scripts/buildsystems/vcpkg.cmake b/scripts/buildsystems/vcpkg.cmake index 71cf4e9b3..b8d3fbdbb 100644 --- a/scripts/buildsystems/vcpkg.cmake +++ b/scripts/buildsystems/vcpkg.cmake @@ -31,9 +31,9 @@ else() set(_VCPKG_TARGET_TRIPLET_ARCH x86) elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 15 2017 Win64$") 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) - elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 15 2017") + elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 15 2017$") set(_VCPKG_TARGET_TRIPLET_ARCH x86) else() find_program(_VCPKG_CL cl) @@ -165,11 +165,22 @@ endfunction() macro(find_package name) 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_MULTITHREADED) unset(Boost_USE_STATIC_RUNTIME) set(Boost_COMPILER "-vc140") _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") function(_vcpkg_find_in_list) list(FIND ARGV "COMPONENTS" COMPONENTS_IDX)