include_external_msproject: cmake --build does not respect MAP_IMPORTED_CONFIG_xxx
The attached zip file contains a Visual Studio 2019 console template project with the "Debug" and "Release" configurations removed and replaced with "FooConfig" and "BarConfig". It also contains a CMakeLists.txt which imports the external project using include_external_msproject(). 3 of the default CMake configurations map to BarConfig while one maps to FooConfig.
You can successfully generate a Visual Studio 2019 project file using:
cmake {path} -G "Visual Studio 16 2019" -A x64
You can successfully build the solution using Visual Studio 2019 or MSBuild from a VS2019 tools command prompt. It successfully maps the CMake configuration to the configuration in the external project.
You cannot successfully build the solution using CMake build:
cmake --build .
> Microsoft (R) Build Engine version 16.10.1+2fd48ab73 for .NET Framework
> Copyright (C) Microsoft Corporation. All rights reserved.
>
> C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(436,5): error MSB8013: This project doesn't contain the Configuration and Platform combination of Debug|x64. [D:\test\src\test1\test1.vcxproj]
Judging the error message, it would appear that somehow the mappings are not respected when the project is built in this way.
> cmake --version
> cmake version 3.19.0-rc1
Please let me know if there is anything I can do on my side to assist.
Thank you!
Nick