cmake.1.rst 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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``
  26. CMake command mode.
  27. For true platform independence, CMake provides a list of commands
  28. that can be used on all systems. Run with -E help for the usage
  29. information. Commands available are: chdir, compare_files, copy,
  30. copy_directory, copy_if_different, echo, echo_append, env, environment,
  31. make_directory, md5sum, remove, remove_directory, rename, sleep, tar, time,
  32. touch, touch_nocreate. In addition, some platform specific commands
  33. are available. On Windows: delete_regv, write_regv. On
  34. UNIX: create_symlink.
  35. ``-L[A][H]``
  36. List non-advanced cached variables.
  37. List cache variables will run CMake and list all the variables from
  38. the CMake cache that are not marked as INTERNAL or ADVANCED. This
  39. will effectively display current CMake settings, which can then be
  40. changed with -D option. Changing some of the variables may result
  41. in more variables being created. If A is specified, then it will
  42. display also advanced variables. If H is specified, it will also
  43. display help for each variable.
  44. ``--build <dir>``
  45. Build a CMake-generated project binary tree.
  46. This abstracts a native build tool's command-line interface with the
  47. following options:
  48. ::
  49. <dir> = Project binary directory to be built.
  50. --target <tgt> = Build <tgt> instead of default targets.
  51. --config <cfg> = For multi-configuration tools, choose <cfg>.
  52. --clean-first = Build target 'clean' first, then build.
  53. (To clean only, use --target 'clean'.)
  54. --use-stderr = Ignored. Behavior is default in CMake >= 3.0.
  55. -- = Pass remaining options to the native tool.
  56. Run cmake --build with no options for quick help.
  57. ``-N``
  58. View mode only.
  59. Only load the cache. Do not actually run configure and generate
  60. steps.
  61. ``-P <file>``
  62. Process script mode.
  63. Process the given cmake file as a script written in the CMake
  64. language. No configure or generate step is performed and the cache
  65. is not modified. If variables are defined using -D, this must be
  66. done before the -P argument.
  67. ``--find-package``
  68. Run in pkg-config like mode.
  69. Search a package using find_package() and print the resulting flags
  70. to stdout. This can be used to use cmake instead of pkg-config to
  71. find installed libraries in plain Makefile-based projects or in
  72. autoconf-based projects (via share/aclocal/cmake.m4).
  73. ``--graphviz=[file]``
  74. Generate graphviz of dependencies, see CMakeGraphVizOptions.cmake for more.
  75. Generate a graphviz input file that will contain all the library and
  76. executable dependencies in the project. See the documentation for
  77. CMakeGraphVizOptions.cmake for more details.
  78. ``--system-information [file]``
  79. Dump information about this system.
  80. Dump a wide range of information about the current system. If run
  81. from the top of a binary tree for a CMake project it will dump
  82. additional information such as the cache, log files etc.
  83. ``--debug-trycompile``
  84. Do not delete the try_compile build tree. Only useful on one try_compile at a time.
  85. Do not delete the files and directories created for try_compile
  86. calls. This is useful in debugging failed try_compiles. It may
  87. however change the results of the try-compiles as old junk from a
  88. previous try-compile may cause a different test to either pass or
  89. fail incorrectly. This option is best used for one try-compile at a
  90. time, and only when debugging.
  91. ``--debug-output``
  92. Put cmake in a debug mode.
  93. Print extra stuff during the cmake run like stack traces with
  94. message(send_error ) calls.
  95. ``--trace``
  96. Put cmake in trace mode.
  97. Print a trace of all calls made and from where with
  98. message(send_error ) calls.
  99. ``--warn-uninitialized``
  100. Warn about uninitialized values.
  101. Print a warning when an uninitialized variable is used.
  102. ``--warn-unused-vars``
  103. Warn about unused variables.
  104. Find variables that are declared or set, but not used.
  105. ``--no-warn-unused-cli``
  106. Don't warn about command line options.
  107. Don't find variables that are declared on the command line, but not
  108. used.
  109. ``--check-system-vars``
  110. Find problems with variable usage in system files.
  111. Normally, unused and uninitialized variables are searched for only
  112. in CMAKE_SOURCE_DIR and CMAKE_BINARY_DIR. This flag tells CMake to
  113. warn about other files as well.
  114. .. include:: OPTIONS_HELP.txt
  115. See Also
  116. ========
  117. .. include:: LINKS.txt