2

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?

Sergey
  • 7,985
  • 4
  • 48
  • 80

3 Answers3

2

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

flederwiesel
  • 447
  • 1
  • 9
  • 17
MoonRaiser
  • 123
  • 13
  • 1
    That is not the same. CMAKE_BUILD_TYPE is valid for generators like GNU Make or Ninja which can only build one type per build folder. Meanwhile --config is for generators like XCode or Visual Studio which ignore CMAKE_BUILD_TYPE and toggle between Debug/Release at runtime – Matias N Goldberg Nov 03 '21 at 16:20
  • Yep, it's not the same but you can use it this way – MoonRaiser Nov 03 '21 at 16:50
0

Based on github Issue you should use

cmake --build .
Eng_Farghly
  • 1,987
  • 1
  • 23
  • 34
  • 1
    `--build` is another option which has nothing to do with build configuration specification. It's already used by `ExternalProject_Add` commands together with `--config`. The given solution probably solves the problem of that paticular project (udacity), but does not answer my question. – Sergey May 31 '21 at 17:45
  • I don't face this problem. I hope solve this problem and thanks for your comment @Sergey If you reach a correct answer ,I will share with you. – Eng_Farghly May 31 '21 at 17:59
0

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