summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt2
-rw-r--r--fortran/CMakeLists.txt3
-rw-r--r--fortran/examples/CMakeLists.txt4
-rw-r--r--fortran/src/CMakeLists.txt4
-rw-r--r--src/CMakeLists.txt6
5 files changed, 10 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 23452cd..40093c1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -623,7 +623,7 @@ INCLUDE_DIRECTORIES (${HDF5_BINARY_DIR} ${HDF5_SRC_DIR} ${CMAKE_RUNTIME_OUTPUT_D
set (CMAKE_MODULE_PATH ${HDF_RESOURCES_DIR} ${HDF_RESOURCES_EXT_DIR} ${CMAKE_MODULE_PATH})
option (HDF5_ENABLE_PARALLEL "Enable parallel build (requires MPI)" OFF)
if (HDF5_ENABLE_PARALLEL)
- include (FindMPI)
+ find_package(MPI REQUIRED)
INCLUDE_DIRECTORIES (${MPI_C_INCLUDE_PATH})
if (MPI_C_FOUND)
set (H5_HAVE_PARALLEL 1)
diff --git a/fortran/CMakeLists.txt b/fortran/CMakeLists.txt
index f7179cf..9f7144d 100644
--- a/fortran/CMakeLists.txt
+++ b/fortran/CMakeLists.txt
@@ -2,8 +2,7 @@ cmake_minimum_required (VERSION 3.2.2)
PROJECT (HDF5_F90 C CXX Fortran)
if (H5_HAVE_PARALLEL)
- INCLUDE (FindMPI)
- set (LINK_LIBS ${LINK_LIBS} ${MPI_Fortran_LIBRARIES})
+ set (LINK_LIBS ${LINK_LIBS} MPI::MPI_Fortran)
if (MPI_Fortran_LINK_FLAGS)
set (CMAKE_EXE_LINKER_FLAGS "${MPI_Fortran_LINK_FLAGS} ${CMAKE_EXE_LINKER_FLAGS}")
endif ()
diff --git a/fortran/examples/CMakeLists.txt b/fortran/examples/CMakeLists.txt
index a5c3422..119648f 100644
--- a/fortran/examples/CMakeLists.txt
+++ b/fortran/examples/CMakeLists.txt
@@ -107,7 +107,7 @@ if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND)
target_link_libraries (f90_ex_ph5example
${HDF5_F90_LIB_TARGET}
${HDF5_LIB_TARGET}
- ${MPI_Fortran_LIBRARIES}
+ MPI::MPI_Fortran
)
target_include_directories (f90_ex_ph5example PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static)
set_target_properties (f90_ex_ph5example PROPERTIES
@@ -122,7 +122,7 @@ if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND)
target_link_libraries (f90_ex_ph5example-shared
${HDF5_F90_LIBSH_TARGET}
${HDF5_LIBSH_TARGET}
- ${MPI_Fortran_LIBRARIES}
+ MPI::MPI_Fortran
)
target_include_directories (f90_ex_ph5example-shared PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/shared)
set_target_properties (f90_ex_ph5example-shared PROPERTIES
diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt
index 6d51feb..4a723c7 100644
--- a/fortran/src/CMakeLists.txt
+++ b/fortran/src/CMakeLists.txt
@@ -243,7 +243,7 @@ set (SHARED_LINK_FLAGS " ")
TARGET_FORTRAN_PROPERTIES (${HDF5_F90_LIB_TARGET} STATIC " " " ")
target_link_libraries (${HDF5_F90_LIB_TARGET} ${HDF5_F90_C_LIB_TARGET} ${HDF5_LIB_TARGET})
if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND)
- target_link_libraries (${HDF5_F90_LIB_TARGET} ${MPI_Fortran_LIBRARIES})
+ target_link_libraries (${HDF5_F90_LIB_TARGET} MPI::MPI_Fortran)
endif ()
set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_LIB_TARGET}")
H5_SET_LIB_OPTIONS (${HDF5_F90_LIB_TARGET} ${HDF5_F90_LIB_NAME} STATIC)
@@ -270,7 +270,7 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED)
TARGET_FORTRAN_PROPERTIES (${HDF5_F90_LIBSH_TARGET} SHARED " " ${SHARED_LINK_FLAGS})
target_link_libraries (${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_C_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND)
- target_link_libraries (${HDF5_F90_LIBSH_TARGET} ${MPI_Fortran_LIBRARIES})
+ target_link_libraries (${HDF5_F90_LIBSH_TARGET} MPI::MPI_Fortran)
endif ()
set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_LIBSH_TARGET}")
H5_SET_LIB_OPTIONS (${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_LIB_NAME} SHARED ${HDF5_F_PACKAGE_SOVERSION})
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 849ced0..1651b15 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -886,7 +886,8 @@ if (NOT WIN32)
target_link_libraries (${HDF5_LIB_TARGET} PRIVATE dl)
endif ()
if (H5_HAVE_PARALLEL AND MPI_C_FOUND)
- target_link_libraries (${HDF5_LIB_TARGET} PRIVATE ${MPI_C_LIBRARIES})
+ target_include_directories (${HDF5_LIB_TARGET} PRIVATE ${MPI_C_INCLUDE_PATH})
+ target_link_libraries (${HDF5_LIB_TARGET} PRIVATE MPI::MPI_C})
endif ()
set_global_variable (HDF5_LIBRARIES_TO_EXPORT ${HDF5_LIB_TARGET})
H5_SET_LIB_OPTIONS (${HDF5_LIB_TARGET} ${HDF5_LIB_NAME} STATIC)
@@ -930,7 +931,8 @@ if (BUILD_SHARED_LIBS)
target_link_libraries (${HDF5_LIBSH_TARGET} PUBLIC dl)
endif ()
if (H5_HAVE_PARALLEL AND MPI_C_FOUND)
- target_link_libraries (${HDF5_LIBSH_TARGET} PRIVATE ${MPI_C_LIBRARIES})
+ target_include_directories (${HDF5_LIBSH_TARGET} PRIVATE ${MPI_C_INCLUDE_PATH})
+ target_link_libraries (${HDF5_LIBSH_TARGET} PRIVATE MPI::MPI_C)
endif ()
set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_LIBSH_TARGET}")
H5_SET_LIB_OPTIONS (${HDF5_LIBSH_TARGET} ${HDF5_LIB_NAME} SHARED ${HDF5_PACKAGE_SOVERSION})