The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=13843 
====================================================================== 
Reported By:                jgu
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   13843
Category:                   Modules
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2013-01-10 07:01 EST
Last Modified:              2013-01-10 07:01 EST
====================================================================== 
Summary:                    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).

====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2013-01-10 07:01 jgu            New Issue                                    
======================================================================

--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Reply via email to