forked from lijiext/lammps
set cmake policy to honor HDF5_ROOT and NETCDF_ROOT. search for parallel NetCDF only with parallel builds
This commit is contained in:
parent
e97bf005cb
commit
696308a760
|
@ -1,5 +1,8 @@
|
|||
enable_language(C)
|
||||
|
||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.12)
|
||||
cmake_policy(SET CMP0074 NEW)
|
||||
endif()
|
||||
find_package(HDF5 REQUIRED)
|
||||
target_link_libraries(h5md PRIVATE ${HDF5_LIBRARIES})
|
||||
target_include_directories(h5md PUBLIC ${HDF5_INCLUDE_DIRS})
|
||||
|
|
|
@ -1,11 +1,18 @@
|
|||
# USER-NETCDF can use NetCDF, Parallel NetCDF (PNetCDF), or both. At least one necessary.
|
||||
# NetCDF library enables dump style "netcdf", while PNetCDF enables dump style "netcdf/mpiio"
|
||||
find_package(NetCDF)
|
||||
if(NETCDF_FOUND)
|
||||
find_package(PNetCDF)
|
||||
else(NETCDF_FOUND)
|
||||
find_package(PNetCDF REQUIRED)
|
||||
endif(NETCDF_FOUND)
|
||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.12)
|
||||
cmake_policy(SET CMP0074 NEW)
|
||||
endif()
|
||||
if(NOT BUILD_MPI)
|
||||
find_package(NetCDF REQUIRED)
|
||||
else()
|
||||
find_package(NetCDF)
|
||||
if(NETCDF_FOUND)
|
||||
find_package(PNetCDF)
|
||||
else()
|
||||
find_package(PNetCDF REQUIRED)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NETCDF_FOUND)
|
||||
target_link_libraries(lammps PRIVATE NetCDF::NetCDF)
|
||||
|
|
Loading…
Reference in New Issue