[cmake] Allow users to link against onemath_<domain>_<backend> targets #627
+377
−428
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.
Description
The goal of this PR is to allow users to integrate oneMath in their application with compile-time dispatching, only by linking against onemath__ targets. With the current CMake this would fail to compile due to missing include directories and linking libraries unless users manually add the dependencies or set up environment variables. This makes it easier for users.
To show this I have also updated the example's CMake to simplify them and make sure they only rely on
target_link_libraries
to get the oneMath library dependencies.Other changes:
onemath
.install(TARGETS ${LIB_OBJ} ...)
. These target pollute the outputted oneMathTargets.cmake file and end up requiring more CMake targets such as ONEMATH::cublas targets which are not useful to users. With these changes${LIB_NAME}
targets link${LIB_OBJ}
targets privately so it is not needed to install them anymore.These are only CMake changes so I think the review from onemath-arch-write is enough but more feedback is welcomed.
Checklist
All Submissions