Is it possible not to generate ALL_BUILD project in cmake?

。_饼干妹妹 提交于 2020-06-27 15:09:32

问题


I don't need ALL_BUILD subproject, can I avoid generating it? Thanx.


回答1:


CMake Issue #16979: "ALL_BUILD target being generated":

The ALL_BUILD target corresponds to CMake's notion of the "all" target, equivalent to make all with makefile generators. This is different from "Build Solution" behavior due to idiosyncrasies in how the VS IDE deals with inter-vcxproj dependencies.

There is no way to suppress the ALL_BUILD target. It must exist for commands like cmake --build. to be able to build the "all" target by default.

So you can't avoid it - as with @arrowd answer - but there are some things in CMake that can influence the usage/appearance (on IDE generators like Visual Studio) of it:

  1. When you activate global USE_FOLDERS property

     set_property(GLOBAL PROPERTY USE_FOLDERS ON)
    

    the generic targets ALL_BUILD, ZERO_CHECK, INSTALL, PACKAGE and RUN_TESTS will be grouped into the CMakePredefinedTargets folder (or whichever name is given in global PREDEFINED_TARGETS_FOLDER property).

  2. The global variables CMAKE_SKIP_INSTALL_ALL_DEPENDENCY and CMAKE_SKIP_PACKAGE_ALL_DEPENDENCY do suppress otherwise automatically generated dependencies for INSTALL or PACKAGE to the ALL_BUILD target.

  3. The global VS_STARTUP_PROJECT property can be used to change the default startup project name to something other than the ALL_BUILD or "first project not in sub-folder" targets.

References

  • What are ALL_BUILD and ZERO_CHECK and do I need them?
  • How to skip dependency on all for package target?
  • No CMakePredefinedTargets when using solution folders



回答2:


It corresponds to the all make target, so, no, you can't avoid generating it. You can delete it from the solution manually, though.



来源:https://stackoverflow.com/questions/49069493/is-it-possible-not-to-generate-all-build-project-in-cmake

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!