1.. cmake-manual-description: CMake Command-Line Reference 2 3cmake(1) 4******** 5 6Synopsis 7======== 8 9.. parsed-literal:: 10 11 `Generate a Project Buildsystem`_ 12 cmake [<options>] <path-to-source> 13 cmake [<options>] <path-to-existing-build> 14 cmake [<options>] -S <path-to-source> -B <path-to-build> 15 16 `Build a Project`_ 17 cmake --build <dir> [<options>] [-- <build-tool-options>] 18 19 `Install a Project`_ 20 cmake --install <dir> [<options>] 21 22 `Open a Project`_ 23 cmake --open <dir> 24 25 `Run a Script`_ 26 cmake [{-D <var>=<value>}...] -P <cmake-script-file> 27 28 `Run a Command-Line Tool`_ 29 cmake -E <command> [<options>] 30 31 `Run the Find-Package Tool`_ 32 cmake --find-package [<options>] 33 34 `View Help`_ 35 cmake --help[-<topic>] 36 37Description 38=========== 39 40The **cmake** executable is the command-line interface of the cross-platform 41buildsystem generator CMake. The above `Synopsis`_ lists various actions 42the tool can perform as described in sections below. 43 44To build a software project with CMake, `Generate a Project Buildsystem`_. 45Optionally use **cmake** to `Build a Project`_, `Install a Project`_ or just 46run the corresponding build tool (e.g. ``make``) directly. **cmake** can also 47be used to `View Help`_. 48 49The other actions are meant for use by software developers writing 50scripts in the :manual:`CMake language <cmake-language(7)>` to support 51their builds. 52 53For graphical user interfaces that may be used in place of **cmake**, 54see :manual:`ccmake <ccmake(1)>` and :manual:`cmake-gui <cmake-gui(1)>`. 55For command-line interfaces to the CMake testing and packaging facilities, 56see :manual:`ctest <ctest(1)>` and :manual:`cpack <cpack(1)>`. 57 58For more information on CMake at large, `see also`_ the links at the end 59of this manual. 60 61 62Introduction to CMake Buildsystems 63================================== 64 65A *buildsystem* describes how to build a project's executables and libraries 66from its source code using a *build tool* to automate the process. For 67example, a buildsystem may be a ``Makefile`` for use with a command-line 68``make`` tool or a project file for an Integrated Development Environment 69(IDE). In order to avoid maintaining multiple such buildsystems, a project 70may specify its buildsystem abstractly using files written in the 71:manual:`CMake language <cmake-language(7)>`. From these files CMake 72generates a preferred buildsystem locally for each user through a backend 73called a *generator*. 74 75To generate a buildsystem with CMake, the following must be selected: 76 77Source Tree 78 The top-level directory containing source files provided by the project. 79 The project specifies its buildsystem using files as described in the 80 :manual:`cmake-language(7)` manual, starting with a top-level file named 81 ``CMakeLists.txt``. These files specify build targets and their 82 dependencies as described in the :manual:`cmake-buildsystem(7)` manual. 83 84Build Tree 85 The top-level directory in which buildsystem files and build output 86 artifacts (e.g. executables and libraries) are to be stored. 87 CMake will write a ``CMakeCache.txt`` file to identify the directory 88 as a build tree and store persistent information such as buildsystem 89 configuration options. 90 91 To maintain a pristine source tree, perform an *out-of-source* build 92 by using a separate dedicated build tree. An *in-source* build in 93 which the build tree is placed in the same directory as the source 94 tree is also supported, but discouraged. 95 96Generator 97 This chooses the kind of buildsystem to generate. See the 98 :manual:`cmake-generators(7)` manual for documentation of all generators. 99 Run ``cmake --help`` to see a list of generators available locally. 100 Optionally use the ``-G`` option below to specify a generator, or simply 101 accept the default CMake chooses for the current platform. 102 103 When using one of the :ref:`Command-Line Build Tool Generators` 104 CMake expects that the environment needed by the compiler toolchain 105 is already configured in the shell. When using one of the 106 :ref:`IDE Build Tool Generators`, no particular environment is needed. 107 108.. _`Generate a Project Buildsystem`: 109 110Generate a Project Buildsystem 111============================== 112 113Run CMake with one of the following command signatures to specify the 114source and build trees and generate a buildsystem: 115 116``cmake [<options>] <path-to-source>`` 117 Uses the current working directory as the build tree, and 118 ``<path-to-source>`` as the source tree. The specified path may 119 be absolute or relative to the current working directory. 120 The source tree must contain a ``CMakeLists.txt`` file and must 121 *not* contain a ``CMakeCache.txt`` file because the latter 122 identifies an existing build tree. For example: 123 124 .. code-block:: console 125 126 $ mkdir build ; cd build 127 $ cmake ../src 128 129``cmake [<options>] <path-to-existing-build>`` 130 Uses ``<path-to-existing-build>`` as the build tree, and loads the 131 path to the source tree from its ``CMakeCache.txt`` file, which must 132 have already been generated by a previous run of CMake. The specified 133 path may be absolute or relative to the current working directory. 134 For example: 135 136 .. code-block:: console 137 138 $ cd build 139 $ cmake . 140 141``cmake [<options>] -S <path-to-source> -B <path-to-build>`` 142 Uses ``<path-to-build>`` as the build tree and ``<path-to-source>`` 143 as the source tree. The specified paths may be absolute or relative 144 to the current working directory. The source tree must contain a 145 ``CMakeLists.txt`` file. The build tree will be created automatically 146 if it does not already exist. For example: 147 148 .. code-block:: console 149 150 $ cmake -S src -B build 151 152In all cases the ``<options>`` may be zero or more of the `Options`_ below. 153 154After generating a buildsystem one may use the corresponding native 155build tool to build the project. For example, after using the 156:generator:`Unix Makefiles` generator one may run ``make`` directly: 157 158 .. code-block:: console 159 160 $ make 161 $ make install 162 163Alternatively, one may use **cmake** to `Build a Project`_ by 164automatically choosing and invoking the appropriate native build tool. 165 166.. _`CMake Options`: 167 168Options 169------- 170 171.. include:: OPTIONS_BUILD.txt 172 173``-L[A][H]`` 174 List non-advanced cached variables. 175 176 List ``CACHE`` variables will run CMake and list all the variables from 177 the CMake ``CACHE`` that are not marked as ``INTERNAL`` or :prop_cache:`ADVANCED`. 178 This will effectively display current CMake settings, which can then be 179 changed with ``-D`` option. Changing some of the variables may result 180 in more variables being created. If ``A`` is specified, then it will 181 display also advanced variables. If ``H`` is specified, it will also 182 display help for each variable. 183 184``-N`` 185 View mode only. 186 187 Only load the cache. Do not actually run configure and generate 188 steps. 189 190``--graphviz=[file]`` 191 Generate graphviz of dependencies, see :module:`CMakeGraphVizOptions` for more. 192 193 Generate a graphviz input file that will contain all the library and 194 executable dependencies in the project. See the documentation for 195 :module:`CMakeGraphVizOptions` for more details. 196 197``--system-information [file]`` 198 Dump information about this system. 199 200 Dump a wide range of information about the current system. If run 201 from the top of a binary tree for a CMake project it will dump 202 additional information such as the cache, log files etc. 203 204``--log-level=<ERROR|WARNING|NOTICE|STATUS|VERBOSE|DEBUG|TRACE>`` 205 Set the log level. 206 207 The :command:`message` command will only output messages of the specified 208 log level or higher. The default log level is ``STATUS``. 209 210 To make a log level persist between CMake runs, set 211 :variable:`CMAKE_MESSAGE_LOG_LEVEL` as a cache variable instead. 212 If both the command line option and the variable are given, the command line 213 option takes precedence. 214 215 For backward compatibility reasons, ``--loglevel`` is also accepted as a 216 synonym for this option. 217 218``--log-context`` 219 Enable the :command:`message` command outputting context attached to each 220 message. 221 222 This option turns on showing context for the current CMake run only. 223 To make showing the context persistent for all subsequent CMake runs, set 224 :variable:`CMAKE_MESSAGE_CONTEXT_SHOW` as a cache variable instead. 225 When this command line option is given, :variable:`CMAKE_MESSAGE_CONTEXT_SHOW` 226 is ignored. 227 228``--debug-trycompile`` 229 Do not delete the :command:`try_compile` build tree. 230 Only useful on one :command:`try_compile` at a time. 231 232 Do not delete the files and directories created for :command:`try_compile` 233 calls. This is useful in debugging failed try_compiles. It may 234 however change the results of the try-compiles as old junk from a 235 previous try-compile may cause a different test to either pass or 236 fail incorrectly. This option is best used for one try-compile at a 237 time, and only when debugging. 238 239``--debug-output`` 240 Put cmake in a debug mode. 241 242 Print extra information during the cmake run like stack traces with 243 :command:`message(SEND_ERROR)` calls. 244 245``--debug-find`` 246 Put cmake find commands in a debug mode. 247 248 Print extra find call information during the cmake run to standard 249 error. Output is designed for human consumption and not for parsing. 250 See also the :variable:`CMAKE_FIND_DEBUG_MODE` variable for debugging 251 a more local part of the project. 252 253``--trace`` 254 Put cmake in trace mode. 255 256 Print a trace of all calls made and from where. 257 258``--trace-expand`` 259 Put cmake in trace mode. 260 261 Like ``--trace``, but with variables expanded. 262 263``--trace-format=<format>`` 264 Put cmake in trace mode and sets the trace output format. 265 266 ``<format>`` can be one of the following values. 267 268 ``human`` 269 Prints each trace line in a human-readable format. This is the 270 default format. 271 272 ``json-v1`` 273 Prints each line as a separate JSON document. Each document is 274 separated by a newline ( ``\n`` ). It is guaranteed that no 275 newline characters will be present inside a JSON document. 276 277 JSON trace format: 278 279 .. code-block:: json 280 281 { 282 "file": "/full/path/to/the/CMake/file.txt", 283 "line": 0, 284 "cmd": "add_executable", 285 "args": ["foo", "bar"], 286 "time": 1579512535.9687231, 287 "frame": 2 288 } 289 290 The members are: 291 292 ``file`` 293 The full path to the CMake source file where the function 294 was called. 295 296 ``line`` 297 The line in ``file`` of the function call. 298 299 ``defer`` 300 Optional member that is present when the function call was deferred 301 by :command:`cmake_language(DEFER)`. If present, its value is a 302 string containing the deferred call ``<id>``. 303 304 ``cmd`` 305 The name of the function that was called. 306 307 ``args`` 308 A string list of all function parameters. 309 310 ``time`` 311 Timestamp (seconds since epoch) of the function call. 312 313 ``frame`` 314 Stack frame depth of the function that was called. 315 316 Additionally, the first JSON document outputted contains the 317 ``version`` key for the current major and minor version of the 318 319 JSON trace format: 320 321 .. code-block:: json 322 323 { 324 "version": { 325 "major": 1, 326 "minor": 1 327 } 328 } 329 330 The members are: 331 332 ``version`` 333 Indicates the version of the JSON format. The version has a 334 major and minor components following semantic version conventions. 335 336``--trace-source=<file>`` 337 Put cmake in trace mode, but output only lines of a specified file. 338 339 Multiple options are allowed. 340 341``--trace-redirect=<file>`` 342 Put cmake in trace mode and redirect trace output to a file instead of stderr. 343 344``--warn-uninitialized`` 345 Warn about uninitialized values. 346 347 Print a warning when an uninitialized variable is used. 348 349``--warn-unused-vars`` 350 Does nothing. In CMake versions 3.2 and below this enabled warnings about 351 unused variables. In CMake versions 3.3 through 3.18 the option was broken. 352 In CMake 3.19 and above the option has been removed. 353 354``--no-warn-unused-cli`` 355 Don't warn about command line options. 356 357 Don't find variables that are declared on the command line, but not 358 used. 359 360``--check-system-vars`` 361 Find problems with variable usage in system files. 362 363 Normally, unused and uninitialized variables are searched for only 364 in :variable:`CMAKE_SOURCE_DIR` and :variable:`CMAKE_BINARY_DIR`. 365 This flag tells CMake to warn about other files as well. 366 367``--profiling-output=<path>`` 368 Used in conjunction with ``--profiling-format`` to output to a given path. 369 370``--profiling-format=<file>`` 371 Enable the output of profiling data of CMake script in the given format. 372 373 This can aid performance analysis of CMake scripts executed. Third party 374 applications should be used to process the output into human readable format. 375 376 Currently supported values are: 377 ``google-trace`` Outputs in Google Trace Format, which can be parsed by the 378 about:tracing tab of Google Chrome or using a plugin for a tool like Trace 379 Compass. 380 381``--preset <preset>``, ``--preset=<preset>`` 382 Reads a :manual:`preset <cmake-presets(7)>` from 383 ``<path-to-source>/CMakePresets.json`` and 384 ``<path-to-source>/CMakeUserPresets.json``. The preset may specify the 385 generator and the build directory, and a list of variables and other 386 arguments to pass to CMake. The current working directory must contain 387 CMake preset files. The :manual:`CMake GUI <cmake-gui(1)>` can 388 also recognize ``CMakePresets.json`` and ``CMakeUserPresets.json`` files. For 389 full details on these files, see :manual:`cmake-presets(7)`. 390 391 The presets are read before all other command line options. The options 392 specified by the preset (variables, generator, etc.) can all be overridden by 393 manually specifying them on the command line. For example, if the preset sets 394 a variable called ``MYVAR`` to ``1``, but the user sets it to ``2`` with a 395 ``-D`` argument, the value ``2`` is preferred. 396 397``--list-presets, --list-presets=<[configure | build | test | all]>`` 398 Lists the available presets. If no option is specified only configure presets 399 will be listed. The current working directory must contain CMake preset files. 400 401.. _`Build Tool Mode`: 402 403Build a Project 404=============== 405 406CMake provides a command-line signature to build an already-generated 407project binary tree: 408 409.. code-block:: shell 410 411 cmake --build <dir> [<options>] [-- <build-tool-options>] 412 cmake --build --preset <preset> [<options>] [-- <build-tool-options>] 413 414This abstracts a native build tool's command-line interface with the 415following options: 416 417``--build <dir>`` 418 Project binary directory to be built. This is required (unless a preset 419 is specified) and must be first. 420 421``--preset <preset>``, ``--preset=<preset>`` 422 Use a build preset to specify build options. The project binary directory 423 is inferred from the ``configurePreset`` key. The current working directory 424 must contain CMake preset files. 425 See :manual:`preset <cmake-presets(7)>` for more details. 426 427``--list-presets`` 428 Lists the available build presets. The current working directory must 429 contain CMake preset files. 430 431``--parallel [<jobs>], -j [<jobs>]`` 432 The maximum number of concurrent processes to use when building. 433 If ``<jobs>`` is omitted the native build tool's default number is used. 434 435 The :envvar:`CMAKE_BUILD_PARALLEL_LEVEL` environment variable, if set, 436 specifies a default parallel level when this option is not given. 437 438 Some native build tools always build in parallel. The use of ``<jobs>`` 439 value of ``1`` can be used to limit to a single job. 440 441``--target <tgt>..., -t <tgt>...`` 442 Build ``<tgt>`` instead of the default target. Multiple targets may be 443 given, separated by spaces. 444 445``--config <cfg>`` 446 For multi-configuration tools, choose configuration ``<cfg>``. 447 448``--clean-first`` 449 Build target ``clean`` first, then build. 450 (To clean only, use ``--target clean``.) 451 452``--use-stderr`` 453 Ignored. Behavior is default in CMake >= 3.0. 454 455``--verbose, -v`` 456 Enable verbose output - if supported - including the build commands to be 457 executed. 458 459 This option can be omitted if :envvar:`VERBOSE` environment variable or 460 :variable:`CMAKE_VERBOSE_MAKEFILE` cached variable is set. 461 462 463``--`` 464 Pass remaining options to the native tool. 465 466Run ``cmake --build`` with no options for quick help. 467 468Install a Project 469================= 470 471CMake provides a command-line signature to install an already-generated 472project binary tree: 473 474.. code-block:: shell 475 476 cmake --install <dir> [<options>] 477 478This may be used after building a project to run installation without 479using the generated build system or the native build tool. 480The options are: 481 482``--install <dir>`` 483 Project binary directory to install. This is required and must be first. 484 485``--config <cfg>`` 486 For multi-configuration generators, choose configuration ``<cfg>``. 487 488``--component <comp>`` 489 Component-based install. Only install component ``<comp>``. 490 491``--default-directory-permissions <permissions>`` 492 Default directory install permissions. Permissions in format ``<u=rwx,g=rx,o=rx>``. 493 494``--prefix <prefix>`` 495 Override the installation prefix, :variable:`CMAKE_INSTALL_PREFIX`. 496 497``--strip`` 498 Strip before installing. 499 500``-v, --verbose`` 501 Enable verbose output. 502 503 This option can be omitted if :envvar:`VERBOSE` environment variable is set. 504 505Run ``cmake --install`` with no options for quick help. 506 507Open a Project 508============== 509 510.. code-block:: shell 511 512 cmake --open <dir> 513 514Open the generated project in the associated application. This is only 515supported by some generators. 516 517 518.. _`Script Processing Mode`: 519 520Run a Script 521============ 522 523.. code-block:: shell 524 525 cmake [{-D <var>=<value>}...] -P <cmake-script-file> [-- <unparsed-options>...] 526 527Process the given cmake file as a script written in the CMake 528language. No configure or generate step is performed and the cache 529is not modified. If variables are defined using ``-D``, this must be 530done before the ``-P`` argument. 531 532Any options after ``--`` are not parsed by CMake, but they are still included 533in the set of :variable:`CMAKE_ARGV<n> <CMAKE_ARGV0>` variables passed to the 534script (including the ``--`` itself). 535 536 537Run a Command-Line Tool 538======================= 539 540CMake provides builtin command-line tools through the signature 541 542.. code-block:: shell 543 544 cmake -E <command> [<options>] 545 546Run ``cmake -E`` or ``cmake -E help`` for a summary of commands. 547Available commands are: 548 549``capabilities`` 550 Report cmake capabilities in JSON format. The output is a JSON object 551 with the following keys: 552 553 ``version`` 554 A JSON object with version information. Keys are: 555 556 ``string`` 557 The full version string as displayed by cmake ``--version``. 558 ``major`` 559 The major version number in integer form. 560 ``minor`` 561 The minor version number in integer form. 562 ``patch`` 563 The patch level in integer form. 564 ``suffix`` 565 The cmake version suffix string. 566 ``isDirty`` 567 A bool that is set if the cmake build is from a dirty tree. 568 569 ``generators`` 570 A list available generators. Each generator is a JSON object with the 571 following keys: 572 573 ``name`` 574 A string containing the name of the generator. 575 ``toolsetSupport`` 576 ``true`` if the generator supports toolsets and ``false`` otherwise. 577 ``platformSupport`` 578 ``true`` if the generator supports platforms and ``false`` otherwise. 579 ``supportedPlatforms`` 580 .. versionadded:: 3.21 581 582 Optional member that may be present when the generator supports 583 platform specification via :variable:`CMAKE_GENERATOR_PLATFORM` 584 (``-A ...``). The value is a list of platforms known to be supported. 585 ``extraGenerators`` 586 A list of strings with all the extra generators compatible with 587 the generator. 588 589 ``fileApi`` 590 Optional member that is present when the :manual:`cmake-file-api(7)` 591 is available. The value is a JSON object with one member: 592 593 ``requests`` 594 A JSON array containing zero or more supported file-api requests. 595 Each request is a JSON object with members: 596 597 ``kind`` 598 Specifies one of the supported :ref:`file-api object kinds`. 599 600 ``version`` 601 A JSON array whose elements are each a JSON object containing 602 ``major`` and ``minor`` members specifying non-negative integer 603 version components. 604 605 ``serverMode`` 606 ``true`` if cmake supports server-mode and ``false`` otherwise. 607 Always false since CMake 3.20. 608 609``cat <files>...`` 610 Concatenate files and print on the standard output. 611 612``chdir <dir> <cmd> [<arg>...]`` 613 Change the current working directory and run a command. 614 615``compare_files [--ignore-eol] <file1> <file2>`` 616 Check if ``<file1>`` is same as ``<file2>``. If files are the same, 617 then returns ``0``, if not it returns ``1``. In case of invalid 618 arguments, it returns 2. The ``--ignore-eol`` option 619 implies line-wise comparison and ignores LF/CRLF differences. 620 621``copy <file>... <destination>`` 622 Copy files to ``<destination>`` (either file or directory). 623 If multiple files are specified, the ``<destination>`` must be 624 directory and it must exist. Wildcards are not supported. 625 ``copy`` does follow symlinks. That means it does not copy symlinks, 626 but the files or directories it point to. 627 628``copy_directory <dir>... <destination>`` 629 Copy content of ``<dir>...`` directories to ``<destination>`` directory. 630 If ``<destination>`` directory does not exist it will be created. 631 ``copy_directory`` does follow symlinks. 632 633``copy_if_different <file>... <destination>`` 634 Copy files to ``<destination>`` (either file or directory) if 635 they have changed. 636 If multiple files are specified, the ``<destination>`` must be 637 directory and it must exist. 638 ``copy_if_different`` does follow symlinks. 639 640``create_symlink <old> <new>`` 641 Create a symbolic link ``<new>`` naming ``<old>``. 642 643 .. note:: 644 Path to where ``<new>`` symbolic link will be created has to exist beforehand. 645 646``create_hardlink <old> <new>`` 647 Create a hard link ``<new>`` naming ``<old>``. 648 649 .. note:: 650 Path to where ``<new>`` hard link will be created has to exist beforehand. 651 ``<old>`` has to exist beforehand. 652 653``echo [<string>...]`` 654 Displays arguments as text. 655 656``echo_append [<string>...]`` 657 Displays arguments as text but no new line. 658 659``env [--unset=NAME]... [NAME=VALUE]... COMMAND [ARG]...`` 660 Run command in a modified environment. 661 662``environment`` 663 Display the current environment variables. 664 665``false`` 666 Do nothing, with an exit code of 1. 667 668``make_directory <dir>...`` 669 Create ``<dir>`` directories. If necessary, create parent 670 directories too. If a directory already exists it will be 671 silently ignored. 672 673``md5sum <file>...`` 674 Create MD5 checksum of files in ``md5sum`` compatible format:: 675 676 351abe79cd3800b38cdfb25d45015a15 file1.txt 677 052f86c15bbde68af55c7f7b340ab639 file2.txt 678 679``sha1sum <file>...`` 680 Create SHA1 checksum of files in ``sha1sum`` compatible format:: 681 682 4bb7932a29e6f73c97bb9272f2bdc393122f86e0 file1.txt 683 1df4c8f318665f9a5f2ed38f55adadb7ef9f559c file2.txt 684 685``sha224sum <file>...`` 686 Create SHA224 checksum of files in ``sha224sum`` compatible format:: 687 688 b9b9346bc8437bbda630b0b7ddfc5ea9ca157546dbbf4c613192f930 file1.txt 689 6dfbe55f4d2edc5fe5c9197bca51ceaaf824e48eba0cc453088aee24 file2.txt 690 691``sha256sum <file>...`` 692 Create SHA256 checksum of files in ``sha256sum`` compatible format:: 693 694 76713b23615d31680afeb0e9efe94d47d3d4229191198bb46d7485f9cb191acc file1.txt 695 15b682ead6c12dedb1baf91231e1e89cfc7974b3787c1e2e01b986bffadae0ea file2.txt 696 697``sha384sum <file>...`` 698 Create SHA384 checksum of files in ``sha384sum`` compatible format:: 699 700 acc049fedc091a22f5f2ce39a43b9057fd93c910e9afd76a6411a28a8f2b8a12c73d7129e292f94fc0329c309df49434 file1.txt 701 668ddeb108710d271ee21c0f3acbd6a7517e2b78f9181c6a2ff3b8943af92b0195dcb7cce48aa3e17893173c0a39e23d file2.txt 702 703``sha512sum <file>...`` 704 Create SHA512 checksum of files in ``sha512sum`` compatible format:: 705 706 2a78d7a6c5328cfb1467c63beac8ff21794213901eaadafd48e7800289afbc08e5fb3e86aa31116c945ee3d7bf2a6194489ec6101051083d1108defc8e1dba89 file1.txt 707 7a0b54896fe5e70cca6dd643ad6f672614b189bf26f8153061c4d219474b05dad08c4e729af9f4b009f1a1a280cb625454bf587c690f4617c27e3aebdf3b7a2d file2.txt 708 709``remove [-f] <file>...`` 710 .. deprecated:: 3.17 711 712 Remove the file(s). The planned behavior was that if any of the 713 listed files already do not exist, the command returns a non-zero exit code, 714 but no message is logged. The ``-f`` option changes the behavior to return a 715 zero exit code (i.e. success) in such situations instead. 716 ``remove`` does not follow symlinks. That means it remove only symlinks 717 and not files it point to. 718 719 The implementation was buggy and always returned 0. It cannot be fixed without 720 breaking backwards compatibility. Use ``rm`` instead. 721 722``remove_directory <dir>...`` 723 .. deprecated:: 3.17 724 725 Remove ``<dir>`` directories and their contents. If a directory does 726 not exist it will be silently ignored. If ``<dir>`` is a symlink to 727 a directory, just the symlink will be removed. 728 Use ``rm`` instead. 729 730``rename <oldname> <newname>`` 731 Rename a file or directory (on one volume). If file with the ``<newname>`` name 732 already exists, then it will be silently replaced. 733 734``rm [-rRf] <file> <dir>...`` 735 Remove the files ``<file>`` or directories ``dir``. 736 Use ``-r`` or ``-R`` to remove directories and their contents recursively. 737 If any of the listed files/directories do not exist, the command returns a 738 non-zero exit code, but no message is logged. The ``-f`` option changes 739 the behavior to return a zero exit code (i.e. success) in such 740 situations instead. 741 742``server`` 743 Launch :manual:`cmake-server(7)` mode. 744 745``sleep <number>...`` 746 Sleep for given number of seconds. 747 748``tar [cxt][vf][zjJ] file.tar [<options>] [--] [<pathname>...]`` 749 Create or extract a tar or zip archive. Options are: 750 751 ``c`` 752 Create a new archive containing the specified files. 753 If used, the ``<pathname>...`` argument is mandatory. 754 ``x`` 755 Extract to disk from the archive. 756 The ``<pathname>...`` argument could be used to extract only selected files 757 or directories. 758 When extracting selected files or directories, you must provide their exact 759 names including the path, as printed by list (``-t``). 760 ``t`` 761 List archive contents. 762 The ``<pathname>...`` argument could be used to list only selected files 763 or directories. 764 ``v`` 765 Produce verbose output. 766 ``z`` 767 Compress the resulting archive with gzip. 768 ``j`` 769 Compress the resulting archive with bzip2. 770 ``J`` 771 Compress the resulting archive with XZ. 772 ``--zstd`` 773 Compress the resulting archive with Zstandard. 774 ``--files-from=<file>`` 775 Read file names from the given file, one per line. 776 Blank lines are ignored. Lines may not start in ``-`` 777 except for ``--add-file=<name>`` to add files whose 778 names start in ``-``. 779 ``--format=<format>`` 780 Specify the format of the archive to be created. 781 Supported formats are: ``7zip``, ``gnutar``, ``pax``, 782 ``paxr`` (restricted pax, default), and ``zip``. 783 ``--mtime=<date>`` 784 Specify modification time recorded in tarball entries. 785 ``--`` 786 Stop interpreting options and treat all remaining arguments 787 as file names, even if they start with ``-``. 788 789 790``time <command> [<args>...]`` 791 Run command and display elapsed time. 792 793``touch <file>...`` 794 Creates ``<file>`` if file do not exist. 795 If ``<file>`` exists, it is changing ``<file>`` access and modification times. 796 797``touch_nocreate <file>...`` 798 Touch a file if it exists but do not create it. If a file does 799 not exist it will be silently ignored. 800 801``true`` 802 Do nothing, with an exit code of 0. 803 804Windows-specific Command-Line Tools 805----------------------------------- 806 807The following ``cmake -E`` commands are available only on Windows: 808 809``delete_regv <key>`` 810 Delete Windows registry value. 811 812``env_vs8_wince <sdkname>`` 813 Displays a batch file which sets the environment for the provided 814 Windows CE SDK installed in VS2005. 815 816``env_vs9_wince <sdkname>`` 817 Displays a batch file which sets the environment for the provided 818 Windows CE SDK installed in VS2008. 819 820``write_regv <key> <value>`` 821 Write Windows registry value. 822 823 824Run the Find-Package Tool 825========================= 826 827CMake provides a pkg-config like helper for Makefile-based projects: 828 829.. code-block:: shell 830 831 cmake --find-package [<options>] 832 833It searches a package using :command:`find_package()` and prints the 834resulting flags to stdout. This can be used instead of pkg-config 835to find installed libraries in plain Makefile-based projects or in 836autoconf-based projects (via ``share/aclocal/cmake.m4``). 837 838.. note:: 839 This mode is not well-supported due to some technical limitations. 840 It is kept for compatibility but should not be used in new projects. 841 842 843View Help 844========= 845 846To print selected pages from the CMake documentation, use 847 848.. code-block:: shell 849 850 cmake --help[-<topic>] 851 852with one of the following options: 853 854.. include:: OPTIONS_HELP.txt 855 856To view the presets available for a project, use 857 858.. code-block:: shell 859 860 cmake <source-dir> --list-presets 861 862See Also 863======== 864 865.. include:: LINKS.txt 866