100

I've created a simple CMakeLists.txt:

cmake_minimum_required(VERSION 2.8)
project (HelloWorld)
add_executable (HelloWorld main.cpp)

When I generate a VS2012 or VS2010 project from CMake, however, I get these 2 additional entries - ALL_BUILD and ZERO_CHECK. I don't understand their purpose, do I need them?

enter image description here

sashoalm
  • 75,001
  • 122
  • 434
  • 781

2 Answers2

90

From https://cmake.org/pipermail/cmake/2008-November/025448.html:

Armin Berres — 11/22/2008, 3:12:41 PM

ZERO_CHECK will rerun cmake. You can/should execute this after changing something on your CMake files.

ALL_BUILD is simply a target which builds all and everything project in the active solution, I guess one can compare it to "make all".

sashoalm
  • 75,001
  • 122
  • 434
  • 781
  • 3
    ALL_BUILD doesn't necessarily build all projects. See https://cmake.org/cmake/help/latest/prop_dir/EXCLUDE_FROM_ALL.html – Andreas Haferburg Apr 10 '17 at 12:32
  • 60
    ZERO_CHECK. Great naming; should serve as a stellar example to anyone trying to name new technologies. Keep up the good work CMake! – douche_satan Mar 22 '19 at 19:28
  • 9
    Be careful with the commends they might actually think the name is intuitive haha! – PrimRock Mar 26 '20 at 18:49
  • 2
    `ALL_BUILD` doesn't however build itself. :D You can take is as a proxy that triggers the build process in all other targets in the solution. This is rather confusing. The same applies to the `ZERO_CHECK`. which - as stated in the answer - reruns CMake hence it too doesn't build anything. I have no idea who decided to introduce this convention but I hope it changes in the future. For someone new to CMake and the integration into Visual Studio this is rather confusing. – rbaleksandar Aug 13 '21 at 14:03
38

Add the following line to you CMakeLists.txt to suppress generation of ZERO_CHECK:

set(CMAKE_SUPPRESS_REGENERATION true)
sashoalm
  • 75,001
  • 122
  • 434
  • 781
user2902980
  • 447
  • 4
  • 6
  • 2
    Cool I did not know that. I tried CMAKE_SUPPRESS_REGENERATION:Bool=1 in CMakeCache.txt and it works too. Thanks – Arnaud Mar 10 '17 at 15:36
  • 1
    It should be noted that for some reason this needs to be set in the top-level `CMakeLists.txt`, it won't work in subdirectories (as of CMake 3.10) – kralyk Mar 07 '18 at 12:01
  • 1
    Is there a similar way to prevent ALL_BUILD from being created? Edit: Ok, there is not: https://gitlab.kitware.com/cmake/cmake/issues/16979 – Felix Crazzolara Mar 03 '20 at 21:49