From 95b802e87a2064476ae2b4b4556b595ddcbdf2ae Mon Sep 17 00:00:00 2001 From: JackBoosY Date: Fri, 29 Mar 2024 15:11:49 +0100 Subject: [PATCH 1/3] Apply vcpkg patch for hdf5 CMake config --- cmake/thirdParties.cmake | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cmake/thirdParties.cmake b/cmake/thirdParties.cmake index 4d0b4846..bd74bf76 100644 --- a/cmake/thirdParties.cmake +++ b/cmake/thirdParties.cmake @@ -32,7 +32,7 @@ if(MATIO_WITH_HDF5) endif() set(HDF5_FOUND TRUE) else() - find_package(HDF5) + find_package(HDF5 CONFIG REQUIRED) if(HDF5_FOUND) set(HDF_MIN_VER 1.8) if(HDF5_VERSION VERSION_LESS ${HDF_MIN_VER}) @@ -60,9 +60,12 @@ if(HDF5_FOUND) elseif(TARGET hdf5) # target from hdf5 1.8 config target_link_libraries(MATIO::HDF5 INTERFACE hdf5) - elseif(TARGET HDF5::HDF5) + elseif(TARGET hdf5::hdf5-shared) # target defined in CMake FindHDF5 (since 3.19) - target_link_libraries(MATIO::HDF5 INTERFACE HDF5::HDF5) + target_link_libraries(MATIO::HDF5 INTERFACE hdf5::hdf5-shared) + elseif(TARGET hdf5::hdf5-static) + # target defined in CMake FindHDF5 (since 3.19) + target_link_libraries(MATIO::HDF5 INTERFACE hdf5-static) else() # results from CMake FindHDF5 set_target_properties(MATIO::HDF5 PROPERTIES From d75eeef66da02fa24f0197809d2ef97d91870c1f Mon Sep 17 00:00:00 2001 From: tbeu Date: Sat, 30 Mar 2024 17:31:28 +0100 Subject: [PATCH 2/3] Revert partially --- cmake/thirdParties.cmake | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/cmake/thirdParties.cmake b/cmake/thirdParties.cmake index bd74bf76..555740c7 100644 --- a/cmake/thirdParties.cmake +++ b/cmake/thirdParties.cmake @@ -28,11 +28,15 @@ if(MATIO_WITH_HDF5) REQUIRES ${MATIO_CONAN_REQUIRES} BASIC_SETUP CMAKE_TARGETS OPTIONS hdf5:shared=True zlib:shared=True - BUILD missing) + BUILD missing + ) endif() set(HDF5_FOUND TRUE) else() - find_package(HDF5 CONFIG REQUIRED) + find_package(HDF5 CONFIG) + if(NOT HDF5_FOUND) + find_package(HDF5) + endif() if(HDF5_FOUND) set(HDF_MIN_VER 1.8) if(HDF5_VERSION VERSION_LESS ${HDF_MIN_VER}) @@ -60,12 +64,9 @@ if(HDF5_FOUND) elseif(TARGET hdf5) # target from hdf5 1.8 config target_link_libraries(MATIO::HDF5 INTERFACE hdf5) - elseif(TARGET hdf5::hdf5-shared) - # target defined in CMake FindHDF5 (since 3.19) - target_link_libraries(MATIO::HDF5 INTERFACE hdf5::hdf5-shared) - elseif(TARGET hdf5::hdf5-static) + elseif(TARGET HDF5::HDF5) # target defined in CMake FindHDF5 (since 3.19) - target_link_libraries(MATIO::HDF5 INTERFACE hdf5-static) + target_link_libraries(MATIO::HDF5 INTERFACE HDF5::HDF5) else() # results from CMake FindHDF5 set_target_properties(MATIO::HDF5 PROPERTIES From a5a40b2428c20504dc6fe8fa22cedeef3f59185b Mon Sep 17 00:00:00 2001 From: tbeu Date: Sat, 30 Mar 2024 18:28:03 +0100 Subject: [PATCH 3/3] Revert all --- cmake/thirdParties.cmake | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/cmake/thirdParties.cmake b/cmake/thirdParties.cmake index 555740c7..ac7a3417 100644 --- a/cmake/thirdParties.cmake +++ b/cmake/thirdParties.cmake @@ -33,10 +33,7 @@ if(MATIO_WITH_HDF5) endif() set(HDF5_FOUND TRUE) else() - find_package(HDF5 CONFIG) - if(NOT HDF5_FOUND) - find_package(HDF5) - endif() + find_package(HDF5) if(HDF5_FOUND) set(HDF_MIN_VER 1.8) if(HDF5_VERSION VERSION_LESS ${HDF_MIN_VER})