I want to use the cmake --build
command to build my project.
This command has a --config
option. I don\'t know how many different parameter
You can call cmake --build like this:
cmake --build . --target MyExe --config Debug
This would be run from your build root, since the directory is passed as .
, and would build the target MyExe
in Debug
mode.
If your build tool is a multi-configuration one (like devenv on Windows), the --config
argument matters. If you pass an invalid parameter as the config type here, the build tool should give an error.
If the build tool isn't multi-config (like gcc), then the --config
argument is ignored. Instead the build type is set via the CMAKE_BUILD_TYPE
CMake variable; i.e. it's set when running CMake, not when running the build tool.
You can pass further options to the build tool by adding them at the end after a --
, e.g to pass -j4
if using gcc:
cmake --build . --target MyExe -- -j4