mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-12-27 08:49:16 +08:00
CMake: Ensure pnetcdf links to MPI, libm
This commit is contained in:
parent
4835e43f33
commit
e88dc9c8e6
@ -615,6 +615,13 @@ if(ENABLE_LIBXML2)
|
||||
endif()
|
||||
endif(ENABLE_LIBXML2)
|
||||
|
||||
################################
|
||||
# MPI
|
||||
################################
|
||||
if(ENABLE_PARALLEL4 OR HDF5_PARALLEL)
|
||||
find_package(MPI REQUIRED)
|
||||
endif()
|
||||
|
||||
################################
|
||||
# Parallel IO
|
||||
################################
|
||||
@ -622,13 +629,6 @@ if(ENABLE_PNETCDF)
|
||||
find_package(PNETCDF 1.6.0 REQUIRED)
|
||||
endif()
|
||||
|
||||
################################
|
||||
# MPI
|
||||
################################
|
||||
if(ENABLE_PARALLEL4 OR HDF5_PARALLEL OR ENABLE_PNETCDF)
|
||||
find_package(MPI REQUIRED)
|
||||
endif()
|
||||
|
||||
################################
|
||||
# Doxygen
|
||||
################################
|
||||
|
@ -63,9 +63,16 @@ find_package_handle_standard_args(PNETCDF
|
||||
)
|
||||
|
||||
if (PNETCDF_FOUND AND NOT TARGET PNETCDF::PNETCDF)
|
||||
find_package(MPI REQUIRED)
|
||||
add_library(PNETCDF::PNETCDF UNKNOWN IMPORTED)
|
||||
set_target_properties(PNETCDF::PNETCDF PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LIBRARIES MPI::MPI_C
|
||||
IMPORTED_LOCATION "${PNETCDF_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${PNETCDF_INCLUDE_DIR}"
|
||||
)
|
||||
find_library(MATH_LIBRARY m)
|
||||
if (MATH_LIBRARY)
|
||||
set_target_properties(PNETCDF::PNETCDF PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LIBRARIES ${MATH_LIBRARY})
|
||||
endif()
|
||||
endif()
|
||||
|
Loading…
Reference in New Issue
Block a user