summaryrefslogtreecommitdiffstats
path: root/Modules/FindMPI.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/FindMPI.cmake')
-rw-r--r--Modules/FindMPI.cmake28
1 files changed, 28 insertions, 0 deletions
diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake
index 0923c00..b84fc91 100644
--- a/Modules/FindMPI.cmake
+++ b/Modules/FindMPI.cmake
@@ -88,6 +88,10 @@ elseif (MPI_COMPILER)
ARGS -showme:link
OUTPUT_VARIABLE MPI_LINK_CMDLINE
RETURN_VALUE MPI_COMPILER_RETURN)
+
+ # Note that we probably have -showme:incdirs and -showme:libdirs
+ # as well.
+ set(MPI_COMPILER_MAY_HAVE_INCLIBDIRS TRUE)
endif (MPI_COMPILER_RETURN EQUAL 0)
if (MPI_COMPILER_RETURN EQUAL 0)
@@ -145,6 +149,18 @@ elseif (MPI_COMPILE_CMDLINE)
list(APPEND MPI_INCLUDE_PATH_WORK ${IPATH})
endforeach(IPATH)
+ if (NOT MPI_INCLUDE_PATH_WORK)
+ if (MPI_COMPILER_MAY_HAVE_INCLIBDIRS)
+ # The compile command line didn't have any include paths on it,
+ # but we may have -showme:incdirs. Use it.
+ exec_program(${MPI_COMPILER}
+ ARGS -showme:incdirs
+ OUTPUT_VARIABLE MPI_INCLUDE_PATH_WORK
+ RETURN_VALUE MPI_COMPILER_RETURN)
+ separate_arguments(MPI_INCLUDE_PATH_WORK)
+ endif (MPI_COMPILER_MAY_HAVE_INCLIBDIRS)
+ endif (NOT MPI_INCLUDE_PATH_WORK)
+
# Extract linker paths from the link command line
string(REGEX MATCHALL "-L([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_PATHS "${MPI_LINK_CMDLINE}")
set(MPI_LINK_PATH)
@@ -154,6 +170,18 @@ elseif (MPI_COMPILE_CMDLINE)
list(APPEND MPI_LINK_PATH ${LPATH})
endforeach(LPATH)
+ if (NOT MPI_LINK_PATH)
+ if (MPI_COMPILER_MAY_HAVE_INCLIBDIRS)
+ # The compile command line didn't have any linking paths on it,
+ # but we may have -showme:libdirs. Use it.
+ exec_program(${MPI_COMPILER}
+ ARGS -showme:libdirs
+ OUTPUT_VARIABLE MPI_LINK_PATH
+ RETURN_VALUE MPI_COMPILER_RETURN)
+ separate_arguments(MPI_LINK_PATH)
+ endif (MPI_COMPILER_MAY_HAVE_INCLIBDIRS)
+ endif (NOT MPI_LINK_PATH)
+
# Extract linker flags from the link command line
string(REGEX MATCHALL "-Wl,([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_FLAGS "${MPI_LINK_CMDLINE}")
set(MPI_LINK_FLAGS_WORK)