[vcpkg] Improve handling of HDF5 targets

This commit is contained in:
Robert Schumacher 2018-03-01 10:36:13 -08:00
parent e836ea0800
commit e70250ca19

View File

@ -233,12 +233,22 @@ macro(find_package name)
elseif("${name}" STREQUAL "tinyxml2")
_find_package(${ARGV})
if(TARGET tinyxml2_static AND NOT TARGET tinyxml2)
add_library(tinyxml2 INTERFACE IMPORTED)
_add_library(tinyxml2 INTERFACE IMPORTED)
set_target_properties(tinyxml2 PROPERTIES INTERFACE_LINK_LIBRARIES "tinyxml2_static")
endif()
elseif("${name}" STREQUAL "HDF5" AND NOT PROJECT_NAME STREQUAL "VTK")
elseif(("${name}" STREQUAL "HDF5" OR "${name}" STREQUAL "hdf5") AND NOT PROJECT_NAME STREQUAL "VTK")
# This is a hack to make VTK work. TODO: find another way to suppress the built-in find module.
_find_package(${ARGV} CONFIG)
# 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()
elseif("${name}" STREQUAL "CURL")
_find_package(${ARGV})
if(CURL_FOUND)