Skip to content

Commit 7be676a

Browse files
committed
ci: fix windows linker error
1 parent 2954bea commit 7be676a

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

CMakeLists.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,16 @@ if(LBUG_API_USE_PRECOMPILED_LIB)
3939
endif()
4040
target_link_libraries(_lbug
4141
PRIVATE
42-
${LBUG_API_PRECOMPILED_LIB_PATH})
42+
${LBUG_API_PRECOMPILED_LIB_PATH}
43+
# lbug_link_deps carries all third-party static libs (utf8proc, re2,
44+
# antlr4, zstd, …) that lbug.lib references but does not bundle on
45+
# Windows. On Linux/macOS the precompiled liblbug.a is a fat archive
46+
# with those objects already merged in, so this is a no-op there.
47+
lbug_link_deps)
48+
# The precompiled lib is always a static archive. Without LBUG_STATIC_DEFINE,
49+
# api.h decorates every LBUG_API symbol with __declspec(dllimport) on Windows,
50+
# which causes LNK2001 unresolved-symbol errors because no DLL is present.
51+
target_compile_definitions(_lbug PRIVATE LBUG_STATIC_DEFINE)
4352
else()
4453
target_link_libraries(_lbug
4554
PRIVATE

0 commit comments

Comments
 (0)