CMake 命令

来源:互联网 发布:骚男辣条淘宝店链接 编辑:程序博客网 时间:2024/06/13 22:20

1、Usage

cmake [options] <path-to-source>cmake [options] <path-to-existing-build>

cmake [选项] <源码路径>
cmake [选项] <现有构建路径>
Specify a source directory to (re-)generate a build system for it in thecurrent working directory.
Specify an existing build directory tore-generate its build system.

2、Options

-C <initial-cache>          = Pre-load a script to populate the cache.  当cmake在一个空的构建树上第一次运行时,它会创建一个CMakeCache.txt文件,然后向其中写入可定制的项目设置数据。-C选项可以用来指定一个文件,在第一次解析这个工程的cmake清单文件时,从这个文件加载缓存的条目(cache entries)信息。被加载的缓存条目比项目默认的值有更高的优先权。参数中给定的那个文件应该是一个CMake脚本,其中包含有使用CACHE选项的SET命令;而不是一个缓存格式的文件。  -D <var>:<type>=<value>     = Create a cmake cache entry.  当cmake第一次运行于一个空的构建数时,它会创建一个CMakeCache.txt文件,并且使用可定制的工程设置来填充这个文件。这个选项可以用来指定优先级高于工程的默认值的工程设置值。这个参数可以被重复多次,用来填充所需要数量的缓存条目(cache entries)。  -U <globbing_expr>          = Remove matching entries from CMake cache.  CMake的缓存文件中删除一条匹配的条目。 该选项可以用来删除CMakeCache.txt文件中的一或多个变量。文件名匹配表达式(globbing expression)支持通配符*和?的使用。该选项可以重复多次以删除期望数量的缓存条目。使用它时要小心,你可能因此让自己的CMakeCache.txt罢工。  -G <generator-name>         = Specify a build system generator.  指定一个makefile生成工具。在具体的平台上,CMake可以支持多个原生的构建系统。makefile生成工具的职责是生成特定的构建系统。  可能的生成工具在附件。  -T <toolset-name>           = Specify toolset name if supported by generator.  指定生成工具所支持的工具集。如MSVC,MinGW。  -A <platform-name>          = Specify platform name if supported by generator.  指定生成工具所支持的平台。  -Wno-dev                    = Suppress developer warnings.  抑制开发者警告。抑制那些为CMakeLists.txt文件的作者准备的警告信息。  -Wdev                       = Enable developer warnings.  开启开发者警告信息输出功能。允许那些为CMakeLists.txt文件的作者准备的警告信息。  -E                          = CMake command mode.  CMake命令行模式。 为了真正做到与平台无关,CMake提供了一系列可以用于所有系统上的的命令。以-E参数运行CMake会帮助你获得这些命令的用法。可以使用的命令有:chdir, copy, copy_if_different copy_directory, compare_files, echo, echo_append, environment, make_directory, md5sum, remove_directory, remove, tar, time, touch, touch_nocreate, write_regv, delete_regv, comspec, create_symlink。  -L[A][H]                    = List non-advanced cached variables.  列出非高级的缓存变量  --build <dir>               = Build a CMake-generated project binary tree.  构建由CMake生成的工程的二进制树。  -N                          = View mode only.  查看模式。仅仅加载缓存信息,并不实际运行配置和生成步骤。  -P <file>                   = Process script mode.  处理脚本模式。将给定的cmake文件按照CMake语言编写的脚本进行处理。不执行配置和生成步骤,不修改缓存信息。如果要使用-D选项定义变量,-D选项必须在-P选项之前。  --find-package              = Run in pkg-config like mode.  --graphviz=[file]           = Generate graphviz of dependencies, see                                CMakeGraphVizOptions.cmake for more.   生成依赖的graphviz图。生成一个graphviz软件的输入文件,其中包括了项目中所有库和可执行文件之间的依赖关系。  --system-information [file] = Dump information about this system.  输出与该系统相关的信息。输出范围比较广的、与当前使用的系统有关的信息。如果在一个CMake工程的二进制构建树的顶端运行该命令,它还会打印一些附加信息,例如缓存,日志文件等等。  --debug-trycompile          = Do not delete the try_compile build tree.                                Only useful on one try_compile at a time.  不删除“尝试编译”路径。不删除那些为try_compile调用生成的路径。这在调试失败的try_compile文件时比较有用。不过,因为上一次“尝试编译”生成的旧的垃圾输出文件也许会导致一次不正确通过/不通过,且该结果与上次测试的结果不同,所以该选项可能会改变“尝试编译”的结果。对于某一次“尝试编译”,该选项最好只用一次;并且仅仅在调试时使用。  --debug-output              = Put cmake in a debug mode.  将cmake设置为调试模式。在cmake运行时,打印额外的信息;比如使用message(send_error)调用得到的栈跟踪信息。  --trace                     = Put cmake in trace mode.  将cmake设置为跟踪模式。用message(send_error )调用,打印所有调用生成的跟踪信息,以及这些调用发生的位置。(这句话含义不是很确定—译注。)  --warn-uninitialized        = Warn about uninitialized values.  为没有初始化的值发出警告。  --warn-unused-vars          = Warn about unused variables.  为没有使用的变量发出警告。  --no-warn-unused-cli        = Don't warn about command line options.  命令行选项不要发出警告。  --check-system-vars         = Find problems with variable usage in system files.  在系统文件中查找关于变量使用的问题。  --help,-help,-usage,-h,-H,/?= Print usage information and exit.  打印用法信息,然后退出。  --version,-version,/V [<f>] = Print version number and exit.  打印版本号,然后退出。  --help-full [<f>]           = Print all help manuals and exit.  打印所有帮助信息,然后退出。  --help-manual <man> [<f>]   = Print one help manual and exit.  打印一条帮助信息,然后退出。  --help-manual-list [<f>]    = List help manuals available and exit.  列出所有可用命令的清单,然后退出。该选项列出的信息含有所有命令的名字;其中,每个命令的帮助信息可以使用--help-command选项后跟一个命令名字得到。如果指定了[file]参数,帮助信息会写到file中,输出格式依赖于文件名后缀。支持的文件格式包括:man page,HTML,DocBook以及纯文本。  --help-command <cmd> [<f>]  = Print help for one command and exit.  打印单个命令cmd的帮助信息,然后退出。显示给定的命令的完整的文档。如果指定了[file]参数,该文档会写入该文件,其输出格式由该文件的后缀名确定。支持的文件类型有:man page,HTML,DocBook以及纯文本。  --help-command-list [<f>]   = List commands with help available and exit.  --help-commands [<f>]       = Print cmake-commands manual and exit.  打印所有命令的帮助文件,然后退出。显示所有当前版本的命令的完整文档。如果指定了[file]参数,帮助信息会写到file中,输出格式依赖于文件名后缀。支持的文件格式包括:man page,HTML,DocBook以及纯文本。  --help-module <mod> [<f>]   = Print help for one module and exit.  --help-module-list [<f>]    = List modules with help available and exit.  --help-modules [<f>]        = Print cmake-modules manual and exit.  --help-policy <cmp> [<f>]   = Print help for one policy and exit.  --help-policy-list [<f>]    = List policies with help available and exit.  --help-policies [<f>]       = Print cmake-policies manual and exit.  --help-property <prop> [<f>]= Print help for one property and exit.  --help-property-list [<f>]  = List properties with help available and exit.  --help-properties [<f>]     = Print cmake-properties manual and exit.  --help-variable var [<f>]   = Print help for one variable and exit.  打印单个变量的帮助信息,然后退出。  --help-variable-list [<f>]  = List variables with help available and exit.  列出文档中有记录的变量,然后退出。  --help-variables [<f>]      = Print cmake-variables manual and exit.  打印所有变量的帮助信息,然后退出。GeneratorsThe following generators are available on this platform:  Visual Studio 6             = Generates Visual Studio 6 project files.  Visual Studio 7             = Generates Visual Studio .NET 2002 project                                files.  Visual Studio 10 2010       = Generates Visual Studio 10 (VS 2010) project                                files.  Visual Studio 11 2012       = Generates Visual Studio 11 (VS 2012) project                                files.  Visual Studio 12 2013       = Generates Visual Studio 12 (VS 2013) project                                files.  Visual Studio 14 2015       = Generates Visual Studio 14 (VS 2015) project                                files.  Visual Studio 7 .NET 2003   = Generates Visual Studio .NET 2003 project                                files.  Visual Studio 8 2005        = Generates Visual Studio 8 2005 project files.  Visual Studio 9 2008        = Generates Visual Studio 9 2008 project files.  Borland Makefiles           = Generates Borland makefiles.  NMake Makefiles             = Generates NMake makefiles.  NMake Makefiles JOM         = Generates JOM makefiles.  MSYS Makefiles              = Generates MSYS makefiles.  MinGW Makefiles             = Generates a make file for use with                                mingw32-make.  Unix Makefiles              = Generates standard UNIX makefiles.  Ninja                       = Generates build.ninja files (experimental).  Watcom WMake                = Generates Watcom WMake makefiles.  CodeBlocks - MinGW Makefiles= Generates CodeBlocks project files.  CodeBlocks - NMake Makefiles= Generates CodeBlocks project files.  CodeBlocks - Ninja          = Generates CodeBlocks project files.  CodeBlocks - Unix Makefiles = Generates CodeBlocks project files.  CodeLite - MinGW Makefiles  = Generates CodeLite project files.  CodeLite - NMake Makefiles  = Generates CodeLite project files.  CodeLite - Ninja            = Generates CodeLite project files.  CodeLite - Unix Makefiles   = Generates CodeLite project files.  Eclipse CDT4 - MinGW Makefiles                              = Generates Eclipse CDT 4.0 project files.  Eclipse CDT4 - NMake Makefiles                              = Generates Eclipse CDT 4.0 project files.  Eclipse CDT4 - Ninja        = Generates Eclipse CDT 4.0 project files.  Eclipse CDT4 - Unix Makefiles                              = Generates Eclipse CDT 4.0 project files.  Kate - MinGW Makefiles      = Generates Kate project files.  Kate - NMake Makefiles      = Generates Kate project files.  Kate - Ninja                = Generates Kate project files.  Kate - Unix Makefiles       = Generates Kate project files.  Sublime Text 2 - MinGW Makefiles                              = Generates Sublime Text 2 project files.  Sublime Text 2 - NMake Makefiles                              = Generates Sublime Text 2 project files.  Sublime Text 2 - Ninja      = Generates Sublime Text 2 project files.  Sublime Text 2 - Unix Makefiles                              = Generates Sublime Text 2 project files.

转载自http://www.cnblogs.com/coderfenghc/archive/2012/06/16/CMake_ch_01.html,转载请注明出处。

0 0
原创粉丝点击