cmake.1.rst 5.2 KB

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