InstallRequiredSystemLibraries doesn't set MSVC_REDIST_DIR with VS2019 IDE and v141 toolset specified
Background info
- CMake Gui 3.14.6 for Windows downloaded from Cmake.org/download.
- Visual Studio Community 2019 16.1.6
- with MSVC 141 - VS 2017 C++ x64/x86 build tools and the MSVC v140 - VS 2015 C++ build tools
I configure a project with Visual Studio 16 2019 as the generator and specify the optional toolset of v141. MSVC_RESDIST_DIR isn't found even though C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Redist\MSVC\14.16.27012 does actually exist with the appropriate files.
This is not a problem when specifying VS2019 generator with v142 toolset. It sets MSVC_REDIST_DIR as C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Redist/MSVC/14.21.27702.
This is also not a problem when specifying VS2019 generator with v140 toolset. It sets MSVC_REDIST_DIR as C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/redist.
I've never had Visual Studio 2017 IDE installed on my system.
To Reproduce
With a CMakeLists.txt
cmake_minimum_required(VERSION 3.14)
add_executable(main main.cpp)
install(TARGETS main RUNTIME DESTINATION bin)
include(InstallRequiredSystemLibraries)
and a test called main.cpp
int main() {}
results in the CMake Warning when configuring
CMake Warning at C:/Program Files/CMake/share/cmake-3.14/Modules/InstallRequiredSystemLibraries.cmake:558 (message):
system runtime library file does not exist:
'MSVC_REDIST_DIR-NOTFOUND/x64/Microsoft.VC141.CRT/concrt140.dll'
Call Stack (most recent call first):
CMakeLists.txt:4 (include)