diff --git a/CMakeLists.txt b/CMakeLists.txt index 72c00118da..bea922075d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -390,7 +390,7 @@ ELSE() IF (KokkosKernels_ENABLE_COMPONENT_SPARSE) KOKKOSKERNELS_ADD_TEST_DIRECTORIES(sparse/unit_test) ENDIF() - IF (KokkosKernels_ENABLE_ALL_COMPONENTS) + IF (KOKKOSKERNELS_ALL_COMPONENTS_ENABLED) IF (KokkosKernels_ENABLE_PERFTESTS) MESSAGE(STATUS "Enabling perf tests.") KOKKOSKERNELS_ADD_TEST_DIRECTORIES(perf_test) @@ -400,13 +400,13 @@ ELSE() KOKKOSKERNELS_ADD_EXAMPLE_DIRECTORIES(example) ENDIF () ELSE () - # ENABLE_ALL_COMPONENTS is OFF, so perftests and examples can't be enabled. + # all components were not enabled, so perftests and examples can't be enabled. # Warn if they were requested. IF (KokkosKernels_ENABLE_PERFTESTS) - MESSAGE(WARNING "Could not enable perf tests because KokkosKernels_ENABLE_ALL_COMPONENTS=OFF") + MESSAGE(WARNING "Could not enable perf tests because not all components were enabled") ENDIF () IF (KokkosKernels_ENABLE_EXAMPLES) - MESSAGE(WARNING "Could not enable examples because KokkosKernels_ENABLE_ALL_COMPONENTS=OFF") + MESSAGE(WARNING "Could not enable examples because not all components were enabled") ENDIF () ENDIF () diff --git a/cmake/kokkoskernels_components.cmake b/cmake/kokkoskernels_components.cmake index f33a62b6ff..56ab1a7c31 100644 --- a/cmake/kokkoskernels_components.cmake +++ b/cmake/kokkoskernels_components.cmake @@ -45,14 +45,6 @@ KOKKOSKERNELS_ADD_OPTION( "Whether to build the graph component. Default: OFF" ) -# The user requested individual components, -# the assumption is that a full build is not -# desired and ENABLE_ALL_COMPONENETS is turned -# off. -IF (KokkosKernels_ENABLE_COMPONENT_BATCHED OR KokkosKernels_ENABLE_COMPONENT_BLAS - OR KokkosKernels_ENABLE_COMPONENT_GRAPH OR KokkosKernels_ENABLE_COMPONENT_SPARSE) - SET(KokkosKernels_ENABLE_ALL_COMPONENTS OFF CACHE BOOL "" FORCE) -ENDIF() # Graph depends on everything else because it depends # on Sparse at the moment, breaking that dependency will @@ -72,13 +64,24 @@ IF (KokkosKernels_ENABLE_COMPONENT_SPARSE) SET(KokkosKernels_ENABLE_COMPONENT_GRAPH ON CACHE BOOL "" FORCE) ENDIF() -# At this point, if ENABLE_ALL_COMPONENTS is -# still ON we need to enable all individual -# components as they are required for this -# build. +# If user requested to enable all components, enable all components IF (KokkosKernels_ENABLE_ALL_COMPONENTS) SET(KokkosKernels_ENABLE_COMPONENT_BATCHED ON CACHE BOOL "" FORCE) SET(KokkosKernels_ENABLE_COMPONENT_BLAS ON CACHE BOOL "" FORCE) SET(KokkosKernels_ENABLE_COMPONENT_SPARSE ON CACHE BOOL "" FORCE) SET(KokkosKernels_ENABLE_COMPONENT_GRAPH ON CACHE BOOL "" FORCE) ENDIF() + +# KOKKOSKERNELS_ALL_COMPONENTS_ENABLED says whether all components are on, +# regardless of how this came to be +# this is in the cache so we can use it as a global variable, +# but marking it as advanced should hide it from GUIs +IF ( KokkosKernels_ENABLE_COMPONENT_BATCHED + AND KokkosKernels_ENABLE_COMPONENT_BLAS + AND KokkosKernels_ENABLE_COMPONENT_GRAPH + AND KokkosKernels_ENABLE_COMPONENT_SPARSE) + SET(KOKKOSKERNELS_ALL_COMPONENTS_ENABLED ON CACHE BOOL "" FORCE) +ELSE() + SET(KOKKOSKERNELS_ALL_COMPONENTS_ENABLED OFF CACHE BOOL "" FORCE) +ENDIF() +mark_as_advanced(FORCE KOKKOSKERNELS_ALL_COMPONENTS_ENABLED) \ No newline at end of file