Verified Commit 9795bf7b authored by Tommaso Tocci's avatar Tommaso Tocci Committed by Marc Vef
Browse files

tests: fix linking for mpi test

the MPI::MPI_CXX imported target only works for CMake > 3.9

In the case we are using a prior version we need to set include paths
and link libraries manually.
parent 2db000c8
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -22,5 +22,11 @@ find_package(MPI)
if(${MPI_FOUND})
    set(SOURCE_FILES_MPI main_MPI.cpp)
    add_executable(ifs_test_MPI ${SOURCE_FILES_MPI})
    target_link_libraries(ifs_test_MPI MPI::MPI_CXX)
    if(TARGET MPI::MPI_CXX)
        # should be defined for CMAKE > 3.9
        target_link_libraries(ifs_test_MPI MPI::MPI_CXX ${MPI_LIBRARIES})
    else()
        target_link_libraries(ifs_test_MPI ${MPI_CXX_LIBRARIES})
        target_include_directories(ifs_test_MPI PUBLIC ${MPI_CXX_INCLUDE_PATH})
    endif()
endif()
 No newline at end of file