From 2d56274af984c6d661fc38c90fc4cded190cad4f Mon Sep 17 00:00:00 2001 From: "Roscoe A. Bartlett" Date: Tue, 7 Feb 2023 12:03:41 -0700 Subject: [PATCH] WIP: Have Kokkos TriBITS build properly export options to package config files (#11545) Just need to move where tribits_package_decl() is call and call tribits_pkg_export_cache_var() inside of kokkos_option(). --- packages/kokkos/CMakeLists.txt | 8 +++++--- packages/kokkos/cmake/kokkos_functions.cmake | 5 +++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/kokkos/CMakeLists.txt b/packages/kokkos/CMakeLists.txt index 7b78f29d7340..1d8c89daa00f 100644 --- a/packages/kokkos/CMakeLists.txt +++ b/packages/kokkos/CMakeLists.txt @@ -5,13 +5,16 @@ if( "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}" ) message( FATAL_ERROR "FATAL: In-source builds are not allowed. You should create a separate directory for build files and delete CMakeCache.txt." ) endif() +if (COMMAND TRIBITS_PACKAGE_DECL) + TRIBITS_PACKAGE_DECL(Kokkos) +endif() + # We want to determine if options are given with the wrong case # In order to detect which arguments are given to compare against # the list of valid arguments, at the beginning here we need to # form a list of all the given variables. If it begins with any # case of KoKkOS, we add it to the list. - GET_CMAKE_PROPERTY(_variableNames VARIABLES) SET(KOKKOS_GIVEN_VARIABLES) FOREACH (var ${_variableNames}) @@ -270,8 +273,6 @@ IF (KOKKOS_HAS_TRILINOS) $<$:${KOKKOS_ALL_COMPILE_OPTIONS}>) ENDIF() -KOKKOS_PACKAGE_DECL() - #------------------------------------------------------------------------------ # @@ -287,6 +288,7 @@ KOKKOS_PROCESS_SUBPACKAGES() KOKKOS_PACKAGE_DEF() KOKKOS_EXCLUDE_AUTOTOOLS_FILES() +#print_var(${PACKAGE_NAME}_PKG_VARS_TO_EXPORT) KOKKOS_PACKAGE_POSTPROCESS() KOKKOS_CONFIGURE_CORE() diff --git a/packages/kokkos/cmake/kokkos_functions.cmake b/packages/kokkos/cmake/kokkos_functions.cmake index 11fa9b302cc2..936b8363aeb8 100644 --- a/packages/kokkos/cmake/kokkos_functions.cmake +++ b/packages/kokkos/cmake/kokkos_functions.cmake @@ -57,6 +57,11 @@ FUNCTION(kokkos_option CAMEL_SUFFIX DEFAULT TYPE DOCSTRING) # Make sure this appears in the cache with the appropriate DOCSTRING SET(${CAMEL_NAME} ${DEFAULT} CACHE ${TYPE} ${DOCSTRING}) + IF (KOKKOS_HAS_TRILINOS) + #message("-- ${PACKAGE_NAME}: calling TRIBITS_PKG_EXPORT_CACHE_VAR(${CAMEL_NAME})") + TRIBITS_PKG_EXPORT_CACHE_VAR(${CAMEL_NAME}) + ENDIF() + #I don't love doing it this way because it's N^2 in number options, but c'est la vie FOREACH(opt ${KOKKOS_GIVEN_VARIABLES}) STRING(TOUPPER ${opt} OPT_UC)