# MSVC\_RUNTIME\_LIBRARY ignored on command line

**URL:** https://discourse.cmake.org/t/msvc-runtime-library-ignored-on-command-line/1644
**Category:** Usage
**Created:** [July 30, 2020, 3:10am UTC](https://discourse.cmake.org/t/msvc-runtime-library-ignored-on-command-line/1644 "2020-07-30T03:10:55Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![SpareSimian](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/s/46a35a/32.png) [@SpareSimian](https://discourse.cmake.org/u/SpareSimian)
#### Post date: [July 30, 2020, 3:10am UTC](https://discourse.cmake.org/t/msvc-runtime-library-ignored-on-command-line/1644/1 "2020-07-30T03:10:55Z")

</div>

I’m trying to build [libtiff](https://gitlab.com/libtiff/libtiff) on Win32 as a static library with static runtime linkage. I can’t seem to get the project to change the runtime library to static. Here’s my commands:

```
cd g:\devel\libtiff_out
cmake.exe -G "Visual Studio 14 2015" -D BUILD_SHARED_LIBS=OFF -D CMAKE_POLICY_DEFAULT_CMP0091=NEW -D MSVC_RUNTIME_LIBRARY="MultiThreaded$<$<CONFIG:Debug>:Debug>" -s g:\devel\libtiff 

```

At the end I see “CMake Warning: Manually-specified variables were not used by the project: MSVC\_RUNTIME\_LIBRARY”

The Visual Studio project files still have the DLL version of the runtime libraries selected.

How do I get the setting to apply?

I’m using CMake 3.18. Here’s the doc page on this setting:

[https://cmake.org/cmake/help/latest/prop\_tgt/MSVC\_RUNTIME\_LIBRARY.html](https://cmake.org/cmake/help/latest/prop_tgt/MSVC_RUNTIME_LIBRARY.html)

---

<div class="post-metadata">

### Author: ![fdk17](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/f/ea666f/32.png) [@fdk17](https://discourse.cmake.org/u/fdk17)
#### Post date: [July 30, 2020, 1:23pm UTC](https://discourse.cmake.org/t/msvc-runtime-library-ignored-on-command-line/1644/2 "2020-07-30T13:23:50Z")

</div>

[https://cmake.org/cmake/help/latest/variable/CMAKE\_MSVC\_RUNTIME\_LIBRARY.html](https://cmake.org/cmake/help/latest/variable/CMAKE_MSVC_RUNTIME_LIBRARY.html)  
[https://cmake.org/cmake/help/latest/prop\_tgt/MSVC\_RUNTIME\_LIBRARY.html](https://cmake.org/cmake/help/latest/prop_tgt/MSVC_RUNTIME_LIBRARY.html)

The variable `CMAKE_MSVC_RUNTIME_LIBRARY` can be used to set the target property `MSVC_RUNTIME_LIBRARY`.

Your command should use `CMAKE_MSVC_RUNTIME_LIBRARY`.

---

<div class="post-metadata">

### Author: ![SpareSimian](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/s/46a35a/32.png) [@SpareSimian](https://discourse.cmake.org/u/SpareSimian)
#### Post date: [July 30, 2020, 3:21pm UTC](https://discourse.cmake.org/t/msvc-runtime-library-ignored-on-command-line/1644/3 "2020-07-30T15:21:20Z")

</div>

Thanks, that solved the problem. Is there some documentation that explains the relationship between a command line variable and a target property?

---

<div class="post-metadata">

### Author: ![fdk17](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/f/ea666f/32.png) [@fdk17](https://discourse.cmake.org/u/fdk17)
#### Post date: [July 30, 2020, 3:37pm UTC](https://discourse.cmake.org/t/msvc-runtime-library-ignored-on-command-line/1644/4 "2020-07-30T15:37:56Z")

</div>

I just search for it in the documentation. Typically if there is a property then there is a variable that sets up any defaults for that property. It might be missed because the documentation for the property doesn’t link back to the variable.

For example the link for `CMAKE_MSVC_RUNTIME_LIBRARY` states:  
Select the MSVC runtime library for use by compilers targeting the MSVC ABI. This variable is used to initialize the [`MSVC_RUNTIME_LIBRARY`](https://cmake.org/cmake/help/latest/prop_tgt/MSVC_RUNTIME_LIBRARY.html#prop_tgt:MSVC_RUNTIME_LIBRARY) property on all targets as they are created. It is also propagated by calls to the [`try_compile()`](https://cmake.org/cmake/help/latest/command/try_compile.html#command:try_compile) command into the test project.
