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 ac‐
38 tions 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 li‐
57 braries 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 ex‐
111 isting 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 di‐
153 rectory.
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 op‐
167 tion, 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 op‐
179 tion 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 er‐
277 rors.
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 AD‐
284 VANCED. 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 in‐
381 side 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_language(DE‐
403 FER). If present, its value is a string con‐
404 taining 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 in‐
444 stead 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>, --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 current
491 working directory must contain CMake preset files. The CMake GUI
492 can also recognize CMakePresets.json and CMakeUserPresets.json
493 files. For full details on these files, see cmake-presets(7).
494
495 The presets are read before all other command line options. The
496 options specified by the preset (variables, generator, etc.) can
497 all be overridden by manually specifying them on the command
498 line. For example, if the preset sets a variable called MYVAR to
499 1, but the user sets it to 2 with a -D argument, the value 2 is
500 preferred.
501
502 --list-presets, --list-presets=<[configure | build | test | all]>
503 Lists the available presets. If no option is specified only con‐
504 figure presets will be listed. The current working directory
505 must contain CMake preset files.
506
508 CMake provides a command-line signature to build an already-generated
509 project binary tree:
510
511 cmake --build [<dir> | --preset <preset>] [<options>] [-- <build-tool-options>]
512
513 This abstracts a native build tool's command-line interface with the
514 following options:
515
516 --build <dir>
517 Project binary directory to be built. This is required (unless
518 a preset is specified) and must be first.
519
520 --preset <preset>, --preset=<preset>
521 Use a build preset to specify build options. The project binary
522 directory is inferred from the configurePreset key. The current
523 working directory must contain CMake preset files. See preset
524 for more details.
525
526 --list-presets
527 Lists the available build presets. The current working directory
528 must contain CMake preset files.
529
530 --parallel [<jobs>], -j [<jobs>]
531 The maximum number of concurrent processes to use when building.
532 If <jobs> is omitted the native build tool's default number is
533 used.
534
535 The CMAKE_BUILD_PARALLEL_LEVEL environment variable, if set,
536 specifies a default parallel level when this option is not
537 given.
538
539 Some native build tools always build in parallel. The use of
540 <jobs> value of 1 can be used to limit to a single job.
541
542 --target <tgt>..., -t <tgt>...
543 Build <tgt> instead of the default target. Multiple targets may
544 be given, separated by spaces.
545
546 --config <cfg>
547 For multi-configuration tools, choose configuration <cfg>.
548
549 --clean-first
550 Build target clean first, then build. (To clean only, use
551 --target clean.)
552
553 --use-stderr
554 Ignored. Behavior is default in CMake >= 3.0.
555
556 --verbose, -v
557 Enable verbose output - if supported - including the build com‐
558 mands to be executed.
559
560 This option can be omitted if VERBOSE environment variable or
561 CMAKE_VERBOSE_MAKEFILE cached variable is set.
562
563 -- Pass remaining options to the native tool.
564
565 Run cmake --build with no options for quick help.
566
568 CMake provides a command-line signature to install an already-generated
569 project binary tree:
570
571 cmake --install <dir> [<options>]
572
573 This may be used after building a project to run installation without
574 using the generated build system or the native build tool. The options
575 are:
576
577 --install <dir>
578 Project binary directory to install. This is required and must
579 be first.
580
581 --config <cfg>
582 For multi-configuration generators, choose configuration <cfg>.
583
584 --component <comp>
585 Component-based install. Only install component <comp>.
586
587 --default-directory-permissions <permissions>
588 Default directory install permissions. Permissions in format
589 <u=rwx,g=rx,o=rx>.
590
591 --prefix <prefix>
592 Override the installation prefix, CMAKE_INSTALL_PREFIX.
593
594 --strip
595 Strip before installing.
596
597 -v, --verbose
598 Enable verbose output.
599
600 This option can be omitted if VERBOSE environment variable is
601 set.
602
603 Run cmake --install with no options for quick help.
604
606 cmake --open <dir>
607
608 Open the generated project in the associated application. This is only
609 supported by some generators.
610
612 cmake [{-D <var>=<value>}...] -P <cmake-script-file> [-- <unparsed-options>...]
613
614 Process the given cmake file as a script written in the CMake language.
615 No configure or generate step is performed and the cache is not modi‐
616 fied. If variables are defined using -D, this must be done before the
617 -P argument.
618
619 Any options after -- are not parsed by CMake, but they are still in‐
620 cluded in the set of CMAKE_ARGV<n> variables passed to the script (in‐
621 cluding the -- itself).
622
624 CMake provides builtin command-line tools through the signature
625
626 cmake -E <command> [<options>]
627
628 Run cmake -E or cmake -E help for a summary of commands. Available
629 commands are:
630
631 capabilities
632 Report cmake capabilities in JSON format. The output is a JSON
633 object with the following keys:
634
635 version
636 A JSON object with version information. Keys are:
637
638 string The full version string as displayed by cmake
639 --version.
640
641 major The major version number in integer form.
642
643 minor The minor version number in integer form.
644
645 patch The patch level in integer form.
646
647 suffix The cmake version suffix string.
648
649 isDirty
650 A bool that is set if the cmake build is from a
651 dirty tree.
652
653 generators
654 A list available generators. Each generator is a JSON ob‐
655 ject with the following keys:
656
657 name A string containing the name of the generator.
658
659 toolsetSupport
660 true if the generator supports toolsets and false
661 otherwise.
662
663 platformSupport
664 true if the generator supports platforms and false
665 otherwise.
666
667 extraGenerators
668 A list of strings with all the extra generators
669 compatible with the generator.
670
671 fileApi
672 Optional member that is present when the
673 cmake-file-api(7) is available. The value is a JSON ob‐
674 ject with one member:
675
676 requests
677 A JSON array containing zero or more supported
678 file-api requests. Each request is a JSON object
679 with members:
680
681 kind Specifies one of the supported file-api ob‐
682 ject kinds.
683
684 version
685 A JSON array whose elements are each a JSON
686 object containing major and minor members
687 specifying non-negative integer version
688 components.
689
690 serverMode
691 true if cmake supports server-mode and false otherwise.
692 Always false since CMake 3.20.
693
694 cat <files>...
695 Concatenate files and print on the standard output.
696
697 chdir <dir> <cmd> [<arg>...]
698 Change the current working directory and run a command.
699
700 compare_files [--ignore-eol] <file1> <file2>
701 Check if <file1> is same as <file2>. If files are the same, then
702 returns 0, if not it returns 1. In case of invalid arguments,
703 it returns 2. The --ignore-eol option implies line-wise compari‐
704 son and ignores LF/CRLF differences.
705
706 copy <file>... <destination>
707 Copy files to <destination> (either file or directory). If mul‐
708 tiple files are specified, the <destination> must be directory
709 and it must exist. Wildcards are not supported. copy does fol‐
710 low symlinks. That means it does not copy symlinks, but the
711 files or directories it point to.
712
713 copy_directory <dir>... <destination>
714 Copy content of <dir>... directories to <destination> directory.
715 If <destination> directory does not exist it will be created.
716 copy_directory does follow symlinks.
717
718 copy_if_different <file>... <destination>
719 Copy files to <destination> (either file or directory) if they
720 have changed. If multiple files are specified, the <destina‐
721 tion> must be directory and it must exist. copy_if_different
722 does follow symlinks.
723
724 create_symlink <old> <new>
725 Create a symbolic link <new> naming <old>.
726
727 NOTE:
728 Path to where <new> symbolic link will be created has to ex‐
729 ist beforehand.
730
731 create_hardlink <old> <new>
732 Create a hard link <new> naming <old>.
733
734 NOTE:
735 Path to where <new> hard link will be created has to exist
736 beforehand. <old> has to exist beforehand.
737
738 echo [<string>...]
739 Displays arguments as text.
740
741 echo_append [<string>...]
742 Displays arguments as text but no new line.
743
744 env [--unset=NAME]... [NAME=VALUE]... COMMAND [ARG]...
745 Run command in a modified environment.
746
747 environment
748 Display the current environment variables.
749
750 false Do nothing, with an exit code of 1.
751
752 make_directory <dir>...
753 Create <dir> directories. If necessary, create parent directo‐
754 ries too. If a directory already exists it will be silently ig‐
755 nored.
756
757 md5sum <file>...
758 Create MD5 checksum of files in md5sum compatible format:
759
760 351abe79cd3800b38cdfb25d45015a15 file1.txt
761 052f86c15bbde68af55c7f7b340ab639 file2.txt
762
763 sha1sum <file>...
764 Create SHA1 checksum of files in sha1sum compatible format:
765
766 4bb7932a29e6f73c97bb9272f2bdc393122f86e0 file1.txt
767 1df4c8f318665f9a5f2ed38f55adadb7ef9f559c file2.txt
768
769 sha224sum <file>...
770 Create SHA224 checksum of files in sha224sum compatible format:
771
772 b9b9346bc8437bbda630b0b7ddfc5ea9ca157546dbbf4c613192f930 file1.txt
773 6dfbe55f4d2edc5fe5c9197bca51ceaaf824e48eba0cc453088aee24 file2.txt
774
775 sha256sum <file>...
776 Create SHA256 checksum of files in sha256sum compatible format:
777
778 76713b23615d31680afeb0e9efe94d47d3d4229191198bb46d7485f9cb191acc file1.txt
779 15b682ead6c12dedb1baf91231e1e89cfc7974b3787c1e2e01b986bffadae0ea file2.txt
780
781 sha384sum <file>...
782 Create SHA384 checksum of files in sha384sum compatible format:
783
784 acc049fedc091a22f5f2ce39a43b9057fd93c910e9afd76a6411a28a8f2b8a12c73d7129e292f94fc0329c309df49434 file1.txt
785 668ddeb108710d271ee21c0f3acbd6a7517e2b78f9181c6a2ff3b8943af92b0195dcb7cce48aa3e17893173c0a39e23d file2.txt
786
787 sha512sum <file>...
788 Create SHA512 checksum of files in sha512sum compatible format:
789
790 2a78d7a6c5328cfb1467c63beac8ff21794213901eaadafd48e7800289afbc08e5fb3e86aa31116c945ee3d7bf2a6194489ec6101051083d1108defc8e1dba89 file1.txt
791 7a0b54896fe5e70cca6dd643ad6f672614b189bf26f8153061c4d219474b05dad08c4e729af9f4b009f1a1a280cb625454bf587c690f4617c27e3aebdf3b7a2d file2.txt
792
793 remove [-f] <file>...
794 Deprecated since version 3.17.
795
796
797 Remove the file(s). The planned behaviour was that if any of the
798 listed files already do not exist, the command returns a
799 non-zero exit code, but no message is logged. The -f option
800 changes the behavior to return a zero exit code (i.e. success)
801 in such situations instead. remove does not follow symlinks.
802 That means it remove only symlinks and not files it point to.
803
804 The implementation was buggy and always returned 0. It cannot be
805 fixed without breaking backwards compatibility. Use rm instead.
806
807 remove_directory <dir>...
808 Deprecated since version 3.17.
809
810
811 Remove <dir> directories and their contents. If a directory does
812 not exist it will be silently ignored. If <dir> is a symlink to
813 a directory, just the symlink will be removed. Use rm instead.
814
815 rename <oldname> <newname>
816 Rename a file or directory (on one volume). If file with the
817 <newname> name already exists, then it will be silently re‐
818 placed.
819
820 rm [-rRf] <file> <dir>...
821 Remove the files <file> or directories dir. Use -r or -R to re‐
822 move directories and their contents recursively. If any of the
823 listed files/directories do not exist, the command returns a
824 non-zero exit code, but no message is logged. The -f option
825 changes the behavior to return a zero exit code (i.e. success)
826 in such situations instead.
827
828 server Launch cmake-server(7) mode.
829
830 sleep <number>...
831 Sleep for given number of seconds.
832
833 tar [cxt][vf][zjJ] file.tar [<options>] [--] [<pathname>...]
834 Create or extract a tar or zip archive. Options are:
835
836 c Create a new archive containing the specified files. If
837 used, the <pathname>... argument is mandatory.
838
839 x Extract to disk from the archive. The <pathname>... ar‐
840 gument could be used to extract only selected files or
841 directories. When extracting selected files or directo‐
842 ries, you must provide their exact names including the
843 path, as printed by list (-t).
844
845 t List archive contents. The <pathname>... argument could
846 be used to list only selected files or directories.
847
848 v Produce verbose output.
849
850 z Compress the resulting archive with gzip.
851
852 j Compress the resulting archive with bzip2.
853
854 J Compress the resulting archive with XZ.
855
856 --zstd Compress the resulting archive with Zstandard.
857
858 --files-from=<file>
859 Read file names from the given file, one per line. Blank
860 lines are ignored. Lines may not start in - except for
861 --add-file=<name> to add files whose names start in -.
862
863 --format=<format>
864 Specify the format of the archive to be created. Sup‐
865 ported formats are: 7zip, gnutar, pax, paxr (restricted
866 pax, default), and zip.
867
868 --mtime=<date>
869 Specify modification time recorded in tarball entries.
870
871 -- Stop interpreting options and treat all remaining argu‐
872 ments as file names, even if they start with -.
873
874 time <command> [<args>...]
875 Run command and display elapsed time.
876
877 touch <file>...
878 Creates <file> if file do not exist. If <file> exists, it is
879 changing <file> access and modification times.
880
881 touch_nocreate <file>...
882 Touch a file if it exists but do not create it. If a file does
883 not exist it will be silently ignored.
884
885 true Do nothing, with an exit code of 0.
886
887 Windows-specific Command-Line Tools
888 The following cmake -E commands are available only on Windows:
889
890 delete_regv <key>
891 Delete Windows registry value.
892
893 env_vs8_wince <sdkname>
894 Displays a batch file which sets the environment for the pro‐
895 vided Windows CE SDK installed in VS2005.
896
897 env_vs9_wince <sdkname>
898 Displays a batch file which sets the environment for the pro‐
899 vided Windows CE SDK installed in VS2008.
900
901 write_regv <key> <value>
902 Write Windows registry value.
903
905 CMake provides a pkg-config like helper for Makefile-based projects:
906
907 cmake --find-package [<options>]
908
909 It searches a package using find_package() and prints the resulting
910 flags to stdout. This can be used instead of pkg-config to find in‐
911 stalled libraries in plain Makefile-based projects or in autoconf-based
912 projects (via share/aclocal/cmake.m4).
913
914 NOTE:
915 This mode is not well-supported due to some technical limitations.
916 It is kept for compatibility but should not be used in new projects.
917
919 To print selected pages from the CMake documentation, use
920
921 cmake --help[-<topic>]
922
923 with one of the following options:
924
925 --help,-help,-usage,-h,-H,/?
926 Print usage information and exit.
927
928 Usage describes the basic command line interface and its op‐
929 tions.
930
931 --version,-version,/V [<f>]
932 Show program name/version banner and exit.
933
934 If a file is specified, the version is written into it. The
935 help is printed to a named <f>ile if given.
936
937 --help-full [<f>]
938 Print all help manuals and exit.
939
940 All manuals are printed in a human-readable text format. The
941 help is printed to a named <f>ile if given.
942
943 --help-manual <man> [<f>]
944 Print one help manual and exit.
945
946 The specified manual is printed in a human-readable text format.
947 The help is printed to a named <f>ile if given.
948
949 --help-manual-list [<f>]
950 List help manuals available and exit.
951
952 The list contains all manuals for which help may be obtained by
953 using the --help-manual option followed by a manual name. The
954 help is printed to a named <f>ile if given.
955
956 --help-command <cmd> [<f>]
957 Print help for one command and exit.
958
959 The cmake-commands(7) manual entry for <cmd> is printed in a hu‐
960 man-readable text format. The help is printed to a named <f>ile
961 if given.
962
963 --help-command-list [<f>]
964 List commands with help available and exit.
965
966 The list contains all commands for which help may be obtained by
967 using the --help-command option followed by a command name. The
968 help is printed to a named <f>ile if given.
969
970 --help-commands [<f>]
971 Print cmake-commands manual and exit.
972
973 The cmake-commands(7) manual is printed in a human-readable text
974 format. The help is printed to a named <f>ile if given.
975
976 --help-module <mod> [<f>]
977 Print help for one module and exit.
978
979 The cmake-modules(7) manual entry for <mod> is printed in a hu‐
980 man-readable text format. The help is printed to a named <f>ile
981 if given.
982
983 --help-module-list [<f>]
984 List modules with help available and exit.
985
986 The list contains all modules for which help may be obtained by
987 using the --help-module option followed by a module name. The
988 help is printed to a named <f>ile if given.
989
990 --help-modules [<f>]
991 Print cmake-modules manual and exit.
992
993 The cmake-modules(7) manual is printed in a human-readable text
994 format. The help is printed to a named <f>ile if given.
995
996 --help-policy <cmp> [<f>]
997 Print help for one policy and exit.
998
999 The cmake-policies(7) manual entry for <cmp> is printed in a hu‐
1000 man-readable text format. The help is printed to a named <f>ile
1001 if given.
1002
1003 --help-policy-list [<f>]
1004 List policies with help available and exit.
1005
1006 The list contains all policies for which help may be obtained by
1007 using the --help-policy option followed by a policy name. The
1008 help is printed to a named <f>ile if given.
1009
1010 --help-policies [<f>]
1011 Print cmake-policies manual and exit.
1012
1013 The cmake-policies(7) manual is printed in a human-readable text
1014 format. The help is printed to a named <f>ile if given.
1015
1016 --help-property <prop> [<f>]
1017 Print help for one property and exit.
1018
1019 The cmake-properties(7) manual entries for <prop> are printed in
1020 a human-readable text format. The help is printed to a named
1021 <f>ile if given.
1022
1023 --help-property-list [<f>]
1024 List properties with help available and exit.
1025
1026 The list contains all properties for which help may be obtained
1027 by using the --help-property option followed by a property name.
1028 The help is printed to a named <f>ile if given.
1029
1030 --help-properties [<f>]
1031 Print cmake-properties manual and exit.
1032
1033 The cmake-properties(7) manual is printed in a human-readable
1034 text format. The help is printed to a named <f>ile if given.
1035
1036 --help-variable <var> [<f>]
1037 Print help for one variable and exit.
1038
1039 The cmake-variables(7) manual entry for <var> is printed in a
1040 human-readable text format. The help is printed to a named
1041 <f>ile if given.
1042
1043 --help-variable-list [<f>]
1044 List variables with help available and exit.
1045
1046 The list contains all variables for which help may be obtained
1047 by using the --help-variable option followed by a variable name.
1048 The help is printed to a named <f>ile if given.
1049
1050 --help-variables [<f>]
1051 Print cmake-variables manual and exit.
1052
1053 The cmake-variables(7) manual is printed in a human-readable
1054 text format. The help is printed to a named <f>ile if given.
1055
1056 To view the presets available for a project, use
1057
1058 cmake <source-dir> --list-presets
1059
1061 The following resources are available to get help using CMake:
1062
1063 Home Page
1064 https://cmake.org
1065
1066 The primary starting point for learning about CMake.
1067
1068 Online Documentation and Community Resources
1069 https://cmake.org/documentation
1070
1071 Links to available documentation and community resources may be
1072 found on this web page.
1073
1074 Discourse Forum
1075 https://discourse.cmake.org
1076
1077 The Discourse Forum hosts discussion and questions about CMake.
1078
1080 2000-2021 Kitware, Inc. and Contributors
1081
1082
1083
1084
10853.20.3 May 30, 2021 CMAKE(1)