cmake.1.rst 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820
  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 commands 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. See also the :variable:`CMAKE_FIND_DEBUG_MODE` variable for debugging
  184. a more local part of the project.
  185. ``--trace``
  186. Put cmake in trace mode.
  187. Print a trace of all calls made and from where.
  188. ``--trace-expand``
  189. Put cmake in trace mode.
  190. Like ``--trace``, but with variables expanded.
  191. ``--trace-format=<format>``
  192. Put cmake in trace mode and sets the trace output format.
  193. ``<format>`` can be one of the following values.
  194. ``human``
  195. Prints each trace line in a human-readable format. This is the
  196. default format.
  197. ``json-v1``
  198. Prints each line as a separate JSON document. Each document is
  199. separated by a newline ( ``\n`` ). It is guaranteed that no
  200. newline characters will be present inside a JSON document.
  201. JSON trace format:
  202. .. code-block:: json
  203. {
  204. "file": "/full/path/to/the/CMake/file.txt",
  205. "line": 0,
  206. "cmd": "add_executable",
  207. "args": ["foo", "bar"],
  208. "time": 1579512535.9687231,
  209. "frame": 2
  210. }
  211. The members are:
  212. ``file``
  213. The full path to the CMake source file where the function
  214. was called.
  215. ``line``
  216. The line in ``file`` of the function call.
  217. ``defer``
  218. Optional member that is present when the function call was deferred
  219. by :command:`cmake_language(DEFER)`. If present, its value is a
  220. string containing the deferred call ``<id>``.
  221. ``cmd``
  222. The name of the function that was called.
  223. ``args``
  224. A string list of all function parameters.
  225. ``time``
  226. Timestamp (seconds since epoch) of the function call.
  227. ``frame``
  228. Stack frame depth of the function that was called.
  229. Additionally, the first JSON document outputted contains the
  230. ``version`` key for the current major and minor version of the
  231. JSON trace format:
  232. .. code-block:: json
  233. {
  234. "version": {
  235. "major": 1,
  236. "minor": 1
  237. }
  238. }
  239. The members are:
  240. ``version``
  241. Indicates the version of the JSON format. The version has a
  242. major and minor components following semantic version conventions.
  243. ``--trace-source=<file>``
  244. Put cmake in trace mode, but output only lines of a specified file.
  245. Multiple options are allowed.
  246. ``--trace-redirect=<file>``
  247. Put cmake in trace mode and redirect trace output to a file instead of stderr.
  248. ``--warn-uninitialized``
  249. Warn about uninitialized values.
  250. Print a warning when an uninitialized variable is used.
  251. ``--warn-unused-vars``
  252. Does nothing. In CMake versions 3.2 and below this enabled warnings about
  253. unused variables. In CMake versions 3.3 through 3.18 the option was broken.
  254. In CMake 3.19 and above the option has been removed.
  255. ``--no-warn-unused-cli``
  256. Don't warn about command line options.
  257. Don't find variables that are declared on the command line, but not
  258. used.
  259. ``--check-system-vars``
  260. Find problems with variable usage in system files.
  261. Normally, unused and uninitialized variables are searched for only
  262. in :variable:`CMAKE_SOURCE_DIR` and :variable:`CMAKE_BINARY_DIR`.
  263. This flag tells CMake to warn about other files as well.
  264. ``--profiling-output=<path>``
  265. Used in conjunction with ``--profiling-format`` to output to a given path.
  266. ``--profiling-format=<file>``
  267. Enable the output of profiling data of CMake script in the given format.
  268. This can aid performance analysis of CMake scripts executed. Third party
  269. applications should be used to process the output into human readable format.
  270. Currently supported values are:
  271. ``google-trace`` Outputs in Google Trace Format, which can be parsed by the
  272. about:tracing tab of Google Chrome or using a plugin for a tool like Trace
  273. Compass.
  274. .. _`Build Tool Mode`:
  275. Build a Project
  276. ===============
  277. CMake provides a command-line signature to build an already-generated
  278. project binary tree:
  279. .. code-block:: shell
  280. cmake --build <dir> [<options>] [-- <build-tool-options>]
  281. This abstracts a native build tool's command-line interface with the
  282. following options:
  283. ``--build <dir>``
  284. Project binary directory to be built. This is required and must be first.
  285. ``--parallel [<jobs>], -j [<jobs>]``
  286. The maximum number of concurrent processes to use when building.
  287. If ``<jobs>`` is omitted the native build tool's default number is used.
  288. The :envvar:`CMAKE_BUILD_PARALLEL_LEVEL` environment variable, if set,
  289. specifies a default parallel level when this option is not given.
  290. Some native build tools always build in parallel. The use of ``<jobs>``
  291. value of ``1`` can be used to limit to a single job.
  292. ``--target <tgt>..., -t <tgt>...``
  293. Build ``<tgt>`` instead of the default target. Multiple targets may be
  294. given, separated by spaces.
  295. ``--config <cfg>``
  296. For multi-configuration tools, choose configuration ``<cfg>``.
  297. ``--clean-first``
  298. Build target ``clean`` first, then build.
  299. (To clean only, use ``--target clean``.)
  300. ``--use-stderr``
  301. Ignored. Behavior is default in CMake >= 3.0.
  302. ``--verbose, -v``
  303. Enable verbose output - if supported - including the build commands to be
  304. executed.
  305. This option can be omitted if :envvar:`VERBOSE` environment variable or
  306. :variable:`CMAKE_VERBOSE_MAKEFILE` cached variable is set.
  307. ``--``
  308. Pass remaining options to the native tool.
  309. Run ``cmake --build`` with no options for quick help.
  310. Install a Project
  311. =================
  312. CMake provides a command-line signature to install an already-generated
  313. project binary tree:
  314. .. code-block:: shell
  315. cmake --install <dir> [<options>]
  316. This may be used after building a project to run installation without
  317. using the generated build system or the native build tool.
  318. The options are:
  319. ``--install <dir>``
  320. Project binary directory to install. This is required and must be first.
  321. ``--config <cfg>``
  322. For multi-configuration generators, choose configuration ``<cfg>``.
  323. ``--component <comp>``
  324. Component-based install. Only install component ``<comp>``.
  325. ``--default-directory-permissions <permissions>``
  326. Default directory install permissions. Permissions in format ``<u=rwx,g=rx,o=rx>``.
  327. ``--prefix <prefix>``
  328. Override the installation prefix, :variable:`CMAKE_INSTALL_PREFIX`.
  329. ``--strip``
  330. Strip before installing.
  331. ``-v, --verbose``
  332. Enable verbose output.
  333. This option can be omitted if :envvar:`VERBOSE` environment variable is set.
  334. Run ``cmake --install`` with no options for quick help.
  335. Open a Project
  336. ==============
  337. .. code-block:: shell
  338. cmake --open <dir>
  339. Open the generated project in the associated application. This is only
  340. supported by some generators.
  341. .. _`Script Processing Mode`:
  342. Run a Script
  343. ============
  344. .. code-block:: shell
  345. cmake [{-D <var>=<value>}...] -P <cmake-script-file> [-- <unparsed-options>...]
  346. Process the given cmake file as a script written in the CMake
  347. language. No configure or generate step is performed and the cache
  348. is not modified. If variables are defined using ``-D``, this must be
  349. done before the ``-P`` argument.
  350. Any options after ``--`` are not parsed by CMake, but they are still included
  351. in the set of :variable:`CMAKE_ARGV<n> <CMAKE_ARGV0>` variables passed to the
  352. script (including the ``--`` itself).
  353. Run a Command-Line Tool
  354. =======================
  355. CMake provides builtin command-line tools through the signature
  356. .. code-block:: shell
  357. cmake -E <command> [<options>]
  358. Run ``cmake -E`` or ``cmake -E help`` for a summary of commands.
  359. Available commands are:
  360. ``capabilities``
  361. Report cmake capabilities in JSON format. The output is a JSON object
  362. with the following keys:
  363. ``version``
  364. A JSON object with version information. Keys are:
  365. ``string``
  366. The full version string as displayed by cmake ``--version``.
  367. ``major``
  368. The major version number in integer form.
  369. ``minor``
  370. The minor version number in integer form.
  371. ``patch``
  372. The patch level in integer form.
  373. ``suffix``
  374. The cmake version suffix string.
  375. ``isDirty``
  376. A bool that is set if the cmake build is from a dirty tree.
  377. ``generators``
  378. A list available generators. Each generator is a JSON object with the
  379. following keys:
  380. ``name``
  381. A string containing the name of the generator.
  382. ``toolsetSupport``
  383. ``true`` if the generator supports toolsets and ``false`` otherwise.
  384. ``platformSupport``
  385. ``true`` if the generator supports platforms and ``false`` otherwise.
  386. ``extraGenerators``
  387. A list of strings with all the extra generators compatible with
  388. the generator.
  389. ``fileApi``
  390. Optional member that is present when the :manual:`cmake-file-api(7)`
  391. is available. The value is a JSON object with one member:
  392. ``requests``
  393. A JSON array containing zero or more supported file-api requests.
  394. Each request is a JSON object with members:
  395. ``kind``
  396. Specifies one of the supported :ref:`file-api object kinds`.
  397. ``version``
  398. A JSON array whose elements are each a JSON object containing
  399. ``major`` and ``minor`` members specifying non-negative integer
  400. version components.
  401. ``serverMode``
  402. ``true`` if cmake supports server-mode and ``false`` otherwise.
  403. ``cat <files>...``
  404. Concatenate files and print on the standard output.
  405. ``chdir <dir> <cmd> [<arg>...]``
  406. Change the current working directory and run a command.
  407. ``compare_files [--ignore-eol] <file1> <file2>``
  408. Check if ``<file1>`` is same as ``<file2>``. If files are the same,
  409. then returns ``0``, if not it returns ``1``. In case of invalid
  410. arguments, it returns 2. The ``--ignore-eol`` option
  411. implies line-wise comparison and ignores LF/CRLF differences.
  412. ``copy <file>... <destination>``
  413. Copy files to ``<destination>`` (either file or directory).
  414. If multiple files are specified, the ``<destination>`` must be
  415. directory and it must exist. Wildcards are not supported.
  416. ``copy`` does follow symlinks. That means it does not copy symlinks,
  417. but the files or directories it point to.
  418. ``copy_directory <dir>... <destination>``
  419. Copy content of ``<dir>...`` directories to ``<destination>`` directory.
  420. If ``<destination>`` directory does not exist it will be created.
  421. ``copy_directory`` does follow symlinks.
  422. ``copy_if_different <file>... <destination>``
  423. Copy files to ``<destination>`` (either file or directory) if
  424. they have changed.
  425. If multiple files are specified, the ``<destination>`` must be
  426. directory and it must exist.
  427. ``copy_if_different`` does follow symlinks.
  428. ``create_symlink <old> <new>``
  429. Create a symbolic link ``<new>`` naming ``<old>``.
  430. .. note::
  431. Path to where ``<new>`` symbolic link will be created has to exist beforehand.
  432. ``create_hardlink <old> <new>``
  433. Create a hard link ``<new>`` naming ``<old>``.
  434. .. note::
  435. Path to where ``<new>`` hard link will be created has to exist beforehand.
  436. ``<old>`` has to exist beforehand.
  437. ``echo [<string>...]``
  438. Displays arguments as text.
  439. ``echo_append [<string>...]``
  440. Displays arguments as text but no new line.
  441. ``env [--unset=NAME]... [NAME=VALUE]... COMMAND [ARG]...``
  442. Run command in a modified environment.
  443. ``environment``
  444. Display the current environment variables.
  445. ``false``
  446. Do nothing, with an exit code of 1.
  447. ``make_directory <dir>...``
  448. Create ``<dir>`` directories. If necessary, create parent
  449. directories too. If a directory already exists it will be
  450. silently ignored.
  451. ``md5sum <file>...``
  452. Create MD5 checksum of files in ``md5sum`` compatible format::
  453. 351abe79cd3800b38cdfb25d45015a15 file1.txt
  454. 052f86c15bbde68af55c7f7b340ab639 file2.txt
  455. ``sha1sum <file>...``
  456. Create SHA1 checksum of files in ``sha1sum`` compatible format::
  457. 4bb7932a29e6f73c97bb9272f2bdc393122f86e0 file1.txt
  458. 1df4c8f318665f9a5f2ed38f55adadb7ef9f559c file2.txt
  459. ``sha224sum <file>...``
  460. Create SHA224 checksum of files in ``sha224sum`` compatible format::
  461. b9b9346bc8437bbda630b0b7ddfc5ea9ca157546dbbf4c613192f930 file1.txt
  462. 6dfbe55f4d2edc5fe5c9197bca51ceaaf824e48eba0cc453088aee24 file2.txt
  463. ``sha256sum <file>...``
  464. Create SHA256 checksum of files in ``sha256sum`` compatible format::
  465. 76713b23615d31680afeb0e9efe94d47d3d4229191198bb46d7485f9cb191acc file1.txt
  466. 15b682ead6c12dedb1baf91231e1e89cfc7974b3787c1e2e01b986bffadae0ea file2.txt
  467. ``sha384sum <file>...``
  468. Create SHA384 checksum of files in ``sha384sum`` compatible format::
  469. acc049fedc091a22f5f2ce39a43b9057fd93c910e9afd76a6411a28a8f2b8a12c73d7129e292f94fc0329c309df49434 file1.txt
  470. 668ddeb108710d271ee21c0f3acbd6a7517e2b78f9181c6a2ff3b8943af92b0195dcb7cce48aa3e17893173c0a39e23d file2.txt
  471. ``sha512sum <file>...``
  472. Create SHA512 checksum of files in ``sha512sum`` compatible format::
  473. 2a78d7a6c5328cfb1467c63beac8ff21794213901eaadafd48e7800289afbc08e5fb3e86aa31116c945ee3d7bf2a6194489ec6101051083d1108defc8e1dba89 file1.txt
  474. 7a0b54896fe5e70cca6dd643ad6f672614b189bf26f8153061c4d219474b05dad08c4e729af9f4b009f1a1a280cb625454bf587c690f4617c27e3aebdf3b7a2d file2.txt
  475. ``remove [-f] <file>...``
  476. .. deprecated:: 3.17
  477. Remove the file(s). The planned behaviour was that if any of the
  478. listed files already do not exist, the command returns a non-zero exit code,
  479. but no message is logged. The ``-f`` option changes the behavior to return a
  480. zero exit code (i.e. success) in such situations instead.
  481. ``remove`` does not follow symlinks. That means it remove only symlinks
  482. and not files it point to.
  483. The implementation was buggy and always returned 0. It cannot be fixed without
  484. breaking backwards compatibility. Use ``rm`` instead.
  485. ``remove_directory <dir>...``
  486. .. deprecated:: 3.17
  487. Remove ``<dir>`` directories and their contents. If a directory does
  488. not exist it will be silently ignored. If ``<dir>`` is a symlink to
  489. a directory, just the symlink will be removed.
  490. Use ``rm`` instead.
  491. ``rename <oldname> <newname>``
  492. Rename a file or directory (on one volume). If file with the ``<newname>`` name
  493. already exists, then it will be silently replaced.
  494. ``rm [-rRf] <file> <dir>...``
  495. Remove the files ``<file>`` or directories ``dir``.
  496. Use ``-r`` or ``-R`` to remove directories and their contents recursively.
  497. If any of the listed files/directories do not exist, the command returns a
  498. non-zero exit code, but no message is logged. The ``-f`` option changes
  499. the behavior to return a zero exit code (i.e. success) in such
  500. situations instead.
  501. ``server``
  502. Launch :manual:`cmake-server(7)` mode.
  503. ``sleep <number>...``
  504. Sleep for given number of seconds.
  505. ``tar [cxt][vf][zjJ] file.tar [<options>] [--] [<pathname>...]``
  506. Create or extract a tar or zip archive. Options are:
  507. ``c``
  508. Create a new archive containing the specified files.
  509. If used, the ``<pathname>...`` argument is mandatory.
  510. ``x``
  511. Extract to disk from the archive.
  512. The ``<pathname>...`` argument could be used to extract only selected files
  513. or directories.
  514. When extracting selected files or directories, you must provide their exact
  515. names including the path, as printed by list (``-t``).
  516. ``t``
  517. List archive contents.
  518. The ``<pathname>...`` argument could be used to list only selected files
  519. or directories.
  520. ``v``
  521. Produce verbose output.
  522. ``z``
  523. Compress the resulting archive with gzip.
  524. ``j``
  525. Compress the resulting archive with bzip2.
  526. ``J``
  527. Compress the resulting archive with XZ.
  528. ``--zstd``
  529. Compress the resulting archive with Zstandard.
  530. ``--files-from=<file>``
  531. Read file names from the given file, one per line.
  532. Blank lines are ignored. Lines may not start in ``-``
  533. except for ``--add-file=<name>`` to add files whose
  534. names start in ``-``.
  535. ``--format=<format>``
  536. Specify the format of the archive to be created.
  537. Supported formats are: ``7zip``, ``gnutar``, ``pax``,
  538. ``paxr`` (restricted pax, default), and ``zip``.
  539. ``--mtime=<date>``
  540. Specify modification time recorded in tarball entries.
  541. ``--``
  542. Stop interpreting options and treat all remaining arguments
  543. as file names, even if they start with ``-``.
  544. ``time <command> [<args>...]``
  545. Run command and display elapsed time.
  546. ``touch <file>...``
  547. Creates ``<file>`` if file do not exist.
  548. If ``<file>`` exists, it is changing ``<file>`` access and modification times.
  549. ``touch_nocreate <file>...``
  550. Touch a file if it exists but do not create it. If a file does
  551. not exist it will be silently ignored.
  552. ``true``
  553. Do nothing, with an exit code of 0.
  554. Windows-specific Command-Line Tools
  555. -----------------------------------
  556. The following ``cmake -E`` commands are available only on Windows:
  557. ``delete_regv <key>``
  558. Delete Windows registry value.
  559. ``env_vs8_wince <sdkname>``
  560. Displays a batch file which sets the environment for the provided
  561. Windows CE SDK installed in VS2005.
  562. ``env_vs9_wince <sdkname>``
  563. Displays a batch file which sets the environment for the provided
  564. Windows CE SDK installed in VS2008.
  565. ``write_regv <key> <value>``
  566. Write Windows registry value.
  567. Run the Find-Package Tool
  568. =========================
  569. CMake provides a pkg-config like helper for Makefile-based projects:
  570. .. code-block:: shell
  571. cmake --find-package [<options>]
  572. It searches a package using :command:`find_package()` and prints the
  573. resulting flags to stdout. This can be used instead of pkg-config
  574. to find installed libraries in plain Makefile-based projects or in
  575. autoconf-based projects (via ``share/aclocal/cmake.m4``).
  576. .. note::
  577. This mode is not well-supported due to some technical limitations.
  578. It is kept for compatibility but should not be used in new projects.
  579. View Help
  580. =========
  581. To print selected pages from the CMake documentation, use
  582. .. code-block:: shell
  583. cmake --help[-<topic>]
  584. with one of the following options:
  585. .. include:: OPTIONS_HELP.txt
  586. See Also
  587. ========
  588. .. include:: LINKS.txt