Skip to content

Commit

Permalink
pass HDF5_ROOT to netcdf extproj
Browse files Browse the repository at this point in the history
  • Loading branch information
scivision committed Mar 8, 2024
1 parent 5377779 commit 43d6168
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmake/netcdf-c.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ set(netcdf_c_cmake_args
-DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER}
-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON
-DZLIB_LIBRARY:FILEPATH=${ZLIB_LIBRARIES}
-DHDF5_ROOT:PATH=${HDF5_ROOT}
)
# BUILD_SHARED_LIBS=on for netcdf-fortran symbol finding bug

Expand Down
5 changes: 5 additions & 0 deletions cmake/netcdf.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ include(GNUInstallDirs)

file(READ ${CMAKE_CURRENT_LIST_DIR}/libraries.json json)

if(NOT DEFINED HDF5_ROOT AND DEFINED ENV{HDF5_ROOT})
set(HDF5_ROOT $ENV{HDF5_ROOT})
endif()

find_package(HDF5 COMPONENTS C Fortran)
if(HDF5_FOUND)
add_custom_target(HDF5)
Expand Down Expand Up @@ -49,6 +53,7 @@ set(netcdf_fortran_cmake_args
-DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER}
-DCMAKE_Fortran_COMPILER:FILEPATH=${CMAKE_Fortran_COMPILER}
-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON
-DHDF5_ROOT:PATH=${HDF5_ROOT}
)

if(WIN32)
Expand Down

0 comments on commit 43d6168

Please sign in to comment.