MantisBT - CMake
View Issue Details
0010312CMakeModulespublic2010-02-19 08:452010-06-25 10:46
andreasm 
Brad King 
normalmajoralways
closedduplicate 
CMake-2-8 
 
0010312: FindMPI.cmake fails for path name containing "-l"
Using find_package(MPI) fails on a Linux machine, where the MPI installation is located in a directory containing the string "/mpi-libs/":

CMake Error at [...]/cmake-2.8/Modules/FindMPI.cmake:277 (message):
  Unable to find MPI library ibs/[...]/include

While parsing MPI_LINK_CMDLINE, FindMPI.cmake seems to assume anything after "-l" is a library name, even if no whitespace is preceeding the "-l". Similiar issues might arise with the treatment of "-L" and further compiler/linker option strings.
A quick (and dirty) hack in FindMPI.cmake:

265c265
< string(REGEX MATCHALL "-l([^\" ]+|\"[^\"]+\")" MPI_LIBNAMES "${MPI_LINK_CMDLINE}")
---
> string(REGEX MATCHALL " -l([^\" ]+|\"[^\"]+\")" MPI_LIBNAMES "${MPI_LINK_CMDLINE}")
271c271
< string(REGEX REPLACE "^-l" "" LIB ${LIB})
---
> string(REGEX REPLACE "^ -l" "" LIB ${LIB})

solves the issue my case. Of course, this is no acceptable patch yet.
No tags attached.
duplicate of 0009093closed Brad King FindMPI sometimes fails because it checks for non-existing libraries 
Issue History
2010-02-19 08:45andreasmNew Issue
2010-02-22 17:38James AmundsonNote Added: 0019582
2010-06-25 04:22Marcel LooseNote Added: 0021165
2010-06-25 10:09Bill HoffmanStatusnew => assigned
2010-06-25 10:09Bill HoffmanAssigned To => Brad King
2010-06-25 10:46Brad KingStatusassigned => closed
2010-06-25 10:46Brad KingResolutionopen => duplicate
2010-06-25 10:47Brad KingRelationship addedduplicate of 0009093

Notes
(0019582)
James Amundson   
2010-02-22 17:38   
I hate to say "me, too!", but I am currently experiencing major headaches because of this bug. The only way to work around it is to edit the installed FindMPI.cmake script as suggested above.
(0021165)
Marcel Loose   
2010-06-25 04:22   
This is a duplicate of issue 0009093