2017-05-28 13:07:20 -07:00
# Mark variables as used so cmake doesn't complain about them
2017-10-16 11:22:21 -07:00
mark_as_advanced ( CMAKE_TOOLCHAIN_FILE )
2020-01-10 00:26:27 +01:00
# VCPKG toolchain options.
option ( VCPKG_VERBOSE "Enables messages from the VCPKG toolchain for debugging purposes." OFF )
mark_as_advanced ( VCPKG_VERBOSE )
2019-09-23 13:43:52 -07:00
# Determine whether the toolchain is loaded during a try-compile configuration
get_property ( _CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE )
if ( ${ CMAKE_VERSION } VERSION_LESS "3.6.0" )
set ( _CMAKE_EMULATE_TRY_COMPILE_PLATFORM_VARIABLES ON )
else ( )
set ( _CMAKE_EMULATE_TRY_COMPILE_PLATFORM_VARIABLES OFF )
endif ( )
if ( _CMAKE_IN_TRY_COMPILE AND _CMAKE_EMULATE_TRY_COMPILE_PLATFORM_VARIABLES )
include ( "${CMAKE_CURRENT_SOURCE_DIR}/../vcpkg.config.cmake" OPTIONAL )
2017-11-25 11:49:15 -08:00
endif ( )
2017-10-16 11:22:21 -07:00
if ( VCPKG_CHAINLOAD_TOOLCHAIN_FILE )
include ( "${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}" )
endif ( )
if ( VCPKG_TOOLCHAIN )
return ( )
endif ( )
2020-01-10 00:26:27 +01:00
if ( DEFINED CMAKE_CONFIGURATION_TYPES ) #Generating with a multi config generator
#If CMake does not have a mapping for MinSizeRel and RelWithDebInfo in imported targets
#it will map those configuration to the first valid configuration in CMAKE_CONFIGURATION_TYPES.
#By default this is the debug configuration which is wrong.
if ( NOT DEFINED CMAKE_MAP_IMPORTED_CONFIG_MINSIZEREL )
set ( CMAKE_MAP_IMPORTED_CONFIG_MINSIZEREL "MinSizeRel;Release;" )
if ( VCPKG_VERBOSE )
message ( STATUS "VCPKG-Info: CMAKE_MAP_IMPORTED_CONFIG_MINSIZEREL set to MinSizeRel;Release;" )
endif ( )
endif ( )
if ( NOT DEFINED CMAKE_MAP_IMPORTED_CONFIG_RELWITHDEBINFO )
set ( CMAKE_MAP_IMPORTED_CONFIG_RELWITHDEBINFO "RelWithDebInfo;Release;" )
if ( VCPKG_VERBOSE )
message ( STATUS "VCPKG-Info: CMAKE_MAP_IMPORTED_CONFIG_RELWITHDEBINFO set to RelWithDebInfo;Release;" )
endif ( )
endif ( )
endif ( )
2017-10-16 11:22:21 -07:00
if ( VCPKG_TARGET_TRIPLET )
elseif ( CMAKE_GENERATOR_PLATFORM MATCHES "^[Ww][Ii][Nn]32$" )
set ( _VCPKG_TARGET_TRIPLET_ARCH x86 )
elseif ( CMAKE_GENERATOR_PLATFORM MATCHES "^[Xx]64$" )
set ( _VCPKG_TARGET_TRIPLET_ARCH x64 )
elseif ( CMAKE_GENERATOR_PLATFORM MATCHES "^[Aa][Rr][Mm]$" )
set ( _VCPKG_TARGET_TRIPLET_ARCH arm )
2018-01-04 00:19:52 +01:00
elseif ( CMAKE_GENERATOR_PLATFORM MATCHES "^[Aa][Rr][Mm]64$" )
set ( _VCPKG_TARGET_TRIPLET_ARCH arm64 )
2017-10-16 11:22:21 -07:00
else ( )
if ( CMAKE_GENERATOR MATCHES "^Visual Studio 14 2015 Win64$" )
set ( _VCPKG_TARGET_TRIPLET_ARCH x64 )
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 14 2015 ARM$" )
set ( _VCPKG_TARGET_TRIPLET_ARCH arm )
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 14 2015$" )
2016-09-18 20:50:08 -07:00
set ( _VCPKG_TARGET_TRIPLET_ARCH x86 )
2017-10-16 11:22:21 -07:00
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 15 2017 Win64$" )
2016-09-18 20:50:08 -07:00
set ( _VCPKG_TARGET_TRIPLET_ARCH x64 )
2017-12-20 09:18:13 +09:00
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 15 2017 ARM$" )
2016-09-18 20:50:08 -07:00
set ( _VCPKG_TARGET_TRIPLET_ARCH arm )
2017-12-20 09:18:13 +09:00
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 15 2017$" )
2017-10-16 11:22:21 -07:00
set ( _VCPKG_TARGET_TRIPLET_ARCH x86 )
2019-04-11 23:03:35 -07:00
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 16 2019$" )
2020-01-24 21:26:35 +01:00
set ( _VCPKG_TARGET_TRIPLET_ARCH x64 )
2016-09-18 20:50:08 -07:00
else ( )
2017-10-16 11:22:21 -07:00
find_program ( _VCPKG_CL cl )
if ( _VCPKG_CL MATCHES "amd64/cl.exe$" OR _VCPKG_CL MATCHES "x64/cl.exe$" )
2016-09-18 20:50:08 -07:00
set ( _VCPKG_TARGET_TRIPLET_ARCH x64 )
2017-10-16 11:22:21 -07:00
elseif ( _VCPKG_CL MATCHES "arm/cl.exe$" )
2016-09-18 20:50:08 -07:00
set ( _VCPKG_TARGET_TRIPLET_ARCH arm )
2018-01-04 00:19:52 +01:00
elseif ( _VCPKG_CL MATCHES "arm64/cl.exe$" )
2018-03-29 21:14:06 -07:00
set ( _VCPKG_TARGET_TRIPLET_ARCH arm64 )
2017-10-16 11:22:21 -07:00
elseif ( _VCPKG_CL MATCHES "bin/cl.exe$" OR _VCPKG_CL MATCHES "x86/cl.exe$" )
2016-11-19 01:33:31 -05:00
set ( _VCPKG_TARGET_TRIPLET_ARCH x86 )
2017-11-25 15:53:32 -08:00
elseif ( CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64" )
set ( _VCPKG_TARGET_TRIPLET_ARCH x64 )
2016-09-18 20:50:08 -07:00
else ( )
2019-02-06 13:08:57 -08:00
if ( _CMAKE_IN_TRY_COMPILE )
message ( STATUS "Unable to determine target architecture, continuing without vcpkg." )
else ( )
message ( WARNING "Unable to determine target architecture, continuing without vcpkg." )
endif ( )
set ( VCPKG_TOOLCHAIN ON )
return ( )
2016-09-18 20:50:08 -07:00
endif ( )
endif ( )
2017-10-16 11:22:21 -07:00
endif ( )
2016-09-18 20:50:08 -07:00
2017-10-16 11:22:21 -07:00
if ( CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" OR CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone" )
set ( _VCPKG_TARGET_TRIPLET_PLAT uwp )
2018-03-13 05:56:02 -07:00
elseif ( CMAKE_SYSTEM_NAME STREQUAL "Linux" OR ( NOT CMAKE_SYSTEM_NAME AND CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux" ) )
2017-11-25 15:53:32 -08:00
set ( _VCPKG_TARGET_TRIPLET_PLAT linux )
2018-03-13 05:56:02 -07:00
elseif ( CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR ( NOT CMAKE_SYSTEM_NAME AND CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin" ) )
2018-03-02 08:59:17 -08:00
set ( _VCPKG_TARGET_TRIPLET_PLAT osx )
2018-03-13 05:56:02 -07:00
elseif ( CMAKE_SYSTEM_NAME STREQUAL "Windows" OR ( NOT CMAKE_SYSTEM_NAME AND CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows" ) )
2017-10-16 11:22:21 -07:00
set ( _VCPKG_TARGET_TRIPLET_PLAT windows )
2018-03-13 05:56:02 -07:00
elseif ( CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR ( NOT CMAKE_SYSTEM_NAME AND CMAKE_HOST_SYSTEM_NAME STREQUAL "FreeBSD" ) )
set ( _VCPKG_TARGET_TRIPLET_PLAT freebsd )
2017-10-16 11:22:21 -07:00
endif ( )
2016-09-18 20:50:08 -07:00
2017-10-16 11:22:21 -07:00
set ( VCPKG_TARGET_TRIPLET ${ _VCPKG_TARGET_TRIPLET_ARCH } - ${ _VCPKG_TARGET_TRIPLET_PLAT } CACHE STRING "Vcpkg target triplet (ex. x86-windows)" )
set ( _VCPKG_TOOLCHAIN_DIR ${ CMAKE_CURRENT_LIST_DIR } )
2017-04-20 16:19:39 -07:00
2017-12-08 22:03:03 -08:00
if ( NOT DEFINED _VCPKG_ROOT_DIR )
# Detect .vcpkg-root to figure VCPKG_ROOT_DIR
set ( _VCPKG_ROOT_DIR_CANDIDATE ${ CMAKE_CURRENT_LIST_DIR } )
while ( IS_DIRECTORY ${ _VCPKG_ROOT_DIR_CANDIDATE } AND NOT EXISTS "${_VCPKG_ROOT_DIR_CANDIDATE}/.vcpkg-root" )
get_filename_component ( _VCPKG_ROOT_DIR_TEMP ${ _VCPKG_ROOT_DIR_CANDIDATE } DIRECTORY )
if ( _VCPKG_ROOT_DIR_TEMP STREQUAL _VCPKG_ROOT_DIR_CANDIDATE ) # If unchanged, we have reached the root of the drive
message ( FATAL_ERROR "Could not find .vcpkg-root" )
else ( )
SET ( _VCPKG_ROOT_DIR_CANDIDATE ${ _VCPKG_ROOT_DIR_TEMP } )
endif ( )
endwhile ( )
2017-12-09 17:25:12 -08:00
set ( _VCPKG_ROOT_DIR ${ _VCPKG_ROOT_DIR_CANDIDATE } CACHE INTERNAL "Vcpkg root directory" )
2017-12-08 22:03:03 -08:00
endif ( )
2017-10-16 11:22:21 -07:00
set ( _VCPKG_INSTALLED_DIR ${ _VCPKG_ROOT_DIR } /installed )
2020-02-09 14:40:13 -08:00
if ( NOT EXISTS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" AND NOT _CMAKE_IN_TRY_COMPILE AND NOT VCPKG_SUPPRESS_INSTALLED_LIBRARIES_WARNING )
2018-02-23 16:50:32 -08:00
message ( WARNING "There are no libraries installed for the Vcpkg triplet ${VCPKG_TARGET_TRIPLET}." )
endif ( )
2019-05-25 01:35:40 +02:00
if ( CMAKE_BUILD_TYPE MATCHES "^[Dd][Ee][Bb][Uu][Gg]$" OR NOT DEFINED CMAKE_BUILD_TYPE ) #Debug build: Put Debug paths before Release paths.
2016-09-18 20:50:08 -07:00
list ( APPEND CMAKE_PREFIX_PATH
2019-03-14 22:24:29 +01:00
$ { _ V C P K G _ I N S T A L L E D _ D I R } / $ { V C P K G _ T A R G E T _ T R I P L E T } / d e b u g $ { _ V C P K G _ I N S T A L L E D _ D I R } / $ { V C P K G _ T A R G E T _ T R I P L E T }
2016-09-18 20:50:08 -07:00
)
2016-11-25 23:10:27 -08:00
list ( APPEND CMAKE_LIBRARY_PATH
2019-03-14 22:24:29 +01:00
$ { _ V C P K G _ I N S T A L L E D _ D I R } / $ { V C P K G _ T A R G E T _ T R I P L E T } / d e b u g / l i b / m a n u a l - l i n k $ { _ V C P K G _ I N S T A L L E D _ D I R } / $ { V C P K G _ T A R G E T _ T R I P L E T } / l i b / m a n u a l - l i n k
2016-11-25 23:10:27 -08:00
)
2017-11-25 11:49:15 -08:00
list ( APPEND CMAKE_FIND_ROOT_PATH
2019-03-14 22:24:29 +01:00
$ { _ V C P K G _ I N S T A L L E D _ D I R } / $ { V C P K G _ T A R G E T _ T R I P L E T } / d e b u g $ { _ V C P K G _ I N S T A L L E D _ D I R } / $ { V C P K G _ T A R G E T _ T R I P L E T }
)
else ( ) #Release build: Put Release paths before Debug paths. Debug Paths are required so that CMake generates correct info in autogenerated target files.
list ( APPEND CMAKE_PREFIX_PATH
$ { _ V C P K G _ I N S T A L L E D _ D I R } / $ { V C P K G _ T A R G E T _ T R I P L E T } $ { _ V C P K G _ I N S T A L L E D _ D I R } / $ { V C P K G _ T A R G E T _ T R I P L E T } / d e b u g
)
list ( APPEND CMAKE_LIBRARY_PATH
$ { _ V C P K G _ I N S T A L L E D _ D I R } / $ { V C P K G _ T A R G E T _ T R I P L E T } / l i b / m a n u a l - l i n k $ { _ V C P K G _ I N S T A L L E D _ D I R } / $ { V C P K G _ T A R G E T _ T R I P L E T } / d e b u g / l i b / m a n u a l - l i n k
)
list ( APPEND CMAKE_FIND_ROOT_PATH
$ { _ V C P K G _ I N S T A L L E D _ D I R } / $ { V C P K G _ T A R G E T _ T R I P L E T } $ { _ V C P K G _ I N S T A L L E D _ D I R } / $ { V C P K G _ T A R G E T _ T R I P L E T } / d e b u g
2017-11-25 11:49:15 -08:00
)
2017-10-16 11:22:21 -07:00
endif ( )
2016-09-18 20:50:08 -07:00
2017-10-16 11:22:21 -07:00
file ( TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _programfiles )
2019-05-13 00:11:07 -07:00
set ( _PROGRAMFILESX86 "PROGRAMFILES(x86)" )
file ( TO_CMAKE_PATH "$ENV{${_PROGRAMFILESX86}}" _programfiles_x86 )
2017-10-16 11:22:21 -07:00
set ( CMAKE_SYSTEM_IGNORE_PATH
" $ { _ p r o g r a m f i l e s } / O p e n S S L "
" $ { _ p r o g r a m f i l e s } / O p e n S S L - W i n 3 2 "
" $ { _ p r o g r a m f i l e s } / O p e n S S L - W i n 6 4 "
" $ { _ p r o g r a m f i l e s } / O p e n S S L - W i n 3 2 / l i b / V C "
" $ { _ p r o g r a m f i l e s } / O p e n S S L - W i n 6 4 / l i b / V C "
" $ { _ p r o g r a m f i l e s } / O p e n S S L - W i n 3 2 / l i b / V C / s t a t i c "
" $ { _ p r o g r a m f i l e s } / O p e n S S L - W i n 6 4 / l i b / V C / s t a t i c "
2019-05-13 03:37:02 +02:00
" $ { _ p r o g r a m f i l e s _ x 8 6 } / O p e n S S L "
" $ { _ p r o g r a m f i l e s _ x 8 6 } / O p e n S S L - W i n 3 2 "
" $ { _ p r o g r a m f i l e s _ x 8 6 } / O p e n S S L - W i n 6 4 "
" $ { _ p r o g r a m f i l e s _ x 8 6 } / O p e n S S L - W i n 3 2 / l i b / V C "
" $ { _ p r o g r a m f i l e s _ x 8 6 } / O p e n S S L - W i n 6 4 / l i b / V C "
" $ { _ p r o g r a m f i l e s _ x 8 6 } / O p e n S S L - W i n 3 2 / l i b / V C / s t a t i c "
" $ { _ p r o g r a m f i l e s _ x 8 6 } / O p e n S S L - W i n 6 4 / l i b / V C / s t a t i c "
2017-10-16 11:22:21 -07:00
" C : / O p e n S S L / "
" C : / O p e n S S L - W i n 3 2 / "
" C : / O p e n S S L - W i n 6 4 / "
" C : / O p e n S S L - W i n 3 2 / l i b / V C "
" C : / O p e n S S L - W i n 6 4 / l i b / V C "
" C : / O p e n S S L - W i n 3 2 / l i b / V C / s t a t i c "
" C : / O p e n S S L - W i n 6 4 / l i b / V C / s t a t i c "
)
2017-03-21 01:48:40 -07:00
2017-12-08 22:03:03 -08:00
list ( APPEND CMAKE_PROGRAM_PATH ${ _VCPKG_INSTALLED_DIR } / ${ VCPKG_TARGET_TRIPLET } /tools )
2017-10-16 11:22:21 -07:00
file ( GLOB _VCPKG_TOOLS_DIRS ${ _VCPKG_INSTALLED_DIR } / ${ VCPKG_TARGET_TRIPLET } /tools/* )
foreach ( _VCPKG_TOOLS_DIR ${ _VCPKG_TOOLS_DIRS } )
if ( IS_DIRECTORY ${ _VCPKG_TOOLS_DIR } )
2017-12-08 22:03:03 -08:00
list ( APPEND CMAKE_PROGRAM_PATH ${ _VCPKG_TOOLS_DIR } )
2017-10-16 11:22:21 -07:00
endif ( )
endforeach ( )
2016-11-25 23:10:27 -08:00
2017-10-16 11:22:21 -07:00
option ( VCPKG_APPLOCAL_DEPS "Automatically copy dependencies into the output directory for executables." ON )
function ( add_executable name )
_add_executable ( ${ ARGV } )
list ( FIND ARGV "IMPORTED" IMPORTED_IDX )
list ( FIND ARGV "ALIAS" ALIAS_IDX )
2019-05-19 16:33:16 +10:00
list ( FIND ARGV "MACOSX_BUNDLE" MACOSX_BUNDLE_IDX )
2017-10-16 11:22:21 -07:00
if ( IMPORTED_IDX EQUAL -1 AND ALIAS_IDX EQUAL -1 )
2019-05-31 13:49:13 -07:00
if ( VCPKG_APPLOCAL_DEPS )
2019-05-17 06:24:03 +10:00
if ( _VCPKG_TARGET_TRIPLET_PLAT MATCHES "windows|uwp" )
add_custom_command ( TARGET ${ name } POST_BUILD
C O M M A N D p o w e r s h e l l - n o p r o f i l e - e x e c u t i o n p o l i c y B y p a s s - f i l e $ { _ V C P K G _ T O O L C H A I N _ D I R } / m s b u i l d / a p p l o c a l . p s 1
- t a r g e t B i n a r y $ < T A R G E T _ F I L E : $ { n a m e } >
- i n s t a l l e d D i r " $ { _ V C P K G _ I N S T A L L E D _ D I R } / $ { V C P K G _ T A R G E T _ T R I P L E T } $ < $ < C O N F I G : D e b u g > : / d e b u g > / b i n "
- O u t V a r i a b l e o u t
)
elseif ( _VCPKG_TARGET_TRIPLET_PLAT MATCHES "osx" )
2019-05-19 16:33:16 +10:00
if ( NOT MACOSX_BUNDLE_IDX EQUAL -1 )
2019-05-17 06:24:03 +10:00
add_custom_command ( TARGET ${ name } POST_BUILD
C O M M A N D p y t h o n $ { _ V C P K G _ T O O L C H A I N _ D I R } / o s x / a p p l o c a l . p y
$ < T A R G E T _ F I L E : $ { n a m e } >
" $ { _ V C P K G _ I N S T A L L E D _ D I R } / $ { V C P K G _ T A R G E T _ T R I P L E T } $ < $ < C O N F I G : D e b u g > : / d e b u g > "
)
endif ( )
endif ( )
2017-07-28 11:44:54 -07:00
endif ( )
2017-10-16 11:22:21 -07:00
set_target_properties ( ${ name } PROPERTIES VS_USER_PROPS do_not_import_user.props )
set_target_properties ( ${ name } PROPERTIES VS_GLOBAL_VcpkgEnabled false )
endif ( )
endfunction ( )
2017-07-28 11:44:54 -07:00
2017-10-16 11:22:21 -07:00
function ( add_library name )
_add_library ( ${ ARGV } )
list ( FIND ARGV "IMPORTED" IMPORTED_IDX )
list ( FIND ARGV "INTERFACE" INTERFACE_IDX )
list ( FIND ARGV "ALIAS" ALIAS_IDX )
if ( IMPORTED_IDX EQUAL -1 AND INTERFACE_IDX EQUAL -1 AND ALIAS_IDX EQUAL -1 )
2018-02-13 19:13:27 -05:00
get_target_property ( IS_LIBRARY_SHARED ${ name } TYPE )
2018-03-07 13:17:52 -05:00
if ( VCPKG_APPLOCAL_DEPS AND _VCPKG_TARGET_TRIPLET_PLAT MATCHES "windows|uwp" AND ( IS_LIBRARY_SHARED STREQUAL "SHARED_LIBRARY" OR IS_LIBRARY_SHARED STREQUAL "MODULE_LIBRARY" ) )
2018-02-13 19:13:27 -05:00
add_custom_command ( TARGET ${ name } POST_BUILD
C O M M A N D p o w e r s h e l l - n o p r o f i l e - e x e c u t i o n p o l i c y B y p a s s - f i l e $ { _ V C P K G _ T O O L C H A I N _ D I R } / m s b u i l d / a p p l o c a l . p s 1
- t a r g e t B i n a r y $ < T A R G E T _ F I L E : $ { n a m e } >
- i n s t a l l e d D i r " $ { _ V C P K G _ I N S T A L L E D _ D I R } / $ { V C P K G _ T A R G E T _ T R I P L E T } $ < $ < C O N F I G : D e b u g > : / d e b u g > / b i n "
- O u t V a r i a b l e o u t
)
endif ( )
2017-10-16 11:22:21 -07:00
set_target_properties ( ${ name } PROPERTIES VS_USER_PROPS do_not_import_user.props )
set_target_properties ( ${ name } PROPERTIES VS_GLOBAL_VcpkgEnabled false )
endif ( )
endfunction ( )
2020-02-09 14:40:13 -08:00
if ( NOT DEFINED VCPKG_OVERRIDE_FIND_PACKAGE_NAME )
set ( VCPKG_OVERRIDE_FIND_PACKAGE_NAME find_package )
endif ( )
macro ( ${ VCPKG_OVERRIDE_FIND_PACKAGE_NAME } name )
2018-03-11 23:04:09 -07:00
string ( TOLOWER "${name}" _vcpkg_lowercase_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 )
2018-03-14 05:08:35 -07:00
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
2019-02-28 23:53:42 -08:00
set ( Boost_USE_STATIC_LIBS OFF )
set ( Boost_USE_MULTITHREADED ON )
2017-11-06 04:33:35 +09:00
unset ( Boost_USE_STATIC_RUNTIME )
2019-04-05 04:13:10 +02:00
set ( Boost_NO_BOOST_CMAKE ON )
2019-02-28 23:53:42 -08:00
unset ( Boost_USE_STATIC_RUNTIME CACHE )
2017-12-08 22:03:03 -08:00
set ( Boost_COMPILER "-vc140" )
2017-11-15 21:58:26 -08:00
_find_package ( ${ ARGV } )
2018-04-05 21:39:47 -07:00
elseif ( "${name}" STREQUAL "ICU" AND EXISTS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include/unicode/utf.h" )
2017-11-15 21:58:26 -08:00
function ( _vcpkg_find_in_list )
list ( FIND ARGV "COMPONENTS" COMPONENTS_IDX )
set ( COMPONENTS_IDX ${ COMPONENTS_IDX } PARENT_SCOPE )
endfunction ( )
_vcpkg_find_in_list ( ${ ARGV } )
if ( NOT COMPONENTS_IDX EQUAL -1 )
_find_package ( ${ ARGV } COMPONENTS data )
else ( )
_find_package ( ${ ARGV } )
endif ( )
2018-04-05 21:39:47 -07:00
elseif ( "${name}" STREQUAL "GSL" AND EXISTS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include/gsl" )
2018-03-07 11:56:21 -08:00
_find_package ( ${ ARGV } )
if ( GSL_FOUND AND TARGET GSL::gsl )
set_property ( TARGET GSL::gslcblas APPEND PROPERTY IMPORTED_CONFIGURATIONS Release )
set_property ( TARGET GSL::gsl APPEND PROPERTY IMPORTED_CONFIGURATIONS Release )
if ( EXISTS "${GSL_LIBRARY_DEBUG}" AND EXISTS "${GSL_CBLAS_LIBRARY_DEBUG}" )
set_property ( TARGET GSL::gsl APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug )
set_target_properties ( GSL::gsl PROPERTIES IMPORTED_LOCATION_DEBUG "${GSL_LIBRARY_DEBUG}" )
set_property ( TARGET GSL::gslcblas APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug )
set_target_properties ( GSL::gslcblas PROPERTIES IMPORTED_LOCATION_DEBUG "${GSL_CBLAS_LIBRARY_DEBUG}" )
endif ( )
endif ( )
2018-04-05 21:39:47 -07:00
elseif ( "${name}" STREQUAL "CURL" AND EXISTS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include/curl" )
2018-02-07 17:02:47 -08:00
_find_package ( ${ ARGV } )
if ( CURL_FOUND )
if ( EXISTS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/nghttp2.lib" )
list ( APPEND CURL_LIBRARIES
" d e b u g " " $ { _ V C P K G _ I N S T A L L E D _ D I R } / $ { V C P K G _ T A R G E T _ T R I P L E T } / d e b u g / l i b / n g h t t p 2 . l i b "
" o p t i m i z e d " " $ { _ V C P K G _ I N S T A L L E D _ D I R } / $ { V C P K G _ T A R G E T _ T R I P L E T } / l i b / n g h t t p 2 . l i b " )
endif ( )
endif ( )
2018-04-18 18:13:11 -07:00
elseif ( "${_vcpkg_lowercase_name}" STREQUAL "grpc" AND EXISTS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/share/grpc" )
_find_package ( gRPC ${ ARGN } )
2017-11-15 21:58:26 -08:00
else ( )
_find_package ( ${ ARGV } )
2017-11-15 18:56:44 -08:00
endif ( )
2017-10-16 11:22:21 -07:00
endmacro ( )
2017-06-30 17:33:48 -07:00
2017-10-16 11:22:21 -07:00
set ( VCPKG_TOOLCHAIN ON )
2017-06-30 17:33:48 -07:00
set ( _UNUSED ${ CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION } )
set ( _UNUSED ${ CMAKE_EXPORT_NO_PACKAGE_REGISTRY } )
set ( _UNUSED ${ CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY } )
set ( _UNUSED ${ CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY } )
set ( _UNUSED ${ CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP } )
2017-10-16 11:22:21 -07:00
2019-09-23 13:43:52 -07:00
# Propogate these values to try-compile configurations so the triplet and toolchain load
2017-10-16 11:22:21 -07:00
if ( NOT _CMAKE_IN_TRY_COMPILE )
2019-09-23 13:43:52 -07:00
if ( _CMAKE_EMULATE_TRY_COMPILE_PLATFORM_VARIABLES )
file ( TO_CMAKE_PATH "${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}" _chainload_file )
file ( TO_CMAKE_PATH "${_VCPKG_ROOT_DIR}" _root_dir )
file ( WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/vcpkg.config.cmake"
" set ( VCPKG_TARGET_TRIPLET \"${VCPKG_TARGET_TRIPLET}\" CACHE STRING \"\")\n"
" set ( VCPKG_APPLOCAL_DEPS \"${VCPKG_APPLOCAL_DEPS}\" CACHE STRING \"\")\n"
" set ( VCPKG_CHAINLOAD_TOOLCHAIN_FILE \"${_chainload_file}\" CACHE STRING \"\")\n"
" set ( _VCPKG_ROOT_DIR \"${_root_dir}\" CACHE STRING \"\")\n"
2017-12-08 22:03:03 -08:00
)
2019-09-23 13:43:52 -07:00
else ( )
2019-12-20 21:20:31 +01:00
list ( APPEND CMAKE_TRY_COMPILE_PLATFORM_VARIABLES
2019-09-23 13:43:52 -07:00
V C P K G _ T A R G E T _ T R I P L E T
V C P K G _ A P P L O C A L _ D E P S
V C P K G _ C H A I N L O A D _ T O O L C H A I N _ F I L E
_ V C P K G _ R O O T _ D I R
)
endif ( )
2017-12-08 22:03:03 -08:00
endif ( )