[vcpkg-cmake-toolchain] Only wrap find_package(Boost) if a boost library is installed.

This commit is contained in:
Robert Schumacher 2018-03-14 05:08:35 -07:00
parent 90c4b8dbb7
commit c5f93055a0

View File

@ -190,23 +190,13 @@ macro(find_package name)
if(EXISTS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/share/${_vcpkg_lowercase_name}/vcpkg-cmake-wrapper.cmake")
set(ARGS "${ARGV}")
include(${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/share/${_vcpkg_lowercase_name}/vcpkg-cmake-wrapper.cmake)
elseif("${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})
elseif("${name}" STREQUAL "Boost" AND EXISTS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include/boost")
# Checking for the boost headers disables this wrapper unless the user has installed at least one boost library
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)