Improve c-api behavior when used as a CMake subproject#13157
Open
lethalbit wants to merge 1 commit intobytecodealliance:mainfrom
Open
Improve c-api behavior when used as a CMake subproject#13157lethalbit wants to merge 1 commit intobytecodealliance:mainfrom
lethalbit wants to merge 1 commit intobytecodealliance:mainfrom
Conversation
This commit adds one new CMake option and changes the default behavior when being used as a subproject. First, off, the `WASMTIME_ALWAYS_INSTALL` option was added, to override the new behavior and keep it working like it was previously. Next, we check to see if the wasmtime cmake project is being used as a subproject (e.g. it was loaded up with `add_subdirectory`) if so, then we disable the installation of the headers and static library artifacts. However if `BUILD_SHARED_LIBS` is enabled, even as a subproject we always install the shared object artifact. If `WASMTIME_ALWAYS_INSTALL` is set, then regardless we install everything as before.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Hey it's me again!
I expect a bit of deliberation on this as it changes some default behaviour, and could likely be massaged a bit to be a bit better in a way that I'm likely not thinking of, but here's the gist.
This PR adds one new CMake option and changes the default behavior when being used as a subproject.
First, off, the
WASMTIME_ALWAYS_INSTALLoption was added, to override the new behavior and keep it working like it was previously.Next, we check to see if the wasmtime cmake project is being used as a subproject (e.g. it was loaded up with
add_subdirectory) if so, then we disable the installation of the headers and static library artifacts. However ifBUILD_SHARED_LIBSis enabled, even as a subproject we always install the shared object artifact. IfWASMTIME_ALWAYS_INSTALLis set, then regardless we install everything as before.If keeping old behaviour as a default is prefered, then it would be easy enough to flip things around and rename
WASMTIME_ALWAYS_INSTALLand have it turn-off installing things when being used as a subproject. I know changing defaults out from under people is not very nice, but my personal opinion on this is that this is generally how well-behaved subprojects are expected to act anyway.Either way, look forward to your feedback and thoughts!