summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-02-10 14:06:33 (GMT)
committerBrad King <brad.king@kitware.com>2020-02-10 16:10:29 (GMT)
commit8261ee3a9c641d8e3843bfc0751a9bc49409e0f2 (patch)
treee1f7980715bbf901d8ec113d29d757a6a3f50327 /Modules
parentfbd20759bed28307cb374ec979fbb48370fff042 (diff)
downloadCMake-8261ee3a9c641d8e3843bfc0751a9bc49409e0f2.zip
CMake-8261ee3a9c641d8e3843bfc0751a9bc49409e0f2.tar.gz
CMake-8261ee3a9c641d8e3843bfc0751a9bc49409e0f2.tar.bz2
FindMPI: Restore re-construction of include directories
The fix in commit 5861c6d450 (FindMPI: Preserve include order when extracting component directories, 2019-12-19) only works on the first run of CMake in which we find MPI. It preserves the include directories on the first run but still splits them up and saves the pieces in the cache. On future runs the pieces are not re-assembled, and we do not know the order anyway. Restore the re-assembly step so that at least all the include dirs are available. Leave preservation of the original order to later work. Issue: #20338
Diffstat (limited to 'Modules')
-rw-r--r--Modules/FindMPI.cmake21
1 files changed, 21 insertions, 0 deletions
diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake
index cb52056..97b050e 100644
--- a/Modules/FindMPI.cmake
+++ b/Modules/FindMPI.cmake
@@ -1059,6 +1059,24 @@ macro(_MPI_assemble_libraries LANG)
endif()
endmacro()
+macro(_MPI_assemble_include_dirs LANG)
+ if("${LANG}" MATCHES "(C|CXX)")
+ if(MPI_${LANG}_HEADER_DIR)
+ list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_HEADER_DIR}")
+ endif()
+ else() # Fortran
+ if(MPI_${LANG}_F77_HEADER_DIR)
+ list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_F77_HEADER_DIR}")
+ endif()
+ if(MPI_${LANG}_MODULE_DIR)
+ list(APPEND MPI_${LANG}_INCLUDE_DIRS "${MPI_${LANG}_MODULE_DIR}")
+ endif()
+ endif()
+ if(MPI_${LANG}_INCLUDE_DIRS)
+ list(REMOVE_DUPLICATES MPI_${LANG}_INCLUDE_DIRS)
+ endif()
+endmacro()
+
macro(_MPI_split_include_dirs LANG)
# Backwards compatibility: Search INCLUDE_PATH if given.
if(MPI_${LANG}_INCLUDE_PATH)
@@ -1474,6 +1492,9 @@ foreach(LANG IN ITEMS C CXX Fortran)
if(NOT "${MPI_${LANG}_COMPILER}" STREQUAL "${CMAKE_${LANG}_COMPILER}")
_MPI_split_include_dirs(${LANG})
+ _MPI_assemble_include_dirs(${LANG})
+ else()
+ set(MPI_${LANG}_INCLUDE_DIRS "")
endif()
_MPI_assemble_libraries(${LANG})