MantisBT - CMake
View Issue Details
0012874CMakeModulespublic2012-01-15 14:432012-09-03 16:01
Mourad 
Brad King 
normalmajoralways
closedfixed 
Windows
CMake 2.8.7 
CMake 2.8.8CMake 2.8.8 
0012874: Bug in FindMPI.cmake under Windows
I get a link problem when linking to MPI libraries found by FindMPI.cmake. The error I get is :

LINK : fatal error LNK1104: cannot open file 'C:\Program Files\MPICH2\lib\mpi.lib C:\Program Files\MPICH2\lib\cxx.lib'

The problem is caused by line 416 of FindMPI.cmake, a "patch" is also given below.

Line 416 :

- set(MPI_LIBRARIES_WORK "${MPI_LIBRARIES_WORK} ${MPI_LIB}")
+ set(MPI_LIBRARIES_WORK "${MPI_LIBRARIES_WORK};${MPI_LIB}")
Just try to build this empty main.cpp with the provided CMakeLists.txt

CMakeLists.txt :

cmake_minimum_required(VERSION 2.8)
project(test_mpi)
find_package(MPI)
add_executable(test_mpi main.cpp)
target_link_libraries(test_mpi ${MPI_LIBRARIES})

main.cpp :

int main()
{
  return 0;
}
MPI installed from http://www.mcs.anl.gov/research/projects/mpich2/downloads/index.php?s=downloads [^]
No tags attached.
Issue History
2012-01-15 14:43MouradNew Issue
2012-01-16 09:06Brad KingNote Added: 0028316
2012-01-16 09:06Brad KingAssigned To => Brad King
2012-01-16 09:06Brad KingStatusnew => assigned
2012-01-16 09:23MouradNote Added: 0028318
2012-01-16 09:28Brad KingNote Added: 0028319
2012-01-16 09:28Brad KingStatusassigned => resolved
2012-01-16 09:28Brad KingFixed in Version => CMake 2.8.8
2012-01-16 09:28Brad KingResolutionopen => fixed
2012-04-19 15:44David ColeTarget Version => CMake 2.8.8
2012-09-03 16:01David ColeNote Added: 0030874
2012-09-03 16:01David ColeStatusresolved => closed

Notes
(0028316)
Brad King   
2012-01-16 09:06   
Does this patch work?

-          set(MPI_LIBRARIES_WORK "${MPI_LIBRARIES_WORK} ${MPI_LIB}")
+          list(APPEND MPI_LIBRARIES_WORK ${MPI_LIB})
(0028318)
Mourad   
2012-01-16 09:23   
it works, too.
(0028319)
Brad King   
2012-01-16 09:28   
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=87737e62 [^]
(0030874)
David Cole   
2012-09-03 16:01   
Closing resolved issues that have not been updated in more than 4 months.