# How to set MSVC\_REDIST\_DIR?

**URL:** https://discourse.cmake.org/t/how-to-set-msvc-redist-dir/7056
**Category:** Code
**Tags:** os:windows
**Created:** [December 12, 2022, 8:32pm UTC](https://discourse.cmake.org/t/how-to-set-msvc-redist-dir/7056 "2022-12-12T20:32:24Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![jpfeuffer](https://discourse.cmake.org/user_avatar/discourse.cmake.org/jpfeuffer/32/1529_2.png) [@jpfeuffer](https://discourse.cmake.org/u/jpfeuffer)
#### Post date: [December 12, 2022, 8:32pm UTC](https://discourse.cmake.org/t/how-to-set-msvc-redist-dir/7056/1 "2022-12-12T20:32:24Z")

</div>

Hi,

I want to automatically copy dlls into my install folder with `include(InstallRequiredSystemLibraries)`.  
However, with VS2019, toolset v142, I am getting:

```auto
CMake Warning at C:/Program Files/CMake/share/cmake-3.25/Modules/InstallRequiredSystemLibraries.cmake:625 (message):
  system runtime library file does not exist:
  'MSVC_REDIST_DIR-NOTFOUND/x64/Microsoft.VC142.CRT/msvcp140.dll'
Call Stack (most recent call first):
  cmake/knime_package_support.cmake:63 (include)
  CMakeLists.txt:465 (include)

```

I was trying to debug your module: [https://gitlab.kitware.com/search?group\_id=415&project\_id=541&repository\_ref=master&scope=blobs&search=MSVC\_REDIST\_DIR](https://gitlab.kitware.com/search?group_id=415&project_id=541&repository_ref=master&scope=blobs&search=MSVC_REDIST_DIR)

but the MSVC\_REDIST\_DIR is indeed never set for VS 15+ in your code.  
How is this supposed to work then?

Thanks,  
J

---

<div class="post-metadata">

### Author: ![jpfeuffer](https://discourse.cmake.org/user_avatar/discourse.cmake.org/jpfeuffer/32/1529_2.png) [@jpfeuffer](https://discourse.cmake.org/u/jpfeuffer)
#### Post date: [December 12, 2022, 8:49pm UTC](https://discourse.cmake.org/t/how-to-set-msvc-redist-dir/7056/2 "2022-12-12T20:49:25Z")

</div>

I found out, how it is supposed to work:  
[https://gitlab.kitware.com/cmake/cmake/-/blob/master/Modules/InstallRequiredSystemLibraries.cmake#L317](https://gitlab.kitware.com/cmake/cmake/-/blob/master/Modules/InstallRequiredSystemLibraries.cmake#L317)

But my VC/Redist folder does not have such a .CRT file. Can you guarantee that this is always there?

I have some msms in  
`C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Redist\MSVC\v142\MergeModules\Microsoft_VC142_CRT_x64.msm`  
And the redistributable installers:  
`C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Redist\MSVC\v142\vc_redist.x64.exe`

---

<div class="post-metadata">

### Author: ![jpfeuffer](https://discourse.cmake.org/user_avatar/discourse.cmake.org/jpfeuffer/32/1529_2.png) [@jpfeuffer](https://discourse.cmake.org/u/jpfeuffer)
#### Post date: [December 13, 2022, 11:04am UTC](https://discourse.cmake.org/t/how-to-set-msvc-redist-dir/7056/3 "2022-12-13T11:04:17Z")

</div>

I updated VS via the installer and I now have a `C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Redist\MSVC\14.9xxxxxx` folder that contains more files, including the DLLs.  
Weird…
