From e7c70802d4f2e016e91b46e47cdeabc50c28d509 Mon Sep 17 00:00:00 2001 From: Attila Prokai Date: Wed, 19 Aug 2026 09:15:09 +0200 Subject: [PATCH] cldai: name the static dependencies instead of composing them "cmake: declare target link interfaces explicitly" (0b950dd1) 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 $-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 $ is the first consumer to hit it, so with BUILD_STATIC_LIBS=ON no schema executable links. Reproduced on develop tip - nothing after 0b950dd1 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). --- src/cldai/CMakeLists.txt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/cldai/CMakeLists.txt b/src/cldai/CMakeLists.txt index e37ac06d2..cc9979586 100644 --- a/src/cldai/CMakeLists.txt +++ b/src/cldai/CMakeLists.txt @@ -27,7 +27,16 @@ if(BUILD_SHARED_LIBS) endif() if(BUILD_STATIC_LIBS) - SC_ADDLIB(stepdai-static STATIC SOURCES ${DAI_SRCS} LINK_LIBRARIES $-static) + # Spell the static dependency names out rather than composing them with a + # generator expression. Since 0b950dd1 SC_ADDLIB publishes LINK_LIBRARIES as + # PUBLIC, so anything given here lands in INTERFACE_LINK_LIBRARIES and is + # re-evaluated in each consumer - where a nested $ comes back out + # mangled and reaches the linker verbatim. + set(_static_libdeps) + foreach(_libdep ${_libdeps}) + list(APPEND _static_libdeps ${_libdep}-static) + endforeach() + SC_ADDLIB(stepdai-static STATIC SOURCES ${DAI_SRCS} LINK_LIBRARIES ${_static_libdeps}) endif() # Local Variables: