From b95e0dbf7a8ea65ae0a60e0f1cc3e49227108fd2 Mon Sep 17 00:00:00 2001 From: Kevin Huck Date: Fri, 22 Mar 2024 13:18:10 -0400 Subject: [PATCH] Adding OpenMP library when linking against Kokkos unit test with OpenMP back end. --- src/unit_tests/Kokkos/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/unit_tests/Kokkos/CMakeLists.txt b/src/unit_tests/Kokkos/CMakeLists.txt index 530b460d..39c86f5e 100644 --- a/src/unit_tests/Kokkos/CMakeLists.txt +++ b/src/unit_tests/Kokkos/CMakeLists.txt @@ -16,9 +16,11 @@ foreach(example_program ${example_programs}) set(sources ${example_program}.cpp) source_group("Source Files" FILES ${sources}) add_executable("${example_program}_kokkos" ${sources}) - target_link_libraries ("${example_program}_kokkos" apex ${Kokkos_LIBRARY} ${LIBS}) if (OPENMP_FOUND) set_target_properties("${example_program}_kokkos" PROPERTIES COMPILE_FLAGS ${OpenMP_CXX_FLAGS}) + target_link_libraries ("${example_program}_kokkos" apex ${Kokkos_LIBRARY} ${LIBS} OpenMP::OpenMP_CXX) + else (OPENMP_FOUND) + target_link_libraries ("${example_program}_kokkos" apex ${Kokkos_LIBRARY} ${LIBS}) endif (OPENMP_FOUND) add_dependencies ("${example_program}_kokkos" apex) add_dependencies (tests "${example_program}_kokkos")