diff options
Diffstat (limited to 'ports')
| -rw-r--r-- | ports/hdf5/portfile.cmake | 6 | ||||
| -rw-r--r-- | ports/hdf5/vcpkg-cmake-wrapper.cmake | 29 |
2 files changed, 35 insertions, 0 deletions
diff --git a/ports/hdf5/portfile.cmake b/ports/hdf5/portfile.cmake index 1da61178b..61235fab1 100644 --- a/ports/hdf5/portfile.cmake +++ b/ports/hdf5/portfile.cmake @@ -57,5 +57,11 @@ file(RENAME ${CURRENT_PACKAGES_DIR}/share/hdf5/data/COPYING ${CURRENT_PACKAGES_D vcpkg_fixup_cmake_targets(CONFIG_PATH share/hdf5) +configure_file( + ${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake + ${CURRENT_PACKAGES_DIR}/share/hdf5 + @ONLY +) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) diff --git a/ports/hdf5/vcpkg-cmake-wrapper.cmake b/ports/hdf5/vcpkg-cmake-wrapper.cmake new file mode 100644 index 000000000..879d2516d --- /dev/null +++ b/ports/hdf5/vcpkg-cmake-wrapper.cmake @@ -0,0 +1,29 @@ +if (NOT PROJECT_NAME STREQUAL "VTK")
+ _find_package(${ARGS} 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()
+else ()
+ _find_package(${ARGS})
+endif()
+
+if("static" STREQUAL "static")
+find_package(SZIP CONFIG REQUIRED)
+foreach(HDF5TARGET hdf5 hdf5_hl hdf5_cpp hdf5_hl_cpp)
+ if(TARGET hdf5::${HDF5TARGET}-static)
+ if (TARGET szip-shared)
+ set_property(TARGET hdf5::${HDF5TARGET}-static APPEND PROPERTY INTERFACE_LINK_LIBRARIES szip-shared)
+ else ()
+ set_property(TARGET hdf5::${HDF5TARGET}-static APPEND PROPERTY INTERFACE_LINK_LIBRARIES szip-static)
+ endif ()
+ endif()
+endforeach()
+endif()
+
|
