是否可以在cmake中不生成ALL_BUILD项目? [英] Is it possible not to generate ALL_BUILD project in cmake?
问题描述
我不需要ALL_BUILD子项目,可以避免生成它吗?谢谢。
CMake问题#16979:正在生成ALL_BUILD目标 :
ALL_BUILD
目标与CMake的全部概念相对应。目标,等同于使用makefile生成器生成所有内容。这与构建解决方案不同。
没有办法抑制
ALL_BUILD
目标。它对于cmake --build
之类的命令必须存在。才能构建全部内容
所以您无法避免-就像@arrowed答案-一样,CMake中有些东西会影响使用/的外观(在类似Visual Studio的IDE生成器上):
-
激活全局
USE_FOLDERS
属性set_property(GLOBAL PROPERTY USE_FOLDERS ON)
通用目标
ALL_BUILD
,零检查
,安装
,包装
和RUN_TESTS
将分组到CMakePredefinedTargets
文件夹中(或全局PREDEFINED_TARGETS_FOLDER
属性)。 p>
-
全局变量
CMAKE_SKIP_INSTALL_ALL_DEPENDENCY
和CMAKE_SKIP_PACKAGE_ALL_DEPENDENCY
会禁止为安装或将<打包到
目标。
-
全局
VS_STARTUP_PROJECT
属性可用于将默认启动项目名称更改为ALL_BUILD
或 first以外的名称。项目不在子文件夹中目标。
参考
I don't need ALL_BUILD subproject, can I avoid generating it? Thanx.
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 likecmake --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:
When you activate global
USE_FOLDERS
propertyset_property(GLOBAL PROPERTY USE_FOLDERS ON)
the generic targets
ALL_BUILD
,ZERO_CHECK
,INSTALL
,PACKAGE
andRUN_TESTS
will be grouped into theCMakePredefinedTargets
folder (or whichever name is given in globalPREDEFINED_TARGETS_FOLDER
property).The global variables
CMAKE_SKIP_INSTALL_ALL_DEPENDENCY
andCMAKE_SKIP_PACKAGE_ALL_DEPENDENCY
do suppress otherwise automatically generated dependencies forINSTALL
orPACKAGE
to theALL_BUILD
target.The global
VS_STARTUP_PROJECT
property can be used to change the default startup project name to something other than theALL_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
这篇关于是否可以在cmake中不生成ALL_BUILD项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!