cmake: Add install rules and option to use submodule dependencies #356
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.
Package ecosystems that know how to install CMake projects can now package nanobind for distribution without using submodule'd dependencies.
nanobind does not install any compiled library artifacts. Instead, all necessary source files and supporting CMake files are installed to build nanobind within another CMake project.
A CMake user can now adjust the CMake option
NB_USE_SUBMODULE_DEPS
to choose whether nanobind will use and/or install the submodule'd external dependencies. This isON
by default, allowing nanobind's CMake logic to continue operating as it did previously.Another CMake option was introduced,
NB_CREATE_INSTALL_RULES
, to allow users to choose whether to enable or disable the installation rules. Notably, if nanobind is added to a CMake project withadd_subdirectory
, the installation rules are disabled, because installing source files probably isn't the expected result of the parent project(s). Install-rule generation still respects the standard CMakeCMAKE_SKIP_INSTALL_RULES
variable.