lethalbit opened PR #13157 from lethalbit:aki/wasmtime-cmake-noinstall to bytecodealliance:main:
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!
lethalbit requested alexcrichton for a review on PR #13157.
lethalbit requested wasmtime-core-reviewers for a review on PR #13157.
github-actions[bot] added the label wasmtime:c-api on PR #13157.
alexcrichton submitted PR review:
Seems reasonable to me, thanks!
alexcrichton added PR #13157 Improve c-api behavior when used as a CMake subproject to the merge queue.
alexcrichton merged PR #13157.
alexcrichton removed PR #13157 Improve c-api behavior when used as a CMake subproject from the merge queue.
Last updated: May 03 2026 at 22:13 UTC