Hi, I've been having trouble with the detection of the MPI libraries when using intel's MPI compiler wrappers. The issue is that
- The wrappers use /LIBPATH: instead of -L to specify the library search path - The wrappers link against static versions of the mpi libraries without using -l. I'm attaching a couple of patches to deal with this. Are patches to the mailing list still the recommended way to submit changes? Or are pull requests on github preferred? Cheers, Dominic -- Dominic Meiser Tech-X Corporation - 5621 Arapahoe Avenue - Boulder, CO 80303
>From 879532ce66d87d9733e0edca9d54d95823880dff Mon Sep 17 00:00:00 2001 From: Dominic Meiser <[email protected]> Date: Thu, 14 Apr 2016 11:01:43 -0600 Subject: [PATCH 1/2] Accept /LIBPATH for specification of linker paths. The intel MPI wrappers use this form of -L to specify library locations. --- Modules/FindMPI.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake index 0e406e0..0bf5549 100644 --- a/Modules/FindMPI.cmake +++ b/Modules/FindMPI.cmake @@ -357,10 +357,11 @@ function (interrogate_mpi_compiler lang try_libs) endif() # Extract linker paths from the link command line - string(REGEX MATCHALL "(^| |-Wl,)-L([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_PATHS "${MPI_LINK_CMDLINE}") + string(REGEX MATCHALL "(^| |-Wl,)(-L|/LIBPATH:)([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_PATHS "${MPI_LINK_CMDLINE}") set(MPI_LINK_PATH) foreach(LPATH ${MPI_ALL_LINK_PATHS}) string(REGEX REPLACE "^(| |-Wl,)-L" "" LPATH ${LPATH}) + string(REGEX REPLACE "/LIBPATH:" "" LPATH ${LPATH}) string(REPLACE "//" "/" LPATH ${LPATH}) list(APPEND MPI_LINK_PATH ${LPATH}) endforeach() -- 2.6.2.450.g259b5e6
>From 62a9bf47f07b5853a7c857545f243844ab3b5ca6 Mon Sep 17 00:00:00 2001 From: Dominic Meiser <[email protected]> Date: Thu, 14 Apr 2016 11:03:21 -0600 Subject: [PATCH 2/2] Fix for static MPI libraries. The intel MPI compiler wrappers link against static MPI libraries simply by listing the libraries (no `-l`). --- Modules/FindMPI.cmake | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake index 0bf5549..fd9cc19 100644 --- a/Modules/FindMPI.cmake +++ b/Modules/FindMPI.cmake @@ -386,6 +386,13 @@ function (interrogate_mpi_compiler lang try_libs) # Extract the set of libraries to link against from the link command # line string(REGEX MATCHALL "(^| )-l([^\" ]+|\"[^\"]+\")" MPI_LIBNAMES "${MPI_LINK_CMDLINE}") + if(WIN32) + # The intel wrappers on windows link against static versions of the MPI libraries. + # The static libraries are simply listed on the command line without -l. + # For instance: " icl ... impi.lib " + string(REGEX MATCHALL "(^| )([^\" ]+)\\.lib" tmp "${MPI_LINK_CMDLINE}") + list(APPEND MPI_LIBNAMES ${tmp}) + endif() # add the compiler implicit directories because some compilers # such as the intel compiler have libraries that show up @@ -400,6 +407,10 @@ function (interrogate_mpi_compiler lang try_libs) # to link against in an MPI program foreach(LIB ${MPI_LIBNAMES}) string(REGEX REPLACE "^ ?-l" "" LIB ${LIB}) + if(WIN32) + string(REGEX REPLACE "\\.lib$" "" LIB ${LIB}) + endif() + string(STRIP ${LIB} LIB) # MPI_LIB is cached by find_library, but we don't want that. Clear it first. set(MPI_LIB "MPI_LIB-NOTFOUND" CACHE FILEPATH "Cleared" FORCE) find_library(MPI_LIB NAMES ${LIB} HINTS ${MPI_LINK_PATH}) -- 2.6.2.450.g259b5e6
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers
