Repository navigation
Explain shared and static builds, and honor BUILD_SHARED_LIBS from the parent project - #552
Merged
Merged
Conversation
Describe BUILD_SHARED_LIBS, the NODE_EDITOR_* definitions that the library sets, and why users must not define them. Note that Qt stays a dependency and that a plain set() does not reach add_subdirectory. Fix the BUILD_TESTING and BUILD_EXAMPLES defaults. Add an FAQ entry.
With policy CMP0077 at the old behavior, option() removes a normal variable set by the parent. So set(BUILD_SHARED_LIBS OFF) before add_subdirectory was ignored, and QtNodes was built shared. Set CMP0077 to NEW. This needs CMake 3.13, so raise the minimum from 3.11 to 3.13. This is safe: Qt 6 needs CMake 3.16 anyway. Update the CMake version in README.rst and docs. Update the docs to say that a plain set() works.
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.
Type of change
Description
Two commits, one for the docs and one for the build file.
docs/getting-started/installation.rst, a pointer in the README, and a FAQ entry for the error "Cannot link against shared and static simultaneously" (NODE_EDITOR_SHARED added to target public definition #409). It says that QtNodes definesNODE_EDITOR_SHAREDorNODE_EDITOR_STATICfor its users, that users must not define them (orNODE_EDITOR_EXPORTS) themselves, and that a static QtNodes still needs Qt. It also fixes the default ofBUILD_TESTINGandBUILD_EXAMPLESin the options table:ONfor a top-level project,OFFwithadd_subdirectory.BUILD_SHARED_LIBSset by the parent project. With policy CMP0077 at the old behavior,option()removes a normal variable set by the parent. Soset(BUILD_SHARED_LIBS OFF)beforeadd_subdirectory(nodeeditor)was ignored, and QtNodes was built shared. The fix sets CMP0077 to NEW. That needs CMake 3.13, so the minimum goes from 3.11 to 3.13. The docs now say that a plainset()works.Testing
set(BUILD_SHARED_LIBS OFF)beforeadd_subdirectorynow builds a staticlibQtNodes.a. A plainset(... ON), the cache form,-DBUILD_SHARED_LIBS=OFFand no setting all behave as expected.cmake --installfor a shared and a static build, andfind_package(QtNodes)from a consumer. Both work, and the consumer gets the right macro.Breaking changes?
No API change. Two points for the release notes:
set(BUILD_SHARED_LIBS OFF)got a shared QtNodes without knowing. It now gets a static one, as documented.Related issue
Related to #409 and #256 (both closed).