例如
#增加一个选项,WXWINDOWS_USE_SHARED_LIBS
OPTION(WXWINDOWS_USE_SHARED_LIBS "Use shared versions (.so) of wxWindows libraries" ON)
MARK_AS_ADVANCED(WXWINDOWS_USE_SHARED_LIBS)
相关知识
OPTION: Provides an option that the user can optionally select.
OPTION(OPTION_VAR "help string describing option"
[initial value])Provide an option for the user to select as ON or OFF. If no initial value is provided, OFF is used.
MARK_AS_ADVANCED: Mark cmake cached variables as advanced.
MARK_AS_ADVANCED([CLEAR|FORCE] VAR VAR2 VAR...)
Mark the named cached variables as advanced. An advanced variable will not be displayed in any of the cmake GUIs unless the show advanced option is on. If CLEAR is the first argument advanced variables are changed back to unadvanced. If FORCE is the first argument, then the variable is made advanced. If neither FORCE nor CLEAR is specified, new values will be marked as advanced, but if the variable already has an advanced/non-advanced state, it will not be changed
本文介绍了如何使用CMake中的OPTION宏来提供用户可选配置,并通过MARK_AS_ADVANCED标记缓存变量为高级设置,使这些配置项仅在显示高级选项时可见。
751

被折叠的 条评论
为什么被折叠?



