[flang-commits] [flang] [clang] [flang][windows] Add option to link against specific MSVC CRT (PR #70833)

Brad King via flang-commits flang-commits at lists.llvm.org
Wed Nov 1 06:13:07 PDT 2023


================
@@ -53,3 +53,26 @@ add_flang_library(FortranDecimal INSTALL_WITH_TOOLCHAIN
   binary-to-decimal.cpp
   decimal-to-binary.cpp
 )
+
+if (DEFINED MSVC)
+  set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded)
----------------
bradking wrote:

`add_flang_library` eventually ends up in `llvm/cmake/modules/AddLLVM.cmake`'s `llvm_add_library` which calls `add_library(${name} STATIC ...)`.  All `CMAKE_MSVC_RUNTIME_LIBRARY` does is initialize the `MSVC_RUNTIME_LIBRARY` property on that target when it is created.

You should be able to do

```cmake
add_flang_library(FortranDecimal.static ...)
set_property(TARGET FortranDecimal.static PROPERTY MSVC_RUNTIME_LIBRARY MultiThreaded)
```


https://github.com/llvm/llvm-project/pull/70833


More information about the flang-commits mailing list