CMake fails when bad `a.c` file exists in parent directory where the project lives
CMake version: 3.13.0
OS: Window 10 (64-bit)
Toolchain: gcc (mingw-w64), used from bash
(MSYS)
In all my CMake-based projects living in D:\prj\<prjname>\
, the bash command mkdir build && cd build && cmake -G Ninja ..
started to fail in very spectacular way (see the attached output of it).
After some playing around I have found there is some my experimental leftover file D:\prj\a.c
which cannot be compiled, and existence of this file triggers the CMake failure in all my projects living under the given directory. None of the projects refers to that file in any way.
After rm /d/prj/a.c
, CMake in all the projects started to work again as expected.
I think CMake should not depend on any files outside the project directory (except some documented CMake data directories), unless some project's CMakeLists.txt
explicitly refers to it.