Cmake --config since version 3.20

Viewed 2093

All the build hierarchy of my project is based on ExternalProject with --config option. A few days ago I updated to cmake 3.20, and now --config is gone:

$ cmake --config
CMake Error: Unknown argument --config
CMake Error: Run 'cmake --help' for all supported options.

while documentation still advises to use it. Release notes are also silent about the option.

What should I use instead of --config?

3 Answers

You should use for configure

cmake -S . `-D CMAKE_BUILD_TYPE=Release`

CMAKE_BUILD_TYPE will be ignored at configure And for build

cmake --build .  --config Release

Based on https://stackoverflow.com/a/64719718 I don't understand why docs ignored this movement

OK I had the same problem on macOS with the XCode generator.

Turns out all I was missing was the --build command.

i.e. instead of:

cmake . --config Debug

I have to type:

cmake --build . --config Debug

Related