View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0013843 | CMake | Modules | public | 2013-01-10 07:01 | 2016-06-10 14:31 | ||||
Reporter | jgu | ||||||||
Assigned To | Kitware Robot | ||||||||
Priority | normal | Severity | minor | Reproducibility | always | ||||
Status | closed | Resolution | moved | ||||||
Platform | Linux | OS | Fedora | OS Version | 17 | ||||
Product Version | CMake 2.8.9 | ||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0013843: FindMPI doesn't set MPI_C_LINK_FLAGS or MPI_C_COMPILE_FLAGS (and same for CXX) | ||||||||
Description | I have a project which does a find_package(MPI). I use the following snippet to print out all variables: get_cmake_property(_variableNames VARIABLES) foreach (_variableName ${_variableNames}) message(STATUS "${_variableName}=${${_variableName}}") endforeach() which produces for the MPI relevant variables: -- MPIEXEC=/usr/lib64/openmpi/bin/mpiexec -- MPIEXEC_MAX_NUMPROCS=2 -- MPIEXEC_NUMPROC_FLAG=-np -- MPIEXEC_POSTFLAGS= -- MPIEXEC_PREFLAGS= -- MPI_COMPILER=/usr/lib64/openmpi/bin/mpicxx -- MPI_COMPILER_IS_EXECUTABLE=0 -- MPI_CXX_COMPILER=/usr/lib64/openmpi/bin/mpicxx -- MPI_CXX_COMPILE_FLAGS= -- MPI_CXX_FOUND=TRUE -- MPI_CXX_INCLUDE_PATH=/usr/include/openmpi-x86_64 -- MPI_CXX_LIBRARIES=/usr/lib64/openmpi/lib/libmpi_cxx.so;/usr/lib64/openmpi/lib/libmpi.so;/usr/lib64/libdl.so -- MPI_CXX_LINK_FLAGS= -- MPI_C_COMPILER=/usr/lib64/openmpi/bin/mpicc -- MPI_C_COMPILE_FLAGS= -- MPI_C_FOUND=TRUE -- MPI_C_INCLUDE_PATH=/usr/include/openmpi-x86_64 -- MPI_C_LIBRARIES=/usr/lib64/openmpi/lib/libmpi.so;/usr/lib64/libdl.so -- MPI_C_LINK_FLAGS= -- MPI_EXTRA_LIBRARY=/usr/lib64/openmpi/lib/libmpi.so;/usr/lib64/libdl.so -- MPI_EXTRA_LIBRARY_WORK=/usr/lib64/openmpi/lib/libmpi.so;/usr/lib64/libdl.so -- MPI_FOUND=TRUE -- MPI_HEADER_PATH=MPI_HEADER_PATH-NOTFOUND -- MPI_INCLUDE_PATH=/usr/include/openmpi-x86_64 -- MPI_LIB=MPI_LIB-NOTFOUND -- MPI_LIBRARIES=/usr/lib64/openmpi/lib/libmpi_cxx.so;/usr/lib64/openmpi/lib/libmpi.so;/usr/lib64/libdl.so -- MPI_LIBRARY=/usr/lib64/openmpi/lib/libmpi_cxx.so -- MPI_LIBRARY_WORK=/usr/lib64/openmpi/lib/libmpi_cxx.so -- MPI_NUMLIBS=3 -- MpiPackageDir= which shows empty MPI_C_LINK_FLAGS and MPI_C_COMPILE_FLAGS and the same for the equivalent CXX variables. As a result, even though my project has this: set_target_properties(myexec PROPERTIES COMPILE_FLAGS "${MPI_C_COMPILE_FLAGS}" COMPILE_DEFINITIONS "BUILD_WITH_MPI" LINK_FLAGS "${MPI_C_LINK_FLAGS}" ) it fails to link against mpi (-lmpi is missing, for a start). | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | |||||||||
Relationships | |
Relationships |
Notes | |
(0032088) Rolf Eike Beer (developer) 2013-01-10 08:11 |
-lmpi will never show up in link flags. You have MPI_CXX_LIBRARIES and MPI_C_LIBRARIES which you feed into target_link_libraries. I have no idea about the compile flags. |
(0032089) jgu (reporter) 2013-01-10 08:27 |
Yes, I do that already i.e. I have target_link_libraries (myexec "${MPI_C_LIBRARIES"}) in my CMakeLists.txt But, what this does is add the mpi library path as a -L argument, but it doesn't add the needed -lmpi - in the output I posted above, you'll see MPI_C_LIBRARIES=/usr/lib64/openmpi/lib/libmpi.so;/usr/lib64/libdl.so -lmpi is a link time compiler flag, so I am surprised it's not appearing in MPI_C_LINK_FLAGS |
(0032090) Rolf Eike Beer (developer) 2013-01-10 08:37 |
I'm sure you can still find it in your link.txt in the build tree for myexec. |
(0032091) jgu (reporter) 2013-01-10 08:42 |
Nope, it doesn't show up at all in link.txt I'm afraid. |
(0042197) Kitware Robot (administrator) 2016-06-10 14:28 |
Resolving issue as `moved`. This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page. |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
2013-01-10 07:01 | jgu | New Issue | |
2013-01-10 08:11 | Rolf Eike Beer | Note Added: 0032088 | |
2013-01-10 08:27 | jgu | Note Added: 0032089 | |
2013-01-10 08:37 | Rolf Eike Beer | Note Added: 0032090 | |
2013-01-10 08:42 | jgu | Note Added: 0032091 | |
2016-06-10 14:28 | Kitware Robot | Note Added: 0042197 | |
2016-06-10 14:28 | Kitware Robot | Status | new => resolved |
2016-06-10 14:28 | Kitware Robot | Resolution | open => moved |
2016-06-10 14:28 | Kitware Robot | Assigned To | => Kitware Robot |
2016-06-10 14:31 | Kitware Robot | Status | resolved => closed |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |