Cmake as a build step - best practice

512 Views Asked by At

In both Visual Studio and Xcode, in a custom build step, I run cmake to generate a makefile, then I call NMake (or make). Now, it is unnecessary for cmake to generate every time the build step is invoked, and once generated, only NMake/make are enough.

However sometimes it IS necessary to rerun cmake, for example after cleaning. For build optimization, I'd like to detect the right thing to run (cmake/make). What criteria should I be looking for in my custom build script?

You may argue that I should always run a full cmake cycle, however:

  1. I have a few hundreds of those, and there is an overhead on sanity-checking the compilers etc by cmake.
  2. In projects where there are nested cmake directories, cmake falsely leaves a dependency folder "dirty", so that when another project with the same dependency builds, it rebuilds the dependency. With only Nmake/make that doesn't happen.
0

There are 0 best solutions below