the option “--build” of cmake

前端 未结 1 1653
既然无缘
既然无缘 2021-01-31 17:55

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

相关标签:
1条回答
  • 2021-01-31 18:53

    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
    
    0 讨论(0)
提交回复
热议问题