[CMake] how to use the FindMPI module correctly?
Daniel Schepler
dschepler at scalable-networks.com
Fri Apr 3 18:28:38 EDT 2015
I mean replacing the set CMAKE_COMPILE_FLAGS line with my target_compile_options line.
As for the message call, I usually use something more like: message(STATUS "MPI_C_COMPILE_FLAGS = ${MPI_C_COMPILE_FLAGS}") for debugging.
--
Daniel
________________________________________
From: Alexander Droste [alexander.ra.droste at googlemail.com]
Sent: Friday, April 03, 2015 3:19 PM
To: Daniel Schepler
Cc: cmake at cmake.org
Subject: Re: [CMake] how to use the FindMPI module correctly?
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