cmake.1.rst 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781
  1. .. cmake-manual-description: CMake Command-Line Reference
  2. cmake(1)
  3. ********
  4. Synopsis
  5. ========
  6. .. parsed-literal::
  7. `Generate a Project Buildsystem`_
  8. cmake [<options>] <path-to-source>
  9. cmake [<options>] <path-to-existing-build>
  10. cmake [<options>] -S <path-to-source> -B <path-to-build>
  11. `Build a Project`_
  12. cmake --build <dir> [<options>] [-- <build-tool-options>]
  13. `Install a Project`_
  14. cmake --install <dir> [<options>]
  15. `Open a Project`_
  16. cmake --open <dir>
  17. `Run a Script`_
  18. cmake [{-D <var>=<value>}...] -P <cmake-script-file>
  19. `Run a Command-Line Tool`_
  20. cmake -E <command> [<options>]
  21. `Run the Find-Package Tool`_
  22. cmake --find-package [<options>]
  23. `View Help`_
  24. cmake --help[-<topic>]
  25. Description
  26. ===========
  27. The **cmake** executable is the command-line interface of the cross-platform
  28. buildsystem generator CMake. The above `Synopsis`_ lists various actions
  29. the tool can perform as described in sections below.
  30. To build a software project with CMake, `Generate a Project Buildsystem`_.
  31. Optionally use **cmake** to `Build a Project`_, `Install a Project`_ or just
  32. run the corresponding build tool (e.g. ``make``) directly. **cmake** can also
  33. be used to `View Help`_.
  34. The other actions are meant for use by software developers writing
  35. scripts in the :manual:`CMake language <cmake-language(7)>` to support
  36. their builds.
  37. For graphical user interfaces that may be used in place of **cmake**,
  38. see :manual:`ccmake <ccmake(1)>` and :manual:`cmake-gui <cmake-gui(1)>`.
  39. For command-line interfaces to the CMake testing and packaging facilities,
  40. see :manual:`ctest <ctest(1)>` and :manual:`cpack <cpack(1)>`.
  41. For more information on CMake at large, `see also`_ the links at the end
  42. of this manual.
  43. Introduction to CMake Buildsystems
  44. ==================================
  45. A *buildsystem* describes how to build a project's executables and libraries
  46. from its source code using a *build tool* to automate the process. For
  47. example, a buildsystem may be a ``Makefile`` for use with a command-line
  48. ``make`` tool or a project file for an Integrated Development Environment
  49. (IDE). In order to avoid maintaining multiple such buildsystems, a project
  50. may specify its buildsystem abstractly using files written in the
  51. :manual:`CMake language <cmake-language(7)>`. From these files CMake
  52. generates a preferred buildsystem locally for each user through a backend
  53. called a *generator*.
  54. To generate a buildsystem with CMake, the following must be selected:
  55. Source Tree
  56. The top-level directory containing source files provided by the project.
  57. The project specifies its buildsystem using files as described in the
  58. :manual:`cmake-language(7)` manual, starting with a top-level file named
  59. ``CMakeLists.txt``. These files specify build targets and their
  60. dependencies as described in the :manual:`cmake-buildsystem(7)` manual.
  61. Build Tree
  62. The top-level directory in which buildsystem files and build output
  63. artifacts (e.g. executables and libraries) are to be stored.
  64. CMake will write a ``CMakeCache.txt`` file to identify the directory
  65. as a build tree and store persistent information such as buildsystem
  66. configuration options.
  67. To maintain a pristine source tree, perform an *out-of-source* build
  68. by using a separate dedicated build tree. An *in-source* build in
  69. which the build tree is placed in the same directory as the source
  70. tree is also supported, but discouraged.
  71. Generator
  72. This chooses the kind of buildsystem to generate. See the
  73. :manual:`cmake-generators(7)` manual for documentation of all generators.
  74. Run ``cmake --help`` to see a list of generators available locally.
  75. Optionally use the ``-G`` option below to specify a generator, or simply
  76. accept the default CMake chooses for the current platform.
  77. When using one of the :ref:`Command-Line Build Tool Generators`
  78. CMake expects that the environment needed by the compiler toolchain
  79. is already configured in the shell. When using one of the
  80. :ref:`IDE Build Tool Generators`, no particular environment is needed.
  81. Generate a Project Buildsystem
  82. ==============================
  83. Run CMake with one of the following command signatures to specify the
  84. source and build trees and generate a buildsystem:
  85. ``cmake [<options>] <path-to-source>``
  86. Uses the current working directory as the build tree, and
  87. ``<path-to-source>`` as the source tree. The specified path may
  88. be absolute or relative to the current working directory.
  89. The source tree must contain a ``CMakeLists.txt`` file and must
  90. *not* contain a ``CMakeCache.txt`` file because the latter
  91. identifies an existing build tree. For example:
  92. .. code-block:: console
  93. $ mkdir build ; cd build
  94. $ cmake ../src
  95. ``cmake [<options>] <path-to-existing-build>``
  96. Uses ``<path-to-existing-build>`` as the build tree, and loads the
  97. path to the source tree from its ``CMakeCache.txt`` file, which must
  98. have already been generated by a previous run of CMake. The specified
  99. path may be absolute or relative to the current working directory.
  100. For example:
  101. .. code-block:: console
  102. $ cd build
  103. $ cmake .
  104. ``cmake [<options>] -S <path-to-source> -B <path-to-build>``
  105. Uses ``<path-to-build>`` as the build tree and ``<path-to-source>``
  106. as the source tree. The specified paths may be absolute or relative
  107. to the current working directory. The source tree must contain a
  108. ``CMakeLists.txt`` file. The build tree will be created automatically
  109. if it does not already exist. For example:
  110. .. code-block:: console
  111. $ cmake -S src -B build
  112. In all cases the ``<options>`` may be zero or more of the `Options`_ below.
  113. After generating a buildsystem one may use the corresponding native
  114. build tool to build the project. For example, after using the
  115. :generator:`Unix Makefiles` generator one may run ``make`` directly:
  116. .. code-block:: console
  117. $ make
  118. $ make install
  119. Alternatively, one may use **cmake** to `Build a Project`_ by
  120. automatically choosing and invoking the appropriate native build tool.
  121. .. _`CMake Options`:
  122. Options
  123. -------
  124. .. include:: OPTIONS_BUILD.txt
  125. ``-L[A][H]``
  126. List non-advanced cached variables.
  127. List ``CACHE`` variables will run CMake and list all the variables from
  128. the CMake ``CACHE`` that are not marked as ``INTERNAL`` or :prop_cache:`ADVANCED`.
  129. This will effectively display current CMake settings, which can then be
  130. changed with ``-D`` option. Changing some of the variables may result
  131. in more variables being created. If ``A`` is specified, then it will
  132. display also advanced variables. If ``H`` is specified, it will also
  133. display help for each variable.
  134. ``-N``
  135. View mode only.
  136. Only load the cache. Do not actually run configure and generate
  137. steps.
  138. ``--graphviz=[file]``
  139. Generate graphviz of dependencies, see :module:`CMakeGraphVizOptions` for more.
  140. Generate a graphviz input file that will contain all the library and
  141. executable dependencies in the project. See the documentation for
  142. :module:`CMakeGraphVizOptions` for more details.
  143. ``--system-information [file]``
  144. Dump information about this system.
  145. Dump a wide range of information about the current system. If run
  146. from the top of a binary tree for a CMake project it will dump
  147. additional information such as the cache, log files etc.
  148. ``--log-level=<ERROR|WARNING|NOTICE|STATUS|VERBOSE|DEBUG|TRACE>``
  149. Set the log level.
  150. The :command:`message` command will only output messages of the specified
  151. log level or higher. The default log level is ``STATUS``.
  152. To make a log level persist between CMake runs, set
  153. :variable:`CMAKE_MESSAGE_LOG_LEVEL` as a cache variable instead.
  154. If both the command line option and the variable are given, the command line
  155. option takes precedence.
  156. For backward compatibility reasons, ``--loglevel`` is also accepted as a
  157. synonym for this option.
  158. ``--log-context``
  159. Enable the :command:`message` command outputting context attached to each
  160. message.
  161. This option turns on showing context for the current CMake run only.
  162. To make showing the context persistent for all subsequent CMake runs, set
  163. :variable:`CMAKE_MESSAGE_CONTEXT_SHOW` as a cache variable instead.
  164. When this command line option is given, :variable:`CMAKE_MESSAGE_CONTEXT_SHOW`
  165. is ignored.
  166. ``--debug-trycompile``
  167. Do not delete the :command:`try_compile` build tree.
  168. Only useful on one :command:`try_compile` at a time.
  169. Do not delete the files and directories created for :command:`try_compile`
  170. calls. This is useful in debugging failed try_compiles. It may
  171. however change the results of the try-compiles as old junk from a
  172. previous try-compile may cause a different test to either pass or
  173. fail incorrectly. This option is best used for one try-compile at a
  174. time, and only when debugging.
  175. ``--debug-output``
  176. Put cmake in a debug mode.
  177. Print extra information during the cmake run like stack traces with
  178. :command:`message(SEND_ERROR)` calls.
  179. ``--debug-find``
  180. Put cmake find in a debug mode.
  181. Print extra find call information during the cmake run to standard
  182. error. Output is designed for human consumption and not for parsing.
  183. ``--trace``
  184. Put cmake in trace mode.
  185. Print a trace of all calls made and from where.
  186. ``--trace-expand``
  187. Put cmake in trace mode.
  188. Like ``--trace``, but with variables expanded.
  189. ``--trace-format=<format>``
  190. Put cmake in trace mode and sets the trace output format.
  191. ``<format>`` can be one of the following values.
  192. ``human``
  193. Prints each trace line in a human-readable format. This is the
  194. default format.
  195. ``json``
  196. Prints each line as a separate JSON document. Each document is
  197. separated by a newline ( ``\n`` ). It is guaranteed that no
  198. newline characters will be present inside a JSON document.
  199. JSON trace format:
  200. .. code-block:: json
  201. {
  202. "file": "/full/path/to/the/CMake/file.txt",
  203. "line": 0,
  204. "cmd": "add_executable",
  205. "args": ["foo", "bar"],
  206. "time": 1579512535.9687231,
  207. "frame": 2
  208. }
  209. The members are:
  210. ``file``
  211. The full path to the CMake source file where the function
  212. was called.
  213. ``line``
  214. The line in ``file`` of the function call.
  215. ``cmd``
  216. The name of the function that was called.
  217. ``args``
  218. A string list of all function parameters.
  219. ``time``
  220. Timestamp (seconds since epoch) of the function call.
  221. ``frame``
  222. Stack frame depth of the function that was called.
  223. Additionally, the first JSON document outputted contains the
  224. ``version`` key for the current major and minor version of the
  225. JSON trace format:
  226. .. code-block:: json
  227. {
  228. "version": {
  229. "major": 1,
  230. "minor": 0
  231. }
  232. }
  233. The members are:
  234. ``version``
  235. Indicates the version of the JSON format. The version has a
  236. major and minor components following semantic version conventions.
  237. ``--trace-source=<file>``
  238. Put cmake in trace mode, but output only lines of a specified file.
  239. Multiple options are allowed.
  240. ``--trace-redirect=<file>``
  241. Put cmake in trace mode and redirect trace output to a file instead of stderr.
  242. ``--warn-uninitialized``
  243. Warn about uninitialized values.
  244. Print a warning when an uninitialized variable is used.
  245. ``--warn-unused-vars``
  246. Warn about unused variables.
  247. Find variables that are declared or set, but not used.
  248. ``--no-warn-unused-cli``
  249. Don't warn about command line options.
  250. Don't find variables that are declared on the command line, but not
  251. used.
  252. ``--check-system-vars``
  253. Find problems with variable usage in system files.
  254. Normally, unused and uninitialized variables are searched for only
  255. in :variable:`CMAKE_SOURCE_DIR` and :variable:`CMAKE_BINARY_DIR`.
  256. This flag tells CMake to warn about other files as well.
  257. .. _`Build Tool Mode`:
  258. Build a Project
  259. ===============
  260. CMake provides a command-line signature to build an already-generated
  261. project binary tree:
  262. .. code-block:: shell
  263. cmake --build <dir> [<options>] [-- <build-tool-options>]
  264. This abstracts a native build tool's command-line interface with the
  265. following options:
  266. ``--build <dir>``
  267. Project binary directory to be built. This is required and must be first.
  268. ``--parallel [<jobs>], -j [<jobs>]``
  269. The maximum number of concurrent processes to use when building.
  270. If ``<jobs>`` is omitted the native build tool's default number is used.
  271. The :envvar:`CMAKE_BUILD_PARALLEL_LEVEL` environment variable, if set,
  272. specifies a default parallel level when this option is not given.
  273. Some native build tools always build in parallel. The use of ``<jobs>``
  274. value of ``1`` can be used to limit to a single job.
  275. ``--target <tgt>..., -t <tgt>...``
  276. Build ``<tgt>`` instead of the default target. Multiple targets may be
  277. given, separated by spaces.
  278. ``--config <cfg>``
  279. For multi-configuration tools, choose configuration ``<cfg>``.
  280. ``--clean-first``
  281. Build target ``clean`` first, then build.
  282. (To clean only, use ``--target clean``.)
  283. ``--use-stderr``
  284. Ignored. Behavior is default in CMake >= 3.0.
  285. ``--verbose, -v``
  286. Enable verbose output - if supported - including the build commands to be
  287. executed.
  288. This option can be omitted if :envvar:`VERBOSE` environment variable or
  289. :variable:`CMAKE_VERBOSE_MAKEFILE` cached variable is set.
  290. ``--``
  291. Pass remaining options to the native tool.
  292. Run ``cmake --build`` with no options for quick help.
  293. Install a Project
  294. =================
  295. CMake provides a command-line signature to install an already-generated
  296. project binary tree:
  297. .. code-block:: shell
  298. cmake --install <dir> [<options>]
  299. This may be used after building a project to run installation without
  300. using the generated build system or the native build tool.
  301. The options are:
  302. ``--install <dir>``
  303. Project binary directory to install. This is required and must be first.
  304. ``--config <cfg>``
  305. For multi-configuration generators, choose configuration ``<cfg>``.
  306. ``--component <comp>``
  307. Component-based install. Only install component ``<comp>``.
  308. ``--prefix <prefix>``
  309. Override the installation prefix, :variable:`CMAKE_INSTALL_PREFIX`.
  310. ``--strip``
  311. Strip before installing.
  312. ``-v, --verbose``
  313. Enable verbose output.
  314. This option can be omitted if :envvar:`VERBOSE` environment variable is set.
  315. Run ``cmake --install`` with no options for quick help.
  316. Open a Project
  317. ==============
  318. .. code-block:: shell
  319. cmake --open <dir>
  320. Open the generated project in the associated application. This is only
  321. supported by some generators.
  322. .. _`Script Processing Mode`:
  323. Run a Script
  324. ============
  325. .. code-block:: shell
  326. cmake [{-D <var>=<value>}...] -P <cmake-script-file>
  327. Process the given cmake file as a script written in the CMake
  328. language. No configure or generate step is performed and the cache
  329. is not modified. If variables are defined using ``-D``, this must be
  330. done before the ``-P`` argument.
  331. Run a Command-Line Tool
  332. =======================
  333. CMake provides builtin command-line tools through the signature
  334. .. code-block:: shell
  335. cmake -E <command> [<options>]
  336. Run ``cmake -E`` or ``cmake -E help`` for a summary of commands.
  337. Available commands are:
  338. ``capabilities``
  339. Report cmake capabilities in JSON format. The output is a JSON object
  340. with the following keys:
  341. ``version``
  342. A JSON object with version information. Keys are:
  343. ``string``
  344. The full version string as displayed by cmake ``--version``.
  345. ``major``
  346. The major version number in integer form.
  347. ``minor``
  348. The minor version number in integer form.
  349. ``patch``
  350. The patch level in integer form.
  351. ``suffix``
  352. The cmake version suffix string.
  353. ``isDirty``
  354. A bool that is set if the cmake build is from a dirty tree.
  355. ``generators``
  356. A list available generators. Each generator is a JSON object with the
  357. following keys:
  358. ``name``
  359. A string containing the name of the generator.
  360. ``toolsetSupport``
  361. ``true`` if the generator supports toolsets and ``false`` otherwise.
  362. ``platformSupport``
  363. ``true`` if the generator supports platforms and ``false`` otherwise.
  364. ``extraGenerators``
  365. A list of strings with all the extra generators compatible with
  366. the generator.
  367. ``fileApi``
  368. Optional member that is present when the :manual:`cmake-file-api(7)`
  369. is available. The value is a JSON object with one member:
  370. ``requests``
  371. A JSON array containing zero or more supported file-api requests.
  372. Each request is a JSON object with members:
  373. ``kind``
  374. Specifies one of the supported :ref:`file-api object kinds`.
  375. ``version``
  376. A JSON array whose elements are each a JSON object containing
  377. ``major`` and ``minor`` members specifying non-negative integer
  378. version components.
  379. ``serverMode``
  380. ``true`` if cmake supports server-mode and ``false`` otherwise.
  381. ``chdir <dir> <cmd> [<arg>...]``
  382. Change the current working directory and run a command.
  383. ``compare_files [--ignore-eol] <file1> <file2>``
  384. Check if ``<file1>`` is same as ``<file2>``. If files are the same,
  385. then returns ``0``, if not it returns ``1``. The ``--ignore-eol`` option
  386. implies line-wise comparison and ignores LF/CRLF differences.
  387. ``copy <file>... <destination>``
  388. Copy files to ``<destination>`` (either file or directory).
  389. If multiple files are specified, the ``<destination>`` must be
  390. directory and it must exist. Wildcards are not supported.
  391. ``copy`` does follow symlinks. That means it does not copy symlinks,
  392. but the files or directories it point to.
  393. ``copy_directory <dir>... <destination>``
  394. Copy content of ``<dir>...`` directories to ``<destination>`` directory.
  395. If ``<destination>`` directory does not exist it will be created.
  396. ``copy_directory`` does follow symlinks.
  397. ``copy_if_different <file>... <destination>``
  398. Copy files to ``<destination>`` (either file or directory) if
  399. they have changed.
  400. If multiple files are specified, the ``<destination>`` must be
  401. directory and it must exist.
  402. ``copy_if_different`` does follow symlinks.
  403. ``create_symlink <old> <new>``
  404. Create a symbolic link ``<new>`` naming ``<old>``.
  405. .. note::
  406. Path to where ``<new>`` symbolic link will be created has to exist beforehand.
  407. ``echo [<string>...]``
  408. Displays arguments as text.
  409. ``echo_append [<string>...]``
  410. Displays arguments as text but no new line.
  411. ``env [--unset=NAME]... [NAME=VALUE]... COMMAND [ARG]...``
  412. Run command in a modified environment.
  413. ``environment``
  414. Display the current environment variables.
  415. ``false``
  416. Do nothing, with an exit code of 1.
  417. ``make_directory <dir>...``
  418. Create ``<dir>`` directories. If necessary, create parent
  419. directories too. If a directory already exists it will be
  420. silently ignored.
  421. ``md5sum <file>...``
  422. Create MD5 checksum of files in ``md5sum`` compatible format::
  423. 351abe79cd3800b38cdfb25d45015a15 file1.txt
  424. 052f86c15bbde68af55c7f7b340ab639 file2.txt
  425. ``sha1sum <file>...``
  426. Create SHA1 checksum of files in ``sha1sum`` compatible format::
  427. 4bb7932a29e6f73c97bb9272f2bdc393122f86e0 file1.txt
  428. 1df4c8f318665f9a5f2ed38f55adadb7ef9f559c file2.txt
  429. ``sha224sum <file>...``
  430. Create SHA224 checksum of files in ``sha224sum`` compatible format::
  431. b9b9346bc8437bbda630b0b7ddfc5ea9ca157546dbbf4c613192f930 file1.txt
  432. 6dfbe55f4d2edc5fe5c9197bca51ceaaf824e48eba0cc453088aee24 file2.txt
  433. ``sha256sum <file>...``
  434. Create SHA256 checksum of files in ``sha256sum`` compatible format::
  435. 76713b23615d31680afeb0e9efe94d47d3d4229191198bb46d7485f9cb191acc file1.txt
  436. 15b682ead6c12dedb1baf91231e1e89cfc7974b3787c1e2e01b986bffadae0ea file2.txt
  437. ``sha384sum <file>...``
  438. Create SHA384 checksum of files in ``sha384sum`` compatible format::
  439. acc049fedc091a22f5f2ce39a43b9057fd93c910e9afd76a6411a28a8f2b8a12c73d7129e292f94fc0329c309df49434 file1.txt
  440. 668ddeb108710d271ee21c0f3acbd6a7517e2b78f9181c6a2ff3b8943af92b0195dcb7cce48aa3e17893173c0a39e23d file2.txt
  441. ``sha512sum <file>...``
  442. Create SHA512 checksum of files in ``sha512sum`` compatible format::
  443. 2a78d7a6c5328cfb1467c63beac8ff21794213901eaadafd48e7800289afbc08e5fb3e86aa31116c945ee3d7bf2a6194489ec6101051083d1108defc8e1dba89 file1.txt
  444. 7a0b54896fe5e70cca6dd643ad6f672614b189bf26f8153061c4d219474b05dad08c4e729af9f4b009f1a1a280cb625454bf587c690f4617c27e3aebdf3b7a2d file2.txt
  445. ``remove [-f] <file>...``
  446. .. deprecated:: 3.17
  447. Remove the file(s). The planned behaviour was that if any of the
  448. listed files already do not exist, the command returns a non-zero exit code,
  449. but no message is logged. The ``-f`` option changes the behavior to return a
  450. zero exit code (i.e. success) in such situations instead.
  451. ``remove`` does not follow symlinks. That means it remove only symlinks
  452. and not files it point to.
  453. The implementation was buggy and always returned 0. It cannot be fixed without
  454. breaking backwards compatibility. Use ``rm`` instead.
  455. ``remove_directory <dir>...``
  456. .. deprecated:: 3.17
  457. Remove ``<dir>`` directories and their contents. If a directory does
  458. not exist it will be silently ignored. If ``<dir>`` is a symlink to
  459. a directory, just the symlink will be removed.
  460. Use ``rm`` instead.
  461. ``rename <oldname> <newname>``
  462. Rename a file or directory (on one volume). If file with the ``<newname>`` name
  463. already exists, then it will be silently replaced.
  464. ``rm [-rRf] <file> <dir>...``
  465. Remove the files ``<file>`` or directories ``dir``.
  466. Use ``-r`` or ``-R`` to remove directories and their contents recursively.
  467. If any of the listed files/directories do not exist, the command returns a
  468. non-zero exit code, but no message is logged. The ``-f`` option changes
  469. the behavior to return a zero exit code (i.e. success) in such
  470. situations instead.
  471. ``server``
  472. Launch :manual:`cmake-server(7)` mode.
  473. ``sleep <number>...``
  474. Sleep for given number of seconds.
  475. ``tar [cxt][vf][zjJ] file.tar [<options>] [--] [<pathname>...]``
  476. Create or extract a tar or zip archive. Options are:
  477. ``c``
  478. Create a new archive containing the specified files.
  479. If used, the ``<pathname>...`` argument is mandatory.
  480. ``x``
  481. Extract to disk from the archive.
  482. The ``<pathname>...`` argument could be used to extract only selected files
  483. or directories.
  484. When extracting selected files or directories, you must provide their exact
  485. names including the path, as printed by list (``-t``).
  486. ``t``
  487. List archive contents.
  488. The ``<pathname>...`` argument could be used to list only selected files
  489. or directories.
  490. ``v``
  491. Produce verbose output.
  492. ``z``
  493. Compress the resulting archive with gzip.
  494. ``j``
  495. Compress the resulting archive with bzip2.
  496. ``J``
  497. Compress the resulting archive with XZ.
  498. ``--zstd``
  499. Compress the resulting archive with Zstandard.
  500. ``--files-from=<file>``
  501. Read file names from the given file, one per line.
  502. Blank lines are ignored. Lines may not start in ``-``
  503. except for ``--add-file=<name>`` to add files whose
  504. names start in ``-``.
  505. ``--format=<format>``
  506. Specify the format of the archive to be created.
  507. Supported formats are: ``7zip``, ``gnutar``, ``pax``,
  508. ``paxr`` (restricted pax, default), and ``zip``.
  509. ``--mtime=<date>``
  510. Specify modification time recorded in tarball entries.
  511. ``--``
  512. Stop interpreting options and treat all remaining arguments
  513. as file names, even if they start with ``-``.
  514. ``time <command> [<args>...]``
  515. Run command and display elapsed time.
  516. ``touch <file>...``
  517. Creates ``<file>`` if file do not exist.
  518. If ``<file>`` exists, it is changing ``<file>`` access and modification times.
  519. ``touch_nocreate <file>...``
  520. Touch a file if it exists but do not create it. If a file does
  521. not exist it will be silently ignored.
  522. ``true``
  523. Do nothing, with an exit code of 0.
  524. Windows-specific Command-Line Tools
  525. -----------------------------------
  526. The following ``cmake -E`` commands are available only on Windows:
  527. ``delete_regv <key>``
  528. Delete Windows registry value.
  529. ``env_vs8_wince <sdkname>``
  530. Displays a batch file which sets the environment for the provided
  531. Windows CE SDK installed in VS2005.
  532. ``env_vs9_wince <sdkname>``
  533. Displays a batch file which sets the environment for the provided
  534. Windows CE SDK installed in VS2008.
  535. ``write_regv <key> <value>``
  536. Write Windows registry value.
  537. Run the Find-Package Tool
  538. =========================
  539. CMake provides a pkg-config like helper for Makefile-based projects:
  540. .. code-block:: shell
  541. cmake --find-package [<options>]
  542. It searches a package using :command:`find_package()` and prints the
  543. resulting flags to stdout. This can be used instead of pkg-config
  544. to find installed libraries in plain Makefile-based projects or in
  545. autoconf-based projects (via ``share/aclocal/cmake.m4``).
  546. .. note::
  547. This mode is not well-supported due to some technical limitations.
  548. It is kept for compatibility but should not be used in new projects.
  549. View Help
  550. =========
  551. To print selected pages from the CMake documentation, use
  552. .. code-block:: shell
  553. cmake --help[-<topic>]
  554. with one of the following options:
  555. .. include:: OPTIONS_HELP.txt
  556. See Also
  557. ========
  558. .. include:: LINKS.txt