[CMake] how to use the FindMPI module correctly?

Alexander Droste alexander.ra.droste at googlemail.com
Fri Apr 3 18:19:09 EDT 2015


Do you mean just using:
target_compile_options(core.x PUBLIC ${MPI_C_COMPILE_FLAGS})

but not:
include_directories(SYSTEM ${MPI_C_INCLUDE_PATH})
link_directories(${MPI_C_LINK_FLAGS})
set(CMAKE_COMPILE_FLAGS ${CMAKE_COMPILE_FLAGS} ${MPI_C_COMPILE_FLAGS})
target_link_libraries(core.x ${MPI_C_LIBRARIES})

Simply using your proposed line seems not to be sufficient. The library 
symbols are not found then.

I believe the variable ${MPI_C_COMPILE_FLAGS} does not contain
anything in my case. Calling message(${MPI_C_COMPILE_FLAGS}) from cmake
gives me an error: "message called with incorrect number of arguments"
Does this mean it's empty? Variables containing flags do not produce 
this error.


On 04.04.15 00:01, Daniel Schepler wrote:
> Would this work?
>
> target_compile_options(core.x PUBLIC ${MPI_C_COMPILE_FLAGS})
>


More information about the CMake mailing list