Where did `--generate` come from, and where did it go?

I have some local build utility scripts that I use to keep different generates updated. Somehow, I wound up with this:

cmake --generate _ninja
cmake --generate _vs

As a way to make sure local CMakeLists.txt changes are reflected in my projects.

This works fine on CMake 3.19.7, but updating to 3.20.0 appears to have removed this flag. I tried searching for more context on this and cannot find anything online that suggests this flag even exists. I tried Release Notes, --help, and grepping the CMake code on GitHub. No dice.

Was this an internal CLI flag? Where did it go? I’m fine adjusting my scripts but I’m frustrated that:

  1. Used an internal/unstable flag by accident for so long
  2. Cannot find any reference to it anywhere. Where in the CMake code was this defined?!

Any guidance is appreciated. Thanks!

--generate was never a CMake flag. It was never in the documentation. It “worked” before because CMake silently ignored - arguments that it didn’t recognize. Starting with CMake 3.20, such arguments are now an error.

Are _ninja and _vs build directories? Source directories?

3 Likes

Yes, they are build directories. Made the usual way: cmake -B _ninja -G Ninja, etc.

It “worked” before because CMake silently ignored

… that makes sense, and now I just feel silly. This is a good improvement in 3.20, and explains why I couldn’t find any references to it.

Thanks!

Cc: @robert.maynard