MSVC-style deps extraction broken with Ninja Multi-Config on Windows
Once again, I don't have an exact problem reproducer, but I think the issue is apparent.
When I try to build my project with Ninja-Multi-Config, at some point after building, if I interrupt ninja and rerun it again I get:
$ ninja
ninja: error: FindFirstFileExA(note: including file: c:/program files (x86)/microsoft visual studio/2019/professional/vc/tools/msvc/14.23.28105/include): The filename, directory name, or volume label syntax is incorrect.
Note the note: including file:
at the beginning of the file path.
It seems that this is NMC-specific, the rules.ninja
files is missing the msvc_deps_prefix = Note: including file:
entry.
If I configure the following minimal project with NMC, there's no msvc_deps_prefix
entry in rules.ninja
, but if I configure it with the regular Ninja generator, it's present.
# configure with the following, within VS 2019 cmd shell
# cmake -GNinja -DCMAKE_CXX_COMPILER=cl.exe .. -DCMAKE_CONFIGURATION_TYPES="Release;Debug" -G"Ninja Multi-Config"
cmake_minimum_required(VERSION 3.15)
project(ninja_multi_config_msvc_deps CXX)
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp"
" int main(int argc, char**argv) {return 1;}")
add_executable(lib "${CMAKE_CURRENT_BINARY_DIR}/main.cpp")
I assume this check needs to be fixed somehow
https://gitlab.kitware.com/cmake/cmake/-/blob/v3.17.2/Source/cmLocalNinjaGenerator.cxx#L76
Edited by Brad King