]> https://gitweb.dealii.org/ - dealii.git/commitdiff
CMake: silence the CMAKE_CXX_EXTENSIONS warning when including Kokkos 14723/head
authorMatthias Maier <tamiko@43-1.org>
Wed, 25 Jan 2023 02:35:14 +0000 (20:35 -0600)
committerMatthias Maier <tamiko@43-1.org>
Wed, 25 Jan 2023 02:35:14 +0000 (20:35 -0600)
The CMAKE_CXX_EXTENSIONS variable controls whether CMake sets the
"CXX_EXTENSIONS" property for a target. If this property is set then
CMake ensures that gnu extensions are enabled by default by using
corresponding -std=gnu1X flags instead of -std=cxx1X flags.

Kokkos forcefully disables this variable as soon as FindKOKKOS.cmake is
included with a prominent warning. Thus simply set the variable prior to
including FindKOKKOS.cmake.

On a sidenote - Kokkos' workaround here is not really effective: We
currently do not use the CXX_STANDARD target property but set the
language standard by hand. Thus, the variable is simply ignored.

Also, even if a project happens to use the CMAKE_CXX_STANDARD variable,
this generally doesn't work as the project that includes
FindKOKKOS.cmake can simply override the variable later.

cmake/modules/FindDEAL_II_ARBORX.cmake
cmake/modules/FindDEAL_II_KOKKOS.cmake
cmake/modules/FindDEAL_II_TRILINOS.cmake

index 7ebb9fe32f82a20e45d87b75e7ed0a1ffb15e816..bf3e259889287b5f385f143ff30b6bdd2c35b46f 100644 (file)
@@ -26,7 +26,8 @@
 set(ARBORX_DIR "" CACHE PATH "An optional hint to an ArborX installation")
 set_if_empty(ARBORX_DIR "$ENV{ARBORX_DIR}")
 
-
+# silence a warning when including FindKOKKOS.cmake
+set(CMAKE_CXX_EXTENSIONS OFF)
 find_package(ArborX QUIET
   HINTS ${ARBORX_DIR} ${ArborX_DIR} $ENV{ArborX_DIR}
   )
index 920c8542af6b21efe779d58491c9d60fba7efb46..d305640cfb3095aa08d8499c05100b634f20dd61 100644 (file)
@@ -32,6 +32,9 @@ if(DEAL_II_TRILINOS_WITH_KOKKOS OR DEAL_II_PETSC_WITH_KOKKOS)
   # Let deal.II know that we have found Kokkos
   set(KOKKOS_FOUND ON)
 else()
+
+  # silence a warning when including FindKOKKOS.cmake
+  set(CMAKE_CXX_EXTENSIONS OFF)
   find_package(Kokkos 3.7.0 QUIET
     HINTS ${KOKKOS_DIR} ${Kokkos_DIR} $ENV{Kokkos_DIR}
     )
index 7753f35ad7e643425bbdb686ffe8b4f8d80098ab..a8648c87f856c903441ae0eae6db66f167ff1482 100644 (file)
@@ -32,6 +32,9 @@
 set(TRILINOS_DIR "" CACHE PATH "An optional hint to a Trilinos installation")
 set_if_empty(TRILINOS_DIR "$ENV{TRILINOS_DIR}")
 
+# silence a warning when including FindKOKKOS.cmake
+set(CMAKE_CXX_EXTENSIONS OFF)
+
 #
 # Include the trilinos package configuration:
 #

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.