Repository navigation
feat(deps-cmake): build_shared_libs passes BUILD_SHARED_LIBS to the subproject - #63
Open
NopeCharon wants to merge 1 commit into
Open
NopeCharon wants to merge 1 commit into
NopeCharon wants to merge 1 commit into
Conversation
…ubproject `options::shared` only tells mcpp what the subproject installs -- which library file names to link and whether the prefix's shared-library directory reaches `mcpp run` and `mcpp pack`. It never reached CMake, so a subproject that follows CMake's convention and leaves the kind of library to `BUILD_SHARED_LIBS` still built static archives, and the link then failed on a `lib<name>.so` that was never produced. The only way out was a hand-written `-DBUILD_SHARED_LIBS=ON` in `cache_args`. `options::build_shared_libs` (a `std::optional<bool>`) states it: - unset, the default, passes nothing, so every existing build program configures, and keys its installation, exactly as before; - `true` or `false` passes `-DBUILD_SHARED_LIBS=ON` or `OFF` to the configure step. The argument is part of the recipe, so an installation built shared and one built static have different cache keys; - together with a `BUILD_SHARED_LIBS` in `cache_args` (joined, spaced or typed) the member refuses, naming both, and declares nothing, rather than silently letting one of two contradictory statements win. `shared` keeps its meaning; the two are separate statements that usually agree. Tests: - plugin-logic gains four cases: ON reaches the configure step and the key, OFF reaches the configure step, unset passes nothing even with `shared = true`, and the conflict is refused with its reason and no action. They do not compile without this change; with it 56 of 56 cases pass. - The cmake-consumer fixture's library no longer hard-codes SHARED: it is built shared because the build program sets `build_shared_libs = true`, and check-deps-and-qt.sh asserts BUILD_SHARED_LIBS=ON in the subproject's CMakeCache.txt. Without the option the fixture fails to link its missing libgreet.so, so the lane now exercises the option end to end. docs/deps.md lists the option in the deps-cmake table. Closes mcpp-community#50
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.
Closes #50.
options::sharedonly tells mcpp what a CMake subproject installs: which library file names to link, and whether the prefix's shared-library directory reachesmcpp runandmcpp pack. It never reaches CMake. So a subproject that follows CMake's convention and letsBUILD_SHARED_LIBSdecide the library kind still builds static archives, and the link then fails on alib<name>.sothat was never built. The only workaround was a hand-written-DBUILD_SHARED_LIBS=ONincache_args.This adds
options::build_shared_libs, astd::optional<bool>:true/false: passes-DBUILD_SHARED_LIBS=ON/OFFto the configure step. The argument is part of the recipe, so a shared build and a static build get different installation cache keys.cache_args: ifcache_argsdefinesBUILD_SHARED_LIBStoo (joined, spaced or typed), the member refuses with a message naming both and declares no action. Neither of the two conflicting values wins silently.sharedkeeps its meaning. The two options are separate, and they usually agree.docs/deps.mdlists the new option in thedeps-cmaketable.Tests
plugin-logichas four new cases:ONreaches both the configure step and the key's recipe.OFFreaches the configure step.shared = true.cmake-consumerfixture'sgreetlibrary no longer hard-codesSHARED. It is built shared because the build program setsbuild_shared_libs = true.check-deps-and-qt.sh cmake-consumernow checks forBUILD_SHARED_LIBS=ONin the subproject'sCMakeCache.txt. That lane now tests the option end to end on every host.Validation (Linux aarch64, mcpp 2026.11.7.1, its default LLVM toolchain)
check-deps-and-qt.sh plugin-logic: 52 of 52 onmain. With only the new cases applied, the build program fails to compile (no member named 'build_shared_libs'). With the change: 56 of 56.check-deps-and-qt.sh cmake-consumer: passes. The installation holdslib/libgreet.so, and every existing assertion in the function still passes (no re-run, rebuild after an edit, re-run after an added file).xim:cmakehas no aarch64 artifact, so this run pointed[xlings.overrides]at a local CMake 4.4.5; that change was not committed.build_shared_libs = trueline removed fails to link (no such file or directory: .../install/lib/libgreet.so). So the fixture really depends on the option.