Fix the static library build: a generator expression leaks into the link line - #482
Merged
starseeker merged 1 commit intoAug 21, 2026
Merged
Conversation
"cmake: declare target link interfaces explicitly" (0b950dd) made SC_ADDLIB publish its LINK_LIBRARIES as PUBLIC. That is the right change, but it is not compatible with the way src/cldai/CMakeLists.txt names its static dependency: SC_ADDLIB(stepdai-static STATIC SOURCES ${DAI_SRCS} LINK_LIBRARIES $<JOIN:${_libdeps},-static >-static) _libdeps holds one entry, steputils, so the generator expression is an elaborate way of writing steputils-static. While the dependency was linked privately it expanded once, on the link line of stepdai-static, and was correct. Published as PUBLIC it lands in INTERFACE_LINK_LIBRARIES and is evaluated again in every consumer, where it comes back out mangled and reaches the linker verbatim: LINK : fatal error LNK1104: cannot open file $<JOIN:steputils,-static.obj p21read_sdai_<schema> is the first consumer to hit it, so with BUILD_STATIC_LIBS=ON no schema executable links. Reproduced on develop tip - nothing after 0b950dd touches either file, so the static build is broken there too. Building the list with a foreach costs nothing, reads the same, and keeps working if _libdeps ever grows. The shared branch is untouched; this is inside if(BUILD_STATIC_LIBS).
Member
|
BRL-CAD failures are on the brlcad side. |
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.
With
BUILD_STATIC_LIBS=ON,developdoes not build.src/cldai/CMakeLists.txtcomposes its static dependency name with a generator expression:_libdepsholds one entry,steputils, so this is an elaborate way of writingsteputils-static. While the dependency was linked privately it expanded once, on the link line ofstepdai-static, and was correct. Since 0b950dd (cmake: declare target link interfaces explicitly)SC_ADDLIBpublishesLINK_LIBRARIESasPUBLIC, so it lands inINTERFACE_LINK_LIBRARIESand is re-evaluated in every consumer — where the nested$<JOIN:...>comes back out mangled and reaches the build tool verbatim.Reproduced on 8a228eb with no schemas configured at all:
and the offending line ends in:
With the Visual Studio generator the same thing surfaces later, at link time, once a schema executable is the first consumer to pick up the interface:
Building the list with a
foreachcosts nothing, reads the same, and keeps working if_libdepsever grows. The shared branch is untouched — this is insideif(BUILD_STATIC_LIBS). It is the only$<JOIN:in the tree.After the change the same configuration builds all 204 targets.