Skip to content

Commit

Permalink
Do not require OpenMP support for languages other than CXX
Browse files Browse the repository at this point in the history
Specify CXX component when searching for OpenMP so that OpenMP support
is not required for other languages with CMake.

One caveat is that finding the OpenMP dependency downstream will require
CMake minimum version of 3.10

https://cmake.org/cmake/help/latest/module/FindOpenMP.html

Co-Authored-By: Luca Bertagna <lbertag@sandia.gov>
  • Loading branch information
dalg24 and bartgol committed Apr 25, 2024
1 parent 2e82fdd commit d434f87
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cmake/kokkos_tpls.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,13 @@ if (Kokkos_ENABLE_IMPL_MDSPAN AND Kokkos_ENABLE_MDSPAN_EXTERNAL)
endif()

IF (Kokkos_ENABLE_OPENMP)
find_package(OpenMP REQUIRED)
find_package(OpenMP REQUIRED COMPONENTS CXX)
# FIXME_TRILINOS Trilinos doesn't allow for Kokkos to use find_dependency
# so we just append the flags here instead of linking with the OpenMP target.
IF(KOKKOS_HAS_TRILINOS)
COMPILER_SPECIFIC_FLAGS(DEFAULT ${OpenMP_CXX_FLAGS})
ELSE()
KOKKOS_EXPORT_CMAKE_TPL(OpenMP REQUIRED)
KOKKOS_EXPORT_CMAKE_TPL(OpenMP REQUIRED COMPONENTS CXX)
ENDIF()
ENDIF()

Expand Down

0 comments on commit d434f87

Please sign in to comment.