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.dro...@googlemail.com] Sent: Friday, April 03, 2015 3:19 PM To: Daniel Schepler Cc: cmake@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}) > -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake