Hello everyone,
based on the documentation here:
http://www.cmake.org/cmake/help/v3.0/module/FindMPI.html
and posts on SO:
http://stackoverflow.com/questions/23163075/how-to-compile-an-mpi-included-c-program-using-cmake
I'm still not a 100% sure if I set up my CMake project correctly.
This is what I do:
#------------------------
#...
find_package(MPI REQUIRED)
add_executable(core.x main.c)
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})
#-------------------------
Is this the correct way? Am I missing s.th.? I am especially unsure
about the compile flags variable.
At "Usage" (CMake documentation) it said that "To use this module,
simply call FindMPI from a CMakeLists.txt file". So can I break down the
MPI setup to a single command. How do I call FindMPI? Or is it done by
calling find_package like I did?
The program build runs fine but I would like to ensure
that the cmake project is set up as correct and generic as possible.
Greetings,
Alex
--
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