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