VS generator generates incorrect executable names
I have just upgraded from CMake 3.18.4 to CMake 3.23.1. My builds run on Linux and MacOS (Makefile generator) and Windows 64bit (Visual Studio 20 2019). Up until now I've had no issues, and even for most of my test builds with CMake 3.23.1 I've had no problems. However, I just ran a build on Windows and most of the executable filenames in the generated Visual Studio files were totally bogus: they were all prefixed with the string CMAKE_C_FLAGS_RELWITHDEBINFO ... !! Needless to say my tests etc. failed to run because they were looking for the correct executable files, but CMake generated these bogus ones. Never seen anything like it.
For example in my generated *.vcxproj
files I see lines like this:
<OutDir Condition="'$(Configuration)|$(Platform)'=='RelWithDebInfo|x64'">D:\builds\base\obj\build\CDriver\RelWithDebInfo\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='RelWithDebInfo|x64'">CCallableStatementTest.ctest.dir\RelWithDebInfo\</IntDir>
<TargetName Condition="'$(Configuration)|$(Platform)'=='RelWithDebInfo|x64'">CMAKE_C_FLAGS_RELWITHDEBINFOCCallableStatementTest.ctest</TargetName>
?!?!?! Where did that CMAKE_C_FLAGS_RELWITHDEBINFO prefix come from? It's on every executable in my cmake-generated visual studio files (over 200). The build works, it just generates all these incorrectly named executables. Note that the executable name is wrong in the VS project files for all possible build types (Debug, Release, etc. as well) but they all have the RELWITHDEBINFO variable. Also, probably not relevant but most of my executables are C++ and only a few are C, but all of them are prefixed with CMAKE_C_FLAGS_RELWITHDEBINFO.
I did started a Windows Debug build at about the same time with the same Git commits and version of cmake, and also builds on Linux and MacOS, and all of those were fine.