With the long awaited addition of FASTBuild to the list of supported generators we wanted to transition our game engine from Ninja+clang-cl setup to FASTBuild+clang-cl setup to leverage that sweet distributed compilation on Windows, while preserving our CMake setup.
One of our dependencies failed to build. As I was getting deep in the rabbit hole it was my disappointment to find out that all the signs lead to a bug in CMake’s FASTBuild generator.
CMake version: 4.3.1
FASTBuild version: 1.19
Compiler: clang-cl 19.1.1; x86_64-pc-windows-msvc
OS: Windows 10 Pro, 10.0.19045
Env: x64 Native Tools Command Prompt for VS 2022
Everything boils down to a fact that build with FASTBuild+clang-cl generates warnings, that it shouldn’t generate. The warnings aren’t generated when building with Ninja+clang-cl, or even with FASTBuild+MSVC 19.44.35207 (Visual Studio 2022 Community, version 17.14.28)
The dependency has /WX flag, which basically treats all compiler warnings as errors.
The reproduction steps are following:
1. git clone https://github.com/nicebyte/nicegraf # fantastic library if you're doing graphics btw
2. cd nicegraf
3. cmake -S . -B build-fastbuild -G "FASTBuild" -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_LINKER=lld-link
4. cmake --build build-fastbuild --clean-first # FAILS
5. cmake -S . -B build-ninja -G "Ninja" -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_LINKER=lld-link
6. cmake --build build-ninja --clean-first # SUCCEEDS
If you followed the steps correctly, you should get roughly 126 warnings on SPIRV-reflect target – which doesn’t terminate the build – and 7 errors on nicegraf-vk target – which terminates the build. Errors is casued by-Werror,-Wpointer-bool-conversion warning.
I know that I can just turn off the warnings for that specific target, but that is a temporary solution and I suppose I ask here, before I open an issue on the CMake repo. Thanks.
edit: Added a missing command for repro steps