CMake Rebuilding all files when only one has changed

If you use the Ninja generator, ninja -d explain should output why it is rerunning each command.

I suspect the issue here is that if foo generates a header given A.cpp that B.cpp also uses, if they are run out-of-order, B discovers the A.cpp-based generated header. If A.o happens to be built second, B is now out-of-date. Basically, something is not complete about your dependencies and the compilation of various sources is not as independent as the CMakeLists.txt implies they are (there’s some hidden header dependency between running sdscan.py and the compilation of other sources). CMake really wants this to be explicit given its model (but cannot, unfortunately diagnose them), but I suspect you’ve just been getting lucky in your old makefile (or it never supported parallel builds).