[PATCH] D77162: libclc: Fix LLVM library linking on Windows

Daniel Stone via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 3 05:53:02 PDT 2020


daniels added a comment.

In D77162#1958296 <https://reviews.llvm.org/D77162#1958296>, @jvesely wrote:

> In D77162#1957318 <https://reviews.llvm.org/D77162#1957318>, @daniels wrote:
>
> > I could test `llvm-config --shared-mode == static && WIN32` to apply `/MT`, as I tried various other methods of convincing Windows to link statically and not dynamically with no luck. On UNIX this isn't an issue as you can happily mix the two modes.
>
>
> I'm not sure I fully understand. windows doesn't allow mixing .lib a and .dll libraries?
>  a superficial search suggests that /MT instructs the linker to use the static-multithreaded version of runtime libs [0]. Other than using the same threaded runtime we should be able to mix static and dynamic libraries, no?
>
> is the `/MT` flag included in LLVM_LINKER_FLAGS?
>  maybe we just need `set_target_link_options( prepare_builtins ${LLVM_LINKER_FLAGS)` or `set_target_properties( prepare_bultins LINK_FLAGS ${LLVM_LINKER_FLAGS} )`


No, you're totally right, I was misled by the error message. We can just drop this anyway, and if the user specifies that they want LLVM to link with `/MT`, they can pass `-DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded` to the libclc build. (I missed this as libclc can't build with the Visual Studio CMake backend, only the Ninja backend ...)

I'll just drop this hunk entirely, and the patch becomes a lot smaller. :)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77162/new/

https://reviews.llvm.org/D77162





More information about the llvm-commits mailing list