From 77de8fda28aab930294a081dedfdc2a0c6617d2f Mon Sep 17 00:00:00 2001 From: mattjala <124107509+mattjala@users.noreply.github.com> Date: Fri, 5 Jan 2024 20:46:15 -0600 Subject: Fix building VOLs under library with CMake <3.24 (#3924) * Handle CMake version through override variable --- CMakeVOL.cmake | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/CMakeVOL.cmake b/CMakeVOL.cmake index 8b2207a..e089437 100644 --- a/CMakeVOL.cmake +++ b/CMakeVOL.cmake @@ -172,20 +172,16 @@ if (HDF5_VOL_ALLOW_EXTERNAL MATCHES "GIT" OR HDF5_VOL_ALLOW_EXTERNAL MATCHES "LO set (hdf5_vol_depname "${HDF5_VOL_${hdf5_vol_name_upper}_CMAKE_PACKAGE_NAME}") string (TOLOWER "${hdf5_vol_depname}" hdf5_vol_depname_lower) + if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.24") + set("OVERRIDE_FIND_PACKAGE_OPT" "OVERRIDE_FIND_PACKAGE") + endif() + if (HDF5_VOL_ALLOW_EXTERNAL MATCHES "GIT") - if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.24") - FetchContent_Declare (${hdf5_vol_depname} - GIT_REPOSITORY "${HDF5_VOL_SOURCE}" - GIT_TAG "${HDF5_VOL_${hdf5_vol_name_upper}_BRANCH}" - OVERRIDE_FIND_PACKAGE - ) - else () - FetchContent_Declare (${hdf5_vol_depname} + FetchContent_Declare (${hdf5_vol_depname} GIT_REPOSITORY "${HDF5_VOL_SOURCE}" GIT_TAG "${HDF5_VOL_${hdf5_vol_name_upper}_BRANCH}" - FIND_PACKAGE_ARGS NAMES ${hdf5_vol_name_lower} - ) - endif () + "${OVERRIDE_FIND_PACKAGE_OPT}" + ) elseif(HDF5_VOL_ALLOW_EXTERNAL MATCHES "LOCAL_DIR") FetchContent_Declare (${hdf5_vol_depname} SOURCE_DIR "${HDF5_VOL_SOURCE}" -- cgit v0.12