From de840b5254410ee0c977e45ab9efcda19e989d39 Mon Sep 17 00:00:00 2001 From: Cyrus Harrison Date: Mon, 19 Oct 2020 14:37:46 -0700 Subject: [PATCH 1/2] guard use of env for hdf5 with cmake version --- src/config/conduit_setup_deps.cmake | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/config/conduit_setup_deps.cmake b/src/config/conduit_setup_deps.cmake index ec3c85bb7..59f08d40d 100644 --- a/src/config/conduit_setup_deps.cmake +++ b/src/config/conduit_setup_deps.cmake @@ -38,10 +38,13 @@ if(CONDUIT_HDF5_DIR) set(HDF5_ROOT ${HDF5_DIR_REAL}) if(NOT WIN32) - set(ENV{HDF5_ROOT} ${HDF5_ROOT}/bin) - # Use CMake's FindHDF5 module, which uses hdf5's compiler wrappers to extract - # all the info about the hdf5 install - include(FindHDF5) + # use HDF5_ROOT env var for FindHDF5 with older versions of cmake + if(${CMAKE_VERSION} VERSION_LESS "3.12.0") + set(ENV{HDF5_ROOT} ${HDF5_ROOT}/bin) + endif() + + # Use CMake's FindHDF5 module to locate hdf5 and setup hdf5 + find_package(HDF5 REQUIRED) else() # CMake's FindHDF5 module is buggy on windows and will put the dll # in HDF5_LIBRARY. Instead, use the 'CONFIG' signature of find_package From c90402a54a4e048345423b83a3af90a7a08ec12c Mon Sep 17 00:00:00 2001 From: Cyrus Harrison Date: Mon, 19 Oct 2020 15:06:16 -0700 Subject: [PATCH 2/2] resolve CMP0074 policy warnings downstream when importing installed conduit --- src/config/conduit_setup_deps.cmake | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/config/conduit_setup_deps.cmake b/src/config/conduit_setup_deps.cmake index 59f08d40d..589d59559 100644 --- a/src/config/conduit_setup_deps.cmake +++ b/src/config/conduit_setup_deps.cmake @@ -34,6 +34,12 @@ if(CONDUIT_HDF5_DIR) get_filename_component(HDF5_DIR_REAL "${HDF5_DIR}" REALPATH) message(STATUS "Looking for HDF5 at: " ${HDF5_DIR_REAL}) + if(POLICY CMP0074) + #policy for _ROOT variables + cmake_policy(PUSH) + cmake_policy(SET CMP0074 NEW) + endif() + # CMake's FindHDF5 module uses the HDF5_ROOT env var set(HDF5_ROOT ${HDF5_DIR_REAL}) @@ -57,6 +63,11 @@ if(CONDUIT_HDF5_DIR) ${HDF5_DIR}/cmake) endif() + if(POLICY CMP0074) + # clear CMP0074 + cmake_policy(POP) + endif() + # FindHDF5/find_package sets HDF5_DIR to it's installed CMake info if it exists # we want to keep HDF5_DIR as the root dir of the install to be # consistent with other packages