Skip to content

Commit 671dfa2

Browse files
committed
ignore anaconda more effectively
1 parent 9e19388 commit 671dfa2

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ endif()
2222

2323
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
2424

25+
# --- avoid Anaconda libraries
26+
if(DEFINED ENV{CONDA_PREFIX})
27+
list(APPEND CMAKE_IGNORE_PREFIX_PATH $ENV{CONDA_PREFIX})
28+
endif()
2529

2630
include(options.cmake)
2731
include(cmake/compilers.cmake)

cmake/FindHDF5.cmake

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ 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)
6669
function(get_flags exec outvar)
6770

6871
execute_process(COMMAND ${exec} -show
@@ -501,13 +504,15 @@ if(HDF5_ROOT)
501504
NO_DEFAULT_PATH
502505
HINTS ${HDF5_ROOT}
503506
PATH_SUFFIXES ${hdf5_binsuf}
507+
DOC "HDF5 Fortran compiler script"
504508
)
505509
else()
506510
find_program(HDF5_Fortran_COMPILER_EXECUTABLE
507511
NAMES ${wrapper_names}
508512
NAMES_PER_DIR
509513
PATHS ${hdf5_binpref}
510514
PATH_SUFFIXES ${hdf5_binsuf}
515+
DOC "HDF5 Fortran compiler script"
511516
)
512517
endif()
513518

@@ -556,13 +561,15 @@ if(HDF5_ROOT)
556561
NO_DEFAULT_PATH
557562
HINTS ${HDF5_ROOT}
558563
PATH_SUFFIXES ${hdf5_binsuf}
564+
DOC "HDF5 C++ compiler script"
559565
)
560566
else()
561567
find_program(HDF5_CXX_COMPILER_EXECUTABLE
562568
NAMES ${wrapper_names}
563569
NAMES_PER_DIR
564570
PATHS ${hdf5_binpref}
565571
PATH_SUFFIXES ${hdf5_binsuf}
572+
DOC "HDF5 C++ compiler script"
566573
)
567574
endif()
568575

@@ -605,13 +612,15 @@ if(HDF5_ROOT)
605612
NO_DEFAULT_PATH
606613
HINTS ${HDF5_ROOT}
607614
PATH_SUFFIXES ${hdf5_binsuf}
615+
DOC "HDF5 C compiler script"
608616
)
609617
else()
610618
find_program(HDF5_C_COMPILER_EXECUTABLE
611619
NAMES ${wrapper_names}
612620
NAMES_PER_DIR
613621
PATHS ${hdf5_binpref}
614622
PATH_SUFFIXES ${hdf5_binsuf}
623+
DOC "HDF5 C compiler script"
615624
)
616625
endif()
617626

@@ -779,14 +788,6 @@ if(NOT HDF5_ROOT)
779788
endif()
780789
endif()
781790

782-
# Conda causes numerous problems with finding HDF5, so exclude from search
783-
if(DEFINED ENV{CONDA_PREFIX})
784-
set(h5_ignore_path
785-
$ENV{CONDA_PREFIX}/bin $ENV{CONDA_PREFIX}/lib $ENV{CONDA_PREFIX}/include
786-
$ENV{CONDA_PREFIX}/Library/bin $ENV{CONDA_PREFIX}/Library/lib $ENV{CONDA_PREFIX}/Library/include
787-
)
788-
list(APPEND CMAKE_IGNORE_PATH ${h5_ignore_path})
789-
endif()
790791

791792
# --- library suffixes
792793

@@ -874,10 +875,7 @@ check_hdf5_link()
874875
set(CMAKE_REQUIRED_LIBRARIES)
875876
set(CMAKE_REQUIRED_INCLUDES)
876877

877-
# pop off ignored paths so rest of script can find Python
878-
if(DEFINED CMAKE_IGNORE_PATH)
879-
list(REMOVE_ITEM CMAKE_IGNORE_PATH "${h5_ignore_path}")
880-
endif()
878+
set(CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH ${_use_sys_env_path})
881879

882880
include(FindPackageHandleStandardArgs)
883881
find_package_handle_standard_args(HDF5

0 commit comments

Comments
 (0)