Hello, copied from a working MPI CMakeLists.txt:
find_package(MPI REQUIRED) include_directories(${MPI_INCLUDE_PATH}) set(COMPILE_FLAGS ${COMPILE_FLAGS} ${MPI_COMPILE_FLAGS}) set(LINK_FLAGS ${LINK_FLAGS} ${MPI_LINK_FLAGS}) add_executable(StructureSolverParallel "StructureSolver_Parallel/structureDataDisplay.cpp" "StructureSolver_Parallel/StructureSolver.cpp" "StructureSolver_Parallel/structureComputeSolution.cpp") target_link_libraries(StructureSolverParallel PUBLIC ${PRECICE_LIBRARY}) target_link_libraries(StructureSolverParallel PUBLIC ${MPI_LBRARIES}) configuration runs smooth: % cmake -DMPI_CXX_COMPILER=/opt/mpich/bin/mpicxx -DMPI_C_COMPILER=/opt/mpich/bin/mpicc . && make -- The CXX compiler identification is GNU 8.2.0 [...] -- Found MPI_CXX: /opt/mpich/lib/libmpicxx.so (found version "3.1") -- Found MPI: TRUE (found version "3.1") make however: [ 69%] Linking CXX executable StructureSolverParallel /usr/bin/cmake -E cmake_link_script CMakeFiles/StructureSolverParallel.dir/link.txt --verbose=1 /usr/bin/c++ -Wall -Wextra -Wno-unused-parameter -g CMakeFiles/StructureSolverParallel.dir/StructureSolver_Parallel/structureDataDisplay.cpp.o CMakeFiles/StructureSolverParallel.dir/StructureSolver_Parallel/StructureSolver.cpp.o CMakeFiles/StructureSolverParallel.dir/StructureSolver_Parallel/structureComputeSolution.cpp.o -o StructureSolverParallel /home/lindnefn/precice/build/last/libprecice.so /usr/bin/ld: CMakeFiles/StructureSolverParallel.dir/StructureSolver_Parallel/StructureSolver.cpp.o: undefined reference to symbol 'MPI_Init' /usr/bin/ld: /opt/mpich/lib/libmpi.so.12: error adding symbols: DSO missing from command line when I just take the last command line and -lmpi to it, it works. What could be missing there in CMakeLists? Thanks, Florian -- 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: https://cmake.org/mailman/listinfo/cmake