From 4546bc1bf8e431ec9d85ef19ddb8f5512573ba34 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Thu, 20 Aug 2026 03:19:00 -0300 Subject: [PATCH] Apply MSVC library paths to shared and module linkers too The /libpath flags for the MSVC, UCRT, and Windows SDK x86 libraries were only injected into CMAKE_EXE_LINKER_FLAGS_INIT, so linking a shared library or module produced unresolved externals. Hoist the paths into a local variable and feed it to the EXE, SHARED, and MODULE init flags. Never bit because nothing in the tree builds a shared lib yet. --- cmake/toolchains/clang-cl.cmake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmake/toolchains/clang-cl.cmake b/cmake/toolchains/clang-cl.cmake index e67d584a7..a5a1945f9 100644 --- a/cmake/toolchains/clang-cl.cmake +++ b/cmake/toolchains/clang-cl.cmake @@ -74,5 +74,8 @@ foreach(directory ${_includes}) endforeach() set(CMAKE_RC_FLAGS_INIT "${_rc_flags}") -set(CMAKE_EXE_LINKER_FLAGS_INIT +set(_linker_libpaths "/libpath:${_msvc}/lib/x86 /libpath:${_sdk_lib}/ucrt/x86 /libpath:${_sdk_lib}/um/x86") +set(CMAKE_EXE_LINKER_FLAGS_INIT "${_linker_libpaths}") +set(CMAKE_SHARED_LINKER_FLAGS_INIT "${_linker_libpaths}") +set(CMAKE_MODULE_LINKER_FLAGS_INIT "${_linker_libpaths}")