'Is there a way to invoke cmake only on modified targets?

I am working on a large C++ cmake project that contains many targets.

My current workflow is to configure cmake, generate a Visual Studio solution and work on it as if it was a standard Visual Studio solution.

This workflow is inefficient. Especially when compared to working on a non-cmake project on Visual Studio.

Each time I modify a single cmake target - such as adding a file, changing the the target CMakeList.txt in some way, the ZERO_CHECK target triggers cmake reconfiguration and generation.

This is rather slow and annoying. I must wait for configuration of ALL TARGETS, even the ones I did not change and have no dependency whatsoever on my modified target. For a large project this can take minutes.

I know I can disable the ZERO_CHECK target by adding set(CMAKE_SUPPRESS_REGENERATION true) to the root CMakeLists.txt. But this will force me to invoke cmake manually - which I don't mind but I don't think it will be any more efficient than what ZERO_CHECK is doing.

My questions are:

  1. Is there a way to invoke cmake only on modified / affected targets? Or maybe trigger a 'partial' regeneration?
  2. Is there a general way to make cmake regeneration faster in the particular case of modifying a single target?

Related Question



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source