Tutorial Step 8 Visual Studio build steps in wrong order?

I built and ran Step 8 of the tutorial OK. But if I rebuild SqrtLibrary in Visual Studio I get

Rebuild started at 9:08 AM...
1>------ Rebuild All started: Project: ZERO_CHECK, Configuration: Debug x64 ------
1>1>Checking Build System
2>------ Rebuild All started: Project: MakeTable, Configuration: Debug x64 ------
2>Building Custom Rule C:/Users/perma/source/repos/cmake-3.28-tutorial/Step8/MathFunctions/CMakeLists.txt
2>MakeTable.cxx
2>MakeTable.vcxproj -> C:\Users\perma\source\builds\cmake-3.28-tutorial\Step8_msvc17\MathFunctions\Debug\MakeTable.exe
3>------ Rebuild All started: Project: SqrtLibrary, Configuration: Debug x64 ------
3>Generating Table.h
3>Building Custom Rule C:/Users/perma/source/repos/cmake-3.28-tutorial/Step8/MathFunctions/CMakeLists.txt
3>mysqrt.cxx
3>SqrtLibrary.vcxproj -> C:\Users\perma\source\builds\cmake-3.28-tutorial\Step8_msvc17\MathFunctions\Debug\SqrtLibrary.lib
========== Rebuild All: 3 succeeded, 0 failed, 0 skipped ==========
========== Rebuild completed at 9:08 AM and took 03.147 seconds ==========

When it gets to build SqrtLibrary, after ZERO_CHECK and MakeTable, the first thing it does is generate Table.h. Only after that does it run the check to see whether CMake should recreate the build tree (if I am interpreting it correctly). It seems to me that the build step associated with CMakeLists.txt should come first.
What am I missing?

ZERO_CHECK is just CMake checking if it needs to re-run. By definition if your CMakeLists.txt changes you need to regenerate your visual studio solution.

If this check didn’t exist each time you changed any CMakeLists.txt or *.cmake file you would have to manually regenerate the visual studio solution.

That’s why it runs first. Hence the name 0 check. It’s the first thing that needs to be checked. (Programmers start at 0).

So in order.

0.) ZERO_CHECK
1.) Build MakeTable executable. This HAS to happen before table.h can be generated.
2.) Generate table.h using MakeTable
3.) Build SqrtLibrary library which include table.h

Thanks for responding. To clarify, my question is about these three lines in the output I copied:

3>------ Rebuild All started: Project: SqrtLibrary, Configuration: Debug x64 ------
3>Generating Table.h
3>Building Custom Rule C:/Users/perma/source/repos/cmake-3.28-tutorial/Step8/MathFunctions/CMakeLists.txt

The line that starts with Building Custom Rule is from a custom build step in SqrtLibrary that seems to be looking at whether it needs to recreate the build tree, similar to what ZERO_CHECK does. If that is what it is doing, why is it not running before the other custom build step in that project, which is the one that generates Table.h.

I’m also curious about why we need both ZERO_CHECK and the custom build steps to check the build in each project.

Probably arcane reasons related to ancient Visual Studio versions. @brad.king may know.

The per-project checks came first. When VS introduced support for parallel builds of multiple projects, ZERO_CHECK was created to synchronize an initial check. The per-project checks are attached to the CMakeLists.txt files and so were kept to provide a convenient way to interactively reconfigure after editing one. During a normal build the per-project checks should do nothing once ZERO_CHECK is done.