(re)running cmake with ninja and clang-cl triggers ninja error about FindFirstFileExA (possible regression)
It seems the problem resurfaced in Visual Studio 17.8.5 with cmake version 3.27.2-msvc1 and still remains there in VS 17.9.3 with cmake version 3.28.0-msvc1.
When having a CMake project configured with ninja generator and with clang-cl as a C/C++ compiler, cmake/ninja would trigger an error:
ninja : error : FindFirstFileExA(Note: including file: C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/shared): The filename, directory name, or volume label syntax is incorrect.
I have first reported it on VS community forum here: https://developercommunity.visualstudio.com/t/rerunning-cmake-with-ninja-and-clang-c/10567377 and with the help from MS we concluded that it is not problem in clang or visual studio, but possibly in cmake. This problem is triggered with a new clang-cl (v18 built from LLVM master branch), but not with the one currently shipped with the VS (clang-cl v16.0.5)
Code to reproduce the problem is attached to this post. In order to reproduce it you need conan package manager (1.x) installed - I am using conan 1.62.0
To execute cmake correctly on the project, you need to create the conan “install” folder first, by running the batch file conan\conan_install_all.cmd (run this from top level project dir as prescribed here, the paths to conan profiles are hardcoded there).
Then run CMake cache generation from VS IDE the usual way. You can do this for “native” MS cl compiler and for clang-cl compiler. Once the cache for clang-cl is generated and build the first time, the subsequent builds fail with the error. The only way to continue is to delete and regenerate the cache completely.
The same build with MS cl compiler works alright.
I already tested that one needs to use conan generated toolchain file for CMake. Building it without one does not trigger the error. Also when you remove the resource file main.rc from the build, it will pass all right.