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)
|
|
|
|
|
2017-12-08 22:03:03 -08:00
|
|
|
# This is a backport of CMAKE_TRY_COMPILE_PLATFORM_VARIABLES to cmake 3.0
|
2017-11-25 11:49:15 -08:00
|
|
|
get_property( _CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE )
|
|
|
|
if( _CMAKE_IN_TRY_COMPILE )
|
|
|
|
include( "${CMAKE_CURRENT_SOURCE_DIR}/../vcpkg.config.cmake" OPTIONAL )
|
|
|
|
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()
|
|
|
|
|
|
|
|
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)
|
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$")
|
|
|
|
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()
|
2017-10-16 11:22:21 -07:00
|
|
|
message(FATAL_ERROR "Unable to determine target architecture.")
|
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-06 10:07:39 -08:00
|
|
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
2017-11-25 15:53:32 -08:00
|
|
|
set(_VCPKG_TARGET_TRIPLET_PLAT linux)
|
2018-03-06 10:07:39 -08:00
|
|
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
2018-03-02 08:59:17 -08:00
|
|
|
set(_VCPKG_TARGET_TRIPLET_PLAT osx)
|
|
|
|
else()
|
2017-10-16 11:22:21 -07:00
|
|
|
set(_VCPKG_TARGET_TRIPLET_PLAT windows)
|
|
|
|
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)
|
|
|
|
|
2018-02-23 16:50:32 -08:00
|
|
|
if(NOT EXISTS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" AND NOT _CMAKE_IN_TRY_COMPILE)
|
|
|
|
message(WARNING "There are no libraries installed for the Vcpkg triplet ${VCPKG_TARGET_TRIPLET}.")
|
|
|
|
endif()
|
|
|
|
|
2017-10-16 11:22:21 -07:00
|
|
|
if(CMAKE_BUILD_TYPE MATCHES "^Debug$" OR NOT DEFINED CMAKE_BUILD_TYPE)
|
2016-09-18 20:50:08 -07:00
|
|
|
list(APPEND CMAKE_PREFIX_PATH
|
2017-10-16 11:22:21 -07:00
|
|
|
${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug
|
2016-09-18 20:50:08 -07:00
|
|
|
)
|
2016-11-25 23:10:27 -08:00
|
|
|
list(APPEND CMAKE_LIBRARY_PATH
|
2017-10-16 11:22:21 -07:00
|
|
|
${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib/manual-link
|
2016-11-25 23:10:27 -08:00
|
|
|
)
|
2017-11-25 11:49:15 -08:00
|
|
|
list(APPEND CMAKE_FIND_ROOT_PATH
|
|
|
|
${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug
|
|
|
|
)
|
2017-10-16 11:22:21 -07:00
|
|
|
endif()
|
|
|
|
list(APPEND CMAKE_PREFIX_PATH
|
|
|
|
${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}
|
|
|
|
)
|
2017-11-25 11:49:15 -08:00
|
|
|
list(APPEND CMAKE_FIND_ROOT_PATH
|
|
|
|
${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}
|
|
|
|
)
|
2017-10-16 11:22:21 -07:00
|
|
|
list(APPEND CMAKE_LIBRARY_PATH
|
|
|
|
${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/manual-link
|
|
|
|
)
|
2016-09-18 20:50:08 -07:00
|
|
|
|
2017-11-25 15:53:32 -08:00
|
|
|
if (NOT DEFINED CMAKE_SYSTEM_VERSION AND _VCPKG_TARGET_TRIPLET_PLAT MATCHES "windows|uwp")
|
2017-10-16 11:22:21 -07:00
|
|
|
include(${_VCPKG_ROOT_DIR}/scripts/cmake/vcpkg_get_windows_sdk.cmake)
|
|
|
|
# This is used as an implicit parameter for vcpkg_get_windows_sdk
|
|
|
|
set(VCPKG_ROOT_DIR ${_VCPKG_ROOT_DIR})
|
|
|
|
vcpkg_get_windows_sdk(WINDOWS_SDK_VERSION)
|
|
|
|
unset(VCPKG_ROOT_DIR)
|
|
|
|
set(CMAKE_SYSTEM_VERSION ${WINDOWS_SDK_VERSION} CACHE STRING "Windows SDK version")
|
2018-01-04 00:19:52 +01:00
|
|
|
message(STATUS "Found Windows SDK ${WINDOWS_SDK_VERSION}")
|
2017-10-16 11:22:21 -07:00
|
|
|
endif()
|
2017-03-21 15:48:29 -07:00
|
|
|
|
2017-10-16 11:22:21 -07:00
|
|
|
file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _programfiles)
|
|
|
|
set(CMAKE_SYSTEM_IGNORE_PATH
|
|
|
|
"${_programfiles}/OpenSSL"
|
|
|
|
"${_programfiles}/OpenSSL-Win32"
|
|
|
|
"${_programfiles}/OpenSSL-Win64"
|
|
|
|
"${_programfiles}/OpenSSL-Win32/lib/VC"
|
|
|
|
"${_programfiles}/OpenSSL-Win64/lib/VC"
|
|
|
|
"${_programfiles}/OpenSSL-Win32/lib/VC/static"
|
|
|
|
"${_programfiles}/OpenSSL-Win64/lib/VC/static"
|
|
|
|
"C:/OpenSSL/"
|
|
|
|
"C:/OpenSSL-Win32/"
|
|
|
|
"C:/OpenSSL-Win64/"
|
|
|
|
"C:/OpenSSL-Win32/lib/VC"
|
|
|
|
"C:/OpenSSL-Win64/lib/VC"
|
|
|
|
"C:/OpenSSL-Win32/lib/VC/static"
|
|
|
|
"C:/OpenSSL-Win64/lib/VC/static"
|
|
|
|
)
|
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)
|
|
|
|
if(IMPORTED_IDX EQUAL -1 AND ALIAS_IDX EQUAL -1)
|
2017-11-25 15:53:32 -08:00
|
|
|
if(VCPKG_APPLOCAL_DEPS AND _VCPKG_TARGET_TRIPLET_PLAT MATCHES "windows|uwp")
|
2017-10-16 11:22:21 -07:00
|
|
|
add_custom_command(TARGET ${name} POST_BUILD
|
|
|
|
COMMAND powershell -noprofile -executionpolicy Bypass -file ${_VCPKG_TOOLCHAIN_DIR}/msbuild/applocal.ps1
|
|
|
|
-targetBinary $<TARGET_FILE:${name}>
|
|
|
|
-installedDir "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}$<$<CONFIG:Debug>:/debug>/bin"
|
|
|
|
-OutVariable out
|
|
|
|
)
|
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
|
|
|
|
COMMAND powershell -noprofile -executionpolicy Bypass -file ${_VCPKG_TOOLCHAIN_DIR}/msbuild/applocal.ps1
|
|
|
|
-targetBinary $<TARGET_FILE:${name}>
|
|
|
|
-installedDir "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}$<$<CONFIG:Debug>:/debug>/bin"
|
|
|
|
-OutVariable out
|
|
|
|
)
|
|
|
|
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()
|
|
|
|
|
|
|
|
macro(find_package 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)
|
|
|
|
elseif("${name}" STREQUAL "Boost")
|
2017-12-20 09:18:13 +09:00
|
|
|
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})
|
2017-10-16 11:22:21 -07:00
|
|
|
unset(Boost_USE_STATIC_LIBS)
|
2017-11-06 04:33:35 +09:00
|
|
|
unset(Boost_USE_MULTITHREADED)
|
|
|
|
unset(Boost_USE_STATIC_RUNTIME)
|
2017-12-08 22:03:03 -08:00
|
|
|
set(Boost_COMPILER "-vc140")
|
2017-11-15 21:58:26 -08:00
|
|
|
_find_package(${ARGV})
|
2017-12-20 09:18:13 +09:00
|
|
|
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()
|
2017-11-15 21:58:26 -08:00
|
|
|
elseif("${name}" STREQUAL "ICU")
|
|
|
|
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()
|
|
|
|
elseif("${name}" STREQUAL "TIFF")
|
|
|
|
_find_package(${ARGV})
|
2017-11-15 18:56:44 -08:00
|
|
|
find_package(LibLZMA)
|
|
|
|
if(TARGET TIFF::TIFF)
|
|
|
|
set_property(TARGET TIFF::TIFF APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${LIBLZMA_LIBRARIES})
|
|
|
|
endif()
|
|
|
|
if(TIFF_LIBRARIES)
|
|
|
|
list(APPEND TIFF_LIBRARIES ${LIBLZMA_LIBRARIES})
|
|
|
|
endif()
|
2018-01-18 10:45:34 -08:00
|
|
|
elseif("${name}" STREQUAL "Freetype")
|
|
|
|
_find_package(${ARGV})
|
|
|
|
find_package(ZLIB)
|
|
|
|
find_package(PNG)
|
|
|
|
find_package(BZip2)
|
|
|
|
if(TARGET Freetype::Freetype)
|
|
|
|
set_property(TARGET Freetype::Freetype APPEND PROPERTY INTERFACE_LINK_LIBRARIES BZip2::BZip2 PNG::PNG ZLIB::ZLIB)
|
|
|
|
endif()
|
|
|
|
if(FREETYPE_LIBRARIES)
|
|
|
|
list(APPEND FREETYPE_LIBRARIES ${BZIP2_LIBRARIES} ${PNG_LIBRARIES} ${ZLIB_LIBRARIES})
|
|
|
|
endif()
|
2017-12-09 10:24:19 +02:00
|
|
|
elseif("${name}" STREQUAL "tinyxml2")
|
|
|
|
_find_package(${ARGV})
|
|
|
|
if(TARGET tinyxml2_static AND NOT TARGET tinyxml2)
|
2018-03-01 10:36:13 -08:00
|
|
|
_add_library(tinyxml2 INTERFACE IMPORTED)
|
2017-12-09 10:24:19 +02:00
|
|
|
set_target_properties(tinyxml2 PROPERTIES INTERFACE_LINK_LIBRARIES "tinyxml2_static")
|
|
|
|
endif()
|
2018-03-01 10:36:13 -08:00
|
|
|
elseif(("${name}" STREQUAL "HDF5" OR "${name}" STREQUAL "hdf5") AND NOT PROJECT_NAME STREQUAL "VTK")
|
2018-02-07 17:10:43 -08:00
|
|
|
# This is a hack to make VTK work. TODO: find another way to suppress the built-in find module.
|
2018-02-05 17:50:16 -08:00
|
|
|
_find_package(${ARGV} CONFIG)
|
2018-03-01 10:36:13 -08:00
|
|
|
# Fill in missing static/shared targets
|
|
|
|
foreach(HDF5TARGET hdf5 hdf5_hl hdf5_cpp hdf5_hl_cpp)
|
|
|
|
if(TARGET hdf5::${HDF5TARGET}-static AND NOT TARGET hdf5::${HDF5TARGET}-shared)
|
|
|
|
_add_library(hdf5::${HDF5TARGET}-shared INTERFACE IMPORTED)
|
|
|
|
set_target_properties(hdf5::${HDF5TARGET}-shared PROPERTIES INTERFACE_LINK_LIBRARIES "hdf5::${HDF5TARGET}-static")
|
|
|
|
elseif(TARGET hdf5::${HDF5TARGET}-shared AND NOT TARGET hdf5::${HDF5TARGET}-static)
|
|
|
|
_add_library(hdf5::${HDF5TARGET}-static INTERFACE IMPORTED)
|
|
|
|
set_target_properties(hdf5::${HDF5TARGET}-static PROPERTIES INTERFACE_LINK_LIBRARIES "hdf5::${HDF5TARGET}-shared")
|
|
|
|
endif()
|
|
|
|
endforeach()
|
2018-03-07 11:56:21 -08:00
|
|
|
elseif("${name}" STREQUAL "GSL")
|
|
|
|
_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-02-07 17:02:47 -08:00
|
|
|
elseif("${name}" STREQUAL "CURL")
|
|
|
|
_find_package(${ARGV})
|
|
|
|
if(CURL_FOUND)
|
|
|
|
if(EXISTS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/nghttp2.lib")
|
|
|
|
list(APPEND CURL_LIBRARIES
|
|
|
|
"debug" "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib/nghttp2.lib"
|
|
|
|
"optimized" "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/nghttp2.lib")
|
|
|
|
endif()
|
|
|
|
endif()
|
2018-03-07 18:56:59 +01:00
|
|
|
elseif("${name}" STREQUAL "LibXml2")
|
|
|
|
_find_package(${ARGV})
|
|
|
|
if(LibXml2_FOUND AND (CMAKE_SYSTEM_NAME STREQUAL "Windows" OR CMAKE_SYSTEM_NAME STREQUAL "WindowsStore"))
|
2018-03-09 01:43:13 -08:00
|
|
|
list(APPEND LIBXML2_LIBRARIES
|
|
|
|
debug ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib/libiconv.lib
|
|
|
|
optimized ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/libiconv.lib
|
|
|
|
debug ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib/libcharset.lib
|
|
|
|
optimized ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/libcharset.lib
|
|
|
|
ws2_32)
|
2018-03-07 18:56:59 +01:00
|
|
|
endif()
|
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
|
|
|
|
|
|
|
if(NOT _CMAKE_IN_TRY_COMPILE)
|
|
|
|
file(TO_CMAKE_PATH "${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}" _chainload_file)
|
2017-12-08 22:03:03 -08:00
|
|
|
file(TO_CMAKE_PATH "${_VCPKG_ROOT_DIR}" _root_dir)
|
2017-10-16 11:22:21 -07:00
|
|
|
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"
|
2017-12-08 22:03:03 -08:00
|
|
|
"set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE \"${_chainload_file}\" CACHE STRING \"\")\n"
|
|
|
|
"set(_VCPKG_ROOT_DIR \"${_root_dir}\" CACHE STRING \"\")\n"
|
|
|
|
)
|
|
|
|
endif()
|