Skip to content

Commit 3fc5a63

Browse files
committed
FindHDF5: don't block path in here:
1 parent e47fa03 commit 3fc5a63

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.14...3.27)
1+
cmake_minimum_required(VERSION 3.14...3.28)
22

33
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
44
message(FATAL_ERROR "Please do out of source build like
@@ -25,6 +25,10 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
2525
# --- avoid Anaconda libraries
2626
if(DEFINED ENV{CONDA_PREFIX})
2727
list(APPEND CMAKE_IGNORE_PREFIX_PATH $ENV{CONDA_PREFIX})
28+
list(APPEND CMAKE_IGNORE_PATH $ENV{CONDA_PREFIX}/bin)
29+
# need CMAKE_IGNORE_PATH for CMake < 3.23
30+
# and to ensure system env var PATH doesn't interfere
31+
# despite CMAKE_IGNORE_PREFIX_PATH
2832
endif()
2933

3034
include(options.cmake)

cmake/FindHDF5.cmake

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,7 @@ include(CheckSymbolExists)
6363
include(CheckCSourceCompiles)
6464
include(CheckFortranSourceCompiles)
6565

66-
# this is to help avoid unwanted Anaconda HDF5 or stray h5cc compiler script
67-
set(_use_sys_env_path ${CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH})
68-
set(CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH false)
66+
6967
function(get_flags exec outvar)
7068

7169
execute_process(COMMAND ${exec} -show
@@ -875,8 +873,6 @@ check_hdf5_link()
875873
set(CMAKE_REQUIRED_LIBRARIES)
876874
set(CMAKE_REQUIRED_INCLUDES)
877875

878-
set(CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH ${_use_sys_env_path})
879-
880876
include(FindPackageHandleStandardArgs)
881877
find_package_handle_standard_args(HDF5
882878
REQUIRED_VARS HDF5_C_LIBRARIES HDF5_links

test/CMakeLists.txt

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,11 @@ if(WIN32 AND CMAKE_VERSION VERSION_GREATER_EQUAL 3.22)
9090
endif()
9191

9292
# --- Python h5py
93-
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.12)
94-
set(Python_FIND_VIRTUALENV STANDARD)
95-
# use order in PATH to pick Python interpreter
96-
# this avoids unexpected old system Python getting used IF conda environment has been activated
97-
find_package(Python COMPONENTS Interpreter)
98-
endif()
93+
set(Python_FIND_VIRTUALENV STANDARD)
94+
# use order in PATH to pick Python interpreter
95+
# this avoids unexpected old system Python getting used IF conda environment has been activated
96+
find_package(Python COMPONENTS Interpreter)
97+
9998
if(NOT DEFINED h5py_ok)
10099
execute_process(COMMAND ${Python_EXECUTABLE} -c "import h5py"
101100
RESULT_VARIABLE ret

0 commit comments

Comments
 (0)