Only search for kokkos if it is not already found #2435
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This proposes a partial fix for #2424 Nevertheless, I am not yet sure if we are actually want to go that way
What is the problem:
Kokkos misuses the
component
feature of CMake to specify if the compiler Kokkos defines asCXX_COMPILER
will be launched globally. The default is a global set on everything in the directory. But Kokkos allows to specifyseparable_compilation
as a required component which disables this behavior. Nevertheless, because of the logic that CMake uses to aggregatefind_package/dependency
commands (see here), we overwrite the user choice ifseparable_compilation
was specified.If we guard for an already found Kokkos we allow the user to use the separable compilation feature like:
Alternative solution:
Kokkos sets the compiler only for the current scope ... so putting your kokkos files in a subdirectory with its own targets and link Kokkos in
PRIVATE
mode will allow to compile all other directories how the user prefers. Nevertheless this will not work if Kokkos is exposed in the other directories.What do we need to discuss:
components
in CMake ... Kokkos core should think about if this should stay this way.