# InstallRequiredSystemLibraries fails to detect clang on Windows

**URL:** https://discourse.cmake.org/t/installrequiredsystemlibraries-fails-to-detect-clang-on-windows/8447
**Category:** Code
**Tags:** os:windows, comp:clang
**Created:** [July 2, 2023, 2:21pm UTC](https://discourse.cmake.org/t/installrequiredsystemlibraries-fails-to-detect-clang-on-windows/8447 "2023-07-02T14:21:36Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![andreasxp](https://discourse.cmake.org/user_avatar/discourse.cmake.org/andreasxp/32/3579_2.png) [@andreasxp](https://discourse.cmake.org/u/andreasxp)
#### Post date: [July 2, 2023, 2:21pm UTC](https://discourse.cmake.org/t/installrequiredsystemlibraries-fails-to-detect-clang-on-windows/8447/1 "2023-07-02T14:21:36Z")

</div>

Clang on Windows (not clang on MinGW) uses the same MSVC libraries as MSVC itself. However, when I included `InstallRequiredSystemLibraries`, the necessary msvc DLLs were not properly installed.

Looking into `InstallRequiredSystemLibraries.cmake`, the code for msvc dlls is hidden behind an `if(MSVC)` condition which is false set when using clang because `MSVC` variable is not set.

For reference, this is the code I’m using to install my application on Windows. It works with MSVC and does not work with clang.

```auto
include(InstallRequiredSystemLibraries)
install(TARGETS application)
install(IMPORTED_RUNTIME_ARTIFACTS application RUNTIME_DEPENDENCY_SET application_RUNTIME_DEPENDENCY_SET)
set(system32_regex "^$ENV{SystemRoot}\\system32")
string(REPLACE "\\" "[\\/\\\\]" system32_regex "${system32_regex}")
install(RUNTIME_DEPENDENCY_SET application_RUNTIME_DEPENDENCY_SET
	PRE_EXCLUDE_REGEXES "api-ms-.*"
	POST_EXCLUDE_REGEXES "${system32_regex}"
)

```

Can someone more experienced than me confirm if this is a CMake bug or not? Is there any workaround for this (besides switching to MSVC compiler)?
