summaryrefslogtreecommitdiffstats
path: root/Modules/FindMPI.cmake
diff options
context:
space:
mode:
authorDouglas Gregor <doug.gregor@gmail.com>2008-04-22 13:41:07 (GMT)
committerDouglas Gregor <doug.gregor@gmail.com>2008-04-22 13:41:07 (GMT)
commitcecb98c618fca155cf420040d74aa7ec1e70453e (patch)
treea224eb7f2f803c2db3264c6f2aeea27af738cf19 /Modules/FindMPI.cmake
parenta97a1426c0e7ea7016c2a28cd706b26bd90aaa43 (diff)
downloadCMake-cecb98c618fca155cf420040d74aa7ec1e70453e.zip
CMake-cecb98c618fca155cf420040d74aa7ec1e70453e.tar.gz
CMake-cecb98c618fca155cf420040d74aa7ec1e70453e.tar.bz2
BUG: Use -showme:incdirs and -showme:libdirs when we need them
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)