[CMake] MSMPI (v6) and cmake 3.4.3

P Chakraborty pchakraborty at gmail.com
Fri Feb 26 15:42:17 EST 2016


Hi,

I have a Fortran project that needs to link to Microsft's MPI libraries -
msmpi.lib and msmpifec.lib but the MPI_Fortran_LIBRARIES variable returned
by FindMPI listst just the first one. As a result, my CMakeLists.txt looks
like

cmake_minimum_required(VERSION 2.8)

project(ExampleMPI Fortran)

find_package(MPI REQUIRED)

include_directories(${MPI_Fortran_INCLUDE_PATH})
include_directories(${MPI_Fortran_INCLUDE_PATH}/x64) # mpifptr.h

add_executable(exmpi test.f90)
# MS MPI requires two libraries to be linked - msmpi.lib and msmpifec.lib
# Currently, cmake only returns the location of msmpi.lib in
# MPI_Fortran_LIBRARIES. So, we need to manually add msmpifec.lib
get_filename_component(mpi_lib_dir ${MPI_Fortran_LIBRARIES} DIRECTORY)
target_link_libraries(ssmpi ${MPI_Fortran_LIBRARIES}
${mpi_lib_dir}/msmpifec.lib)

Shouldn't the locations of both those libraries be included in
MPI_Fortran_LIBRARIES?

Thank you,
Purnendu.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160226/fdb47cd8/attachment.html>


More information about the CMake mailing list