diff --git a/libhdf5/CMakeLists.txt b/libhdf5/CMakeLists.txt index 8b396e484..ad9b67a23 100644 --- a/libhdf5/CMakeLists.txt +++ b/libhdf5/CMakeLists.txt @@ -19,5 +19,9 @@ ENDIF() # the netCDF library. add_library(netcdfhdf5 OBJECT ${libnchdf5_SOURCES}) +IF(MPI_C_INCLUDE_PATH) + target_include_directories(netcdfhdf5 PUBLIC ${MPI_C_INCLUDE_PATH}) +ENDIF(MPI_C_INCLUDE_PATH) + # Remember to package this file for CMake builds. ADD_EXTRA_DIST(${libnchdf5_SOURCES} CMakeLists.txt) diff --git a/libsrc/CMakeLists.txt b/libsrc/CMakeLists.txt index 6e1a525fb..45837339a 100644 --- a/libsrc/CMakeLists.txt +++ b/libsrc/CMakeLists.txt @@ -33,6 +33,10 @@ ENDIF(ENABLE_BYTERANGE) add_library(netcdf3 OBJECT ${libsrc_SOURCES}) +IF(MPI_C_INCLUDE_PATH) + target_include_directories(netcdf3 PUBLIC ${MPI_C_INCLUDE_PATH}) +ENDIF(MPI_C_INCLUDE_PATH) + # The C API man page. SET(MAN_FILES netcdf.3) diff --git a/libsrc4/CMakeLists.txt b/libsrc4/CMakeLists.txt index 0334edae4..ff31b596f 100644 --- a/libsrc4/CMakeLists.txt +++ b/libsrc4/CMakeLists.txt @@ -12,6 +12,10 @@ ncindex.c nc4cache.c) add_library(netcdf4 OBJECT ${libsrc4_SOURCES}) +IF(MPI_C_INCLUDE_PATH) + target_include_directories(netcdf4 PUBLIC ${MPI_C_INCLUDE_PATH}) +ENDIF(MPI_C_INCLUDE_PATH) + # Files for make dist FILE(GLOB libsrc4_HEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.h ${CMAKE_CURRENT_SOURCE_DIR}/*.sh) SET(CUR_EXTRA_DIST CMakeLists.txt Makefile.am)