[cmake] refactor: shared/static handling #6481
Open
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 significantly redoes the way shared and static libraries are
handled. Now, it's controlled by two options:
SPIRV_TOOLS_BUILD_STATICand
SPIRV_TOOLS_BUILD_SHARED.The default configuration (no
BUILD_SHARED_LIBSset, options left atdefault) is to build shared ONLY if this is the master project, or
static ONLY if this is a subproject (e.g. FetchContent, CPM.cmake). Also
I should note that static-only (i.e. no shared) is now a supported
target, this is done because projects including it as a submodule e.g.
on Android or Windows may prefer this.
Now the shared/static handling:
.alibraries..alibraries, but alsolibSPIRV-Tools.so.solibraries.Notable TODOs:
to use in the case of distributions that distribute both types (MSYS2
for instance)?
user, so the optimal solution may indeed be doing absolutely
nothing. CMake is unaffected :)
This is going to change things a good bit for package maintainers, but
cest la vie. It's for the greater good, I promise.
Signed-off-by: crueter [email protected]