cmake.1.rst 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442
  1. cmake(1)
  2. ********
  3. ::
  4. cmake - Cross-Platform Makefile Generator.
  5. ::
  6. cmake [options] <path-to-source>
  7. cmake [options] <path-to-existing-build>
  8. The "cmake" executable is the CMake command-line interface. It may be
  9. used to configure projects in scripts. Project configuration settings
  10. may be specified on the command line with the -D option. The -i
  11. option will cause cmake to interactively prompt for such settings.
  12. CMake is a cross-platform build system generator. Projects specify
  13. their build process with platform-independent CMake listfiles included
  14. in each directory of a source tree with the name CMakeLists.txt.
  15. Users build a project by using CMake to generate a build system for a
  16. native tool on their platform.
  17. * ``-C <initial-cache>``: Pre-load a script to populate the cache.
  18. When cmake is first run in an empty build tree, it creates a
  19. CMakeCache.txt file and populates it with customizable settings for
  20. the project. This option may be used to specify a file from which
  21. to load cache entries before the first pass through the project's
  22. cmake listfiles. The loaded entries take priority over the
  23. project's default values. The given file should be a CMake script
  24. containing SET commands that use the CACHE option, not a
  25. cache-format file.
  26. * ``-D <var>:<type>=<value>``: Create a cmake cache entry.
  27. When cmake is first run in an empty build tree, it creates a
  28. CMakeCache.txt file and populates it with customizable settings for
  29. the project. This option may be used to specify a setting that
  30. takes priority over the project's default value. The option may be
  31. repeated for as many cache entries as desired.
  32. * ``-U <globbing_expr>``: Remove matching entries from CMake cache.
  33. This option may be used to remove one or more variables from the
  34. CMakeCache.txt file, globbing expressions using * and ? are
  35. supported. The option may be repeated for as many cache entries as
  36. desired.
  37. Use with care, you can make your CMakeCache.txt non-working.
  38. * ``-G <generator-name>``: Specify a build system generator.
  39. CMake may support multiple native build systems on certain
  40. platforms. A generator is responsible for generating a particular
  41. build system. Possible generator names are specified in the
  42. Generators section.
  43. * ``-T <toolset-name>``: Specify toolset name if supported by generator.
  44. Some CMake generators support a toolset name to be given to the
  45. native build system to choose a compiler. This is supported only on
  46. specific generators:
  47. ::
  48. Visual Studio >= 10
  49. Xcode >= 3.0
  50. See native build system documentation for allowed toolset names.
  51. * ``-Wno-dev``: Suppress developer warnings.
  52. Suppress warnings that are meant for the author of the
  53. CMakeLists.txt files.
  54. * ``-Wdev``: Enable developer warnings.
  55. Enable warnings that are meant for the author of the CMakeLists.txt
  56. files.
  57. * ``-E``: CMake command mode.
  58. For true platform independence, CMake provides a list of commands
  59. that can be used on all systems. Run with -E help for the usage
  60. information. Commands available are: chdir, compare_files, copy,
  61. copy_directory, copy_if_different, echo, echo_append, environment,
  62. make_directory, md5sum, remove, remove_directory, rename, tar, time,
  63. touch, touch_nocreate. In addition, some platform specific commands
  64. are available. On Windows: comspec, delete_regv, write_regv. On
  65. UNIX: create_symlink.
  66. * ``-i``: Run in wizard mode.
  67. Wizard mode runs cmake interactively without a GUI. The user is
  68. prompted to answer questions about the project configuration. The
  69. answers are used to set cmake cache values.
  70. * ``-L[A][H]``: List non-advanced cached variables.
  71. List cache variables will run CMake and list all the variables from
  72. the CMake cache that are not marked as INTERNAL or ADVANCED. This
  73. will effectively display current CMake settings, which can then be
  74. changed with -D option. Changing some of the variables may result
  75. in more variables being created. If A is specified, then it will
  76. display also advanced variables. If H is specified, it will also
  77. display help for each variable.
  78. * ``--build <dir>``: Build a CMake-generated project binary tree.
  79. This abstracts a native build tool's command-line interface with the
  80. following options:
  81. ::
  82. <dir> = Project binary directory to be built.
  83. --target <tgt> = Build <tgt> instead of default targets.
  84. --config <cfg> = For multi-configuration tools, choose <cfg>.
  85. --clean-first = Build target 'clean' first, then build.
  86. (To clean only, use --target 'clean'.)
  87. --use-stderr = Don't merge stdout/stderr output and pass the
  88. original stdout/stderr handles to the native
  89. tool so it can use the capabilities of the
  90. calling terminal (e.g. colored output).
  91. -- = Pass remaining options to the native tool.
  92. Run cmake --build with no options for quick help.
  93. * ``-N``: View mode only.
  94. Only load the cache. Do not actually run configure and generate
  95. steps.
  96. * ``-P <file>``: Process script mode.
  97. Process the given cmake file as a script written in the CMake
  98. language. No configure or generate step is performed and the cache
  99. is not modified. If variables are defined using -D, this must be
  100. done before the -P argument.
  101. * ``--find-package``: Run in pkg-config like mode.
  102. Search a package using find_package() and print the resulting flags
  103. to stdout. This can be used to use cmake instead of pkg-config to
  104. find installed libraries in plain Makefile-based projects or in
  105. autoconf-based projects (via share/aclocal/cmake.m4).
  106. * ``--graphviz=[file]``: Generate graphviz of dependencies, see CMakeGraphVizOptions.cmake for more.
  107. Generate a graphviz input file that will contain all the library and
  108. executable dependencies in the project. See the documentation for
  109. CMakeGraphVizOptions.cmake for more details.
  110. * ``--system-information [file]``: Dump information about this system.
  111. Dump a wide range of information about the current system. If run
  112. from the top of a binary tree for a CMake project it will dump
  113. additional information such as the cache, log files etc.
  114. * ``--debug-trycompile``: Do not delete the try_compile build tree. Only useful on one try_compile at a time.
  115. Do not delete the files and directories created for try_compile
  116. calls. This is useful in debugging failed try_compiles. It may
  117. however change the results of the try-compiles as old junk from a
  118. previous try-compile may cause a different test to either pass or
  119. fail incorrectly. This option is best used for one try-compile at a
  120. time, and only when debugging.
  121. * ``--debug-output``: Put cmake in a debug mode.
  122. Print extra stuff during the cmake run like stack traces with
  123. message(send_error ) calls.
  124. * ``--trace``: Put cmake in trace mode.
  125. Print a trace of all calls made and from where with
  126. message(send_error ) calls.
  127. * ``--warn-uninitialized``: Warn about uninitialized values.
  128. Print a warning when an uninitialized variable is used.
  129. * ``--warn-unused-vars``: Warn about unused variables.
  130. Find variables that are declared or set, but not used.
  131. * ``--no-warn-unused-cli``: Don't warn about command line options.
  132. Don't find variables that are declared on the command line, but not
  133. used.
  134. * ``--check-system-vars``: Find problems with variable usage in system files.
  135. Normally, unused and uninitialized variables are searched for only
  136. in CMAKE_SOURCE_DIR and CMAKE_BINARY_DIR. This flag tells CMake to
  137. warn about other files as well.
  138. * ``--help-command cmd [file]``: Print help for a single command and exit.
  139. Full documentation specific to the given command is displayed. If a
  140. file is specified, the documentation is written into and the output
  141. format is determined depending on the filename suffix. Supported
  142. are man page, HTML, DocBook and plain text.
  143. * ``--help-command-list [file]``: List available listfile commands and exit.
  144. The list contains all commands for which help may be obtained by
  145. using the --help-command argument followed by a command name. If a
  146. file is specified, the documentation is written into and the output
  147. format is determined depending on the filename suffix. Supported
  148. are man page, HTML, DocBook and plain text.
  149. * ``--help-commands [file]``: Print help for all commands and exit.
  150. Full documentation specific for all current commands is displayed.If
  151. a file is specified, the documentation is written into and the
  152. output format is determined depending on the filename suffix.
  153. Supported are man page, HTML, DocBook and plain text.
  154. * ``--help-compatcommands [file]``: Print help for compatibility commands.
  155. Full documentation specific for all compatibility commands is
  156. displayed.If a file is specified, the documentation is written into
  157. and the output format is determined depending on the filename
  158. suffix. Supported are man page, HTML, DocBook and plain text.
  159. * ``--help-module module [file]``: Print help for a single module and exit.
  160. Full documentation specific to the given module is displayed.If a
  161. file is specified, the documentation is written into and the output
  162. format is determined depending on the filename suffix. Supported
  163. are man page, HTML, DocBook and plain text.
  164. * ``--help-module-list [file]``: List available modules and exit.
  165. The list contains all modules for which help may be obtained by
  166. using the --help-module argument followed by a module name. If a
  167. file is specified, the documentation is written into and the output
  168. format is determined depending on the filename suffix. Supported
  169. are man page, HTML, DocBook and plain text.
  170. * ``--help-modules [file]``: Print help for all modules and exit.
  171. Full documentation for all modules is displayed. If a file is
  172. specified, the documentation is written into and the output format
  173. is determined depending on the filename suffix. Supported are man
  174. page, HTML, DocBook and plain text.
  175. * ``--help-custom-modules [file]``: Print help for all custom modules and exit.
  176. Full documentation for all custom modules is displayed. If a file
  177. is specified, the documentation is written into and the output
  178. format is determined depending on the filename suffix. Supported
  179. are man page, HTML, DocBook and plain text.
  180. * ``--help-policy cmp [file]``: Print help for a single policy and exit.
  181. Full documentation specific to the given policy is displayed.If a
  182. file is specified, the documentation is written into and the output
  183. format is determined depending on the filename suffix. Supported
  184. are man page, HTML, DocBook and plain text.
  185. * ``--help-policy-list [file]``: List available policies and exit.
  186. The list contains all policies for which help may be obtained by
  187. using the --help-policy argument followed by a policy name. If a
  188. file is specified, the documentation is written into and the output
  189. format is determined depending on the filename suffix. Supported
  190. are man page, HTML, DocBook and plain text.
  191. * ``--help-policies [file]``: Print help for all policies and exit.
  192. Full documentation for all policies is displayed.If a file is
  193. specified, the documentation is written into and the output format
  194. is determined depending on the filename suffix. Supported are man
  195. page, HTML, DocBook and plain text.
  196. * ``--help-property prop [file]``: Print help for a single property and exit.
  197. Full documentation specific to the given property is displayed.If a
  198. file is specified, the documentation is written into and the output
  199. format is determined depending on the filename suffix. Supported
  200. are man page, HTML, DocBook and plain text.
  201. * ``--help-property-list [file]``: List available properties and exit.
  202. The list contains all properties for which help may be obtained by
  203. using the --help-property argument followed by a property name. If
  204. a file is specified, the help is written into it.If a file is
  205. specified, the documentation is written into and the output format
  206. is determined depending on the filename suffix. Supported are man
  207. page, HTML, DocBook and plain text.
  208. * ``--help-properties [file]``: Print help for all properties and exit.
  209. Full documentation for all properties is displayed.If a file is
  210. specified, the documentation is written into and the output format
  211. is determined depending on the filename suffix. Supported are man
  212. page, HTML, DocBook and plain text.
  213. * ``--help-variable var [file]``: Print help for a single variable and exit.
  214. Full documentation specific to the given variable is displayed.If a
  215. file is specified, the documentation is written into and the output
  216. format is determined depending on the filename suffix. Supported
  217. are man page, HTML, DocBook and plain text.
  218. * ``--help-variable-list [file]``: List documented variables and exit.
  219. The list contains all variables for which help may be obtained by
  220. using the --help-variable argument followed by a variable name. If
  221. a file is specified, the help is written into it.If a file is
  222. specified, the documentation is written into and the output format
  223. is determined depending on the filename suffix. Supported are man
  224. page, HTML, DocBook and plain text.
  225. * ``--help-variables [file]``: Print help for all variables and exit.
  226. Full documentation for all variables is displayed.If a file is
  227. specified, the documentation is written into and the output format
  228. is determined depending on the filename suffix. Supported are man
  229. page, HTML, DocBook and plain text.
  230. * ``--copyright [file]``: Print the CMake copyright and exit.
  231. If a file is specified, the copyright is written into it.
  232. * ``--help,-help,-usage,-h,-H,/?``: Print usage information and exit.
  233. Usage describes the basic command line interface and its options.
  234. * ``--help-full [file]``: Print full help and exit.
  235. Full help displays most of the documentation provided by the UNIX
  236. man page. It is provided for use on non-UNIX platforms, but is also
  237. convenient if the man page is not installed. If a file is
  238. specified, the help is written into it.
  239. * ``--help-html [file]``: Print full help in HTML format.
  240. This option is used by CMake authors to help produce web pages. If
  241. a file is specified, the help is written into it.
  242. * ``--help-man [file]``: Print full help as a UNIX man page and exit.
  243. This option is used by the cmake build to generate the UNIX man
  244. page. If a file is specified, the help is written into it.
  245. * ``--version,-version,/V [file]``: Show program name/version banner and exit.
  246. If a file is specified, the version is written into it.
  247. The following generators are available on this platform:
  248. ::
  249. CMake Properties - Properties supported by CMake, the Cross-Platform Makefile Generator.
  250. This is the documentation for the properties supported by CMake.
  251. Properties can have different scopes. They can either be assigned to
  252. a source file, a directory, a target or globally to CMake. By
  253. modifying the values of properties the behaviour of the build system
  254. can be customized.
  255. ::
  256. CMake Compatibility Listfile Commands - Obsolete commands supported by CMake for compatibility.
  257. This is the documentation for now obsolete listfile commands from
  258. previous CMake versions, which are still supported for compatibility
  259. reasons. You should instead use the newer, faster and shinier new
  260. commands. ;-)
  261. The following modules are provided with CMake. They can be used with
  262. INCLUDE(ModuleName).
  263. ::
  264. CMake Modules - Modules coming with CMake, the Cross-Platform Makefile Generator.
  265. This is the documentation for the modules and scripts coming with
  266. CMake. Using these modules you can check the computer system for
  267. installed software packages, features of the compiler and the
  268. existence of headers to name just a few.
  269. variables defined by cmake, that give information about the project,
  270. and cmake
  271. Copyright 2000-2012 Kitware, Inc., Insight Software Consortium. All
  272. rights reserved.
  273. Redistribution and use in source and binary forms, with or without
  274. modification, are permitted provided that the following conditions are
  275. met:
  276. Redistributions of source code must retain the above copyright notice,
  277. this list of conditions and the following disclaimer.
  278. Redistributions in binary form must reproduce the above copyright
  279. notice, this list of conditions and the following disclaimer in the
  280. documentation and/or other materials provided with the distribution.
  281. Neither the names of Kitware, Inc., the Insight Software Consortium,
  282. nor the names of their contributors may be used to endorse or promote
  283. products derived from this software without specific prior written
  284. permission.
  285. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  286. "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  287. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  288. A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  289. HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  290. SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  291. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  292. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  293. THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  294. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  295. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  296. The following resources are available to get help using CMake:
  297. * ``Home Page``: http://www.cmake.org
  298. The primary starting point for learning about CMake.
  299. * ``Frequently Asked Questions``: http://www.cmake.org/Wiki/CMake_FAQ
  300. A Wiki is provided containing answers to frequently asked questions.
  301. * ``Online Documentation``: http://www.cmake.org/HTML/Documentation.html
  302. Links to available documentation may be found on this web page.
  303. * ``Mailing List``: http://www.cmake.org/HTML/MailingLists.html
  304. For help and discussion about using cmake, a mailing list is
  305. provided at [email protected]. The list is member-post-only but one
  306. may sign up on the CMake web page. Please first read the full
  307. documentation at http://www.cmake.org before posting questions to
  308. the list.