Skip to content

Commit

Permalink
kokkos: don't repeat CMAKE_CXX_FLAGS when in-tree
Browse files Browse the repository at this point in the history
  • Loading branch information
tom91136 committed Apr 16, 2021
1 parent 9d56b35 commit c2de94e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions kokkos/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ if (KOKKOS_IN_TREE)
message(STATUS "Building using in-tree kokkos source at `${KOKKOS_IN_TREE}`")
if(FORWARD_CXX_EXTRA_FLAGS_TO_KOKKOS)
message(STATUS "Forwarding CXX_EXTRA_FLAGS to Kokkos...")
set(OLD_CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") # save it for now
set(CMAKE_CXX_FLAGS ${CXX_EXTRA_FLAGS})
else()
message(STATUS "Not forwarding CXX_EXTRA_FLAGS to Kokkos by default, set FORWARD_CXX_EXTRA_FLAGS_TO_KOKKOS=ON to override")
Expand Down Expand Up @@ -68,6 +69,10 @@ target_compile_options(bude PUBLIC "$<$<CONFIG:RelWithDebInfo>:${RELEASE_OPTIONS
target_compile_options(bude PUBLIC "$<$<CONFIG:Release>:${RELEASE_OPTIONS}>")
target_compile_options(bude PUBLIC "$<$<CONFIG:Debug>:${DEBUG_OPTIONS}>")

if(DEFINED OLD_CMAKE_CXX_FLAGS) # restore if overwritten before, as required by Kokkos to pick up CXX_EXTRA_FLAGS as CMAKE_CXX_FLAGS
set(CMAKE_CXX_FLAGS ${OLD_CMAKE_CXX_FLAGS})
endif()

target_link_libraries(bude Kokkos::kokkos)

if (${CMAKE_VERSION} VERSION_LESS "3.13.0")
Expand Down

0 comments on commit c2de94e

Please sign in to comment.