Ninja Multi-config: POST_BUILD command script overwritten
Problem:
When using Ninja (or Ninja Multi-config) generator, and the POST_BUILD command-line exceeds some threshold (as defined in https://gitlab.kitware.com/cmake/cmake/-/blob/master/Source/cmLocalNinjaGenerator.cxx#L485) the said command-line is written to a file instead. On Windows that would be post-build.bat
(https://gitlab.kitware.com/cmake/cmake/-/blob/master/Source/cmLocalNinjaGenerator.cxx#L426).
In such case of a long command-line, when the Ninja Multi-config is used, this file gets incorrectly overwritten with subsequent configurations, effectively leaving it with the contents of the last configuration.
--
For example:
Having CMAKE_CONFIGURATION_TYPES=Debug;Release;RelWithDebInfo
,
Expected behavior:
Having 3 different post-build.bat
files, one for each configuration.
Actual behavior:
There is only 1 post-build.bat
file, and the contents of the file reflect only the RelWithDebInfo
configuration.
--
Tested with CMake 3.19/Windows 10/Ninja Multi-config/clang-cl (but I don't see anything that would change it in master
).