cmake.1.rst 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. .. cmake-manual-description: CMake Command-Line Reference
  2. cmake(1)
  3. ********
  4. Synopsis
  5. ========
  6. .. parsed-literal::
  7. cmake [<options>] (<path-to-source> | <path-to-existing-build>)
  8. cmake [(-D<var>=<value>)...] -P <cmake-script-file>
  9. cmake --build <dir> [<options>] [-- <build-tool-options>...]
  10. cmake -E <command> [<options>...]
  11. cmake --find-package <options>...
  12. Description
  13. ===========
  14. The "cmake" executable is the CMake command-line interface. It may be
  15. used to configure projects in scripts. Project configuration settings
  16. may be specified on the command line with the -D option.
  17. CMake is a cross-platform build system generator. Projects specify
  18. their build process with platform-independent CMake listfiles included
  19. in each directory of a source tree with the name CMakeLists.txt.
  20. Users build a project by using CMake to generate a build system for a
  21. native tool on their platform.
  22. Options
  23. =======
  24. .. include:: OPTIONS_BUILD.txt
  25. ``-E <command> [<options>...]``
  26. See `Command-Line Tool Mode`_.
  27. ``-L[A][H]``
  28. List non-advanced cached variables.
  29. List cache variables will run CMake and list all the variables from
  30. the CMake cache that are not marked as INTERNAL or ADVANCED. This
  31. will effectively display current CMake settings, which can then be
  32. changed with -D option. Changing some of the variables may result
  33. in more variables being created. If A is specified, then it will
  34. display also advanced variables. If H is specified, it will also
  35. display help for each variable.
  36. ``--build <dir>``
  37. Build a CMake-generated project binary tree.
  38. This abstracts a native build tool's command-line interface with the
  39. following options:
  40. ::
  41. <dir> = Project binary directory to be built.
  42. --target <tgt> = Build <tgt> instead of default targets.
  43. --config <cfg> = For multi-configuration tools, choose <cfg>.
  44. --clean-first = Build target 'clean' first, then build.
  45. (To clean only, use --target 'clean'.)
  46. --use-stderr = Ignored. Behavior is default in CMake >= 3.0.
  47. -- = Pass remaining options to the native tool.
  48. Run cmake --build with no options for quick help.
  49. ``-N``
  50. View mode only.
  51. Only load the cache. Do not actually run configure and generate
  52. steps.
  53. ``-P <file>``
  54. Process script mode.
  55. Process the given cmake file as a script written in the CMake
  56. language. No configure or generate step is performed and the cache
  57. is not modified. If variables are defined using -D, this must be
  58. done before the -P argument.
  59. ``--find-package``
  60. Run in pkg-config like mode.
  61. Search a package using find_package() and print the resulting flags
  62. to stdout. This can be used to use cmake instead of pkg-config to
  63. find installed libraries in plain Makefile-based projects or in
  64. autoconf-based projects (via share/aclocal/cmake.m4).
  65. ``--graphviz=[file]``
  66. Generate graphviz of dependencies, see CMakeGraphVizOptions.cmake for more.
  67. Generate a graphviz input file that will contain all the library and
  68. executable dependencies in the project. See the documentation for
  69. CMakeGraphVizOptions.cmake for more details.
  70. ``--system-information [file]``
  71. Dump information about this system.
  72. Dump a wide range of information about the current system. If run
  73. from the top of a binary tree for a CMake project it will dump
  74. additional information such as the cache, log files etc.
  75. ``--debug-trycompile``
  76. Do not delete the try_compile build tree. Only useful on one try_compile at a time.
  77. Do not delete the files and directories created for try_compile
  78. calls. This is useful in debugging failed try_compiles. It may
  79. however change the results of the try-compiles as old junk from a
  80. previous try-compile may cause a different test to either pass or
  81. fail incorrectly. This option is best used for one try-compile at a
  82. time, and only when debugging.
  83. ``--debug-output``
  84. Put cmake in a debug mode.
  85. Print extra stuff during the cmake run like stack traces with
  86. message(send_error ) calls.
  87. ``--trace``
  88. Put cmake in trace mode.
  89. Print a trace of all calls made and from where with
  90. message(send_error ) calls.
  91. ``--warn-uninitialized``
  92. Warn about uninitialized values.
  93. Print a warning when an uninitialized variable is used.
  94. ``--warn-unused-vars``
  95. Warn about unused variables.
  96. Find variables that are declared or set, but not used.
  97. ``--no-warn-unused-cli``
  98. Don't warn about command line options.
  99. Don't find variables that are declared on the command line, but not
  100. used.
  101. ``--check-system-vars``
  102. Find problems with variable usage in system files.
  103. Normally, unused and uninitialized variables are searched for only
  104. in CMAKE_SOURCE_DIR and CMAKE_BINARY_DIR. This flag tells CMake to
  105. warn about other files as well.
  106. .. include:: OPTIONS_HELP.txt
  107. Command-Line Tool Mode
  108. ======================
  109. CMake provides builtin command-line tools through the signature::
  110. cmake -E <command> [<options>...]
  111. Run ``cmake -E`` or ``cmake -E help`` for a summary of commands.
  112. Available commands are:
  113. ``chdir <dir> <cmd> [<arg>...]``
  114. Change the current working directory and run a command.
  115. ``compare_files <file1> <file2>``
  116. Check if file1 is same as file2.
  117. ``copy <file> <destination>``
  118. Copy file to destination (either file or directory).
  119. ``copy_directory <source> <destination>``
  120. Copy directory 'source' content to directory 'destination'.
  121. ``copy_if_different <in-file> <out-file>``
  122. Copy file if input has changed.
  123. ``echo [<string>...]``
  124. Displays arguments as text.
  125. ``echo_append [<string>...]``
  126. Displays arguments as text but no new line.
  127. ``env [--unset=NAME]... [NAME=VALUE]... COMMAND [ARG]...``
  128. Run command in a modified environment.
  129. ``environment``
  130. Display the current environment.
  131. ``make_directory <dir>``
  132. Create a directory.
  133. ``md5sum [<file>...]``
  134. Compute md5sum of files.
  135. ``remove [-f] [<file>...]``
  136. Remove the file(s), use ``-f`` to force it.
  137. ``remove_directory <dir>``
  138. Remove a directory and its contents.
  139. ``rename <oldname> <newname>``
  140. Rename a file or directory (on one volume).
  141. ``sleep <number>...``
  142. Sleep for given number of seconds.
  143. ``tar [cxt][vf][zjJ] file.tar [<options>...] [--] [<file>...]``
  144. Create or extract a tar or zip archive. Options are:
  145. ``--``
  146. Stop interpreting options and treat all remaining arguments
  147. as file names even if they start in ``-``.
  148. ``--files-from=<file>``
  149. Read file names from the given file, one per line.
  150. Blank lines are ignored. Lines may not start in ``-``
  151. except for ``--add-file=<name>`` to add files whose
  152. names start in ``-``.
  153. ``--mtime=<date>``
  154. Specify modification time recorded in tarball entries.
  155. ``--format=<format>``
  156. Specify the format of the archive to be created.
  157. Supported formats are: ``7zip``, ``gnutar``, ``pax``,
  158. ``paxr`` (restricted pax, default), and ``zip``.
  159. ``time <command> [<args>...]``
  160. Run command and return elapsed time.
  161. ``touch <file>``
  162. Touch a file.
  163. ``touch_nocreate <file>``
  164. Touch a file if it exists but do not create it.
  165. UNIX-specific Command-Line Tools
  166. --------------------------------
  167. The following ``cmake -E`` commands are available only on UNIX:
  168. ``create_symlink <old> <new>``
  169. Create a symbolic link ``<new>`` naming ``<old>``.
  170. Windows-specific Command-Line Tools
  171. -----------------------------------
  172. The following ``cmake -E`` commands are available only on Windows:
  173. ``delete_regv <key>``
  174. Delete Windows registry value.
  175. ``env_vs8_wince <sdkname>``
  176. Displays a batch file which sets the environment for the provided
  177. Windows CE SDK installed in VS2005.
  178. ``env_vs9_wince <sdkname>``
  179. Displays a batch file which sets the environment for the provided
  180. Windows CE SDK installed in VS2008.
  181. ``write_regv <key> <value>``
  182. Write Windows registry value.
  183. See Also
  184. ========
  185. .. include:: LINKS.txt