1 .. option:: -S <path-to-source>
3 Path to root directory of the CMake project to build.
5 .. option:: -B <path-to-build>
7 Path to directory which CMake will use as the root of build directory.
9 If the directory doesn't already exist CMake will make it.
11 .. option:: -C <initial-cache>
13 Pre-load a script to populate the cache.
15 When CMake is first run in an empty build tree, it creates a
16 ``CMakeCache.txt`` file and populates it with customizable settings for
17 the project. This option may be used to specify a file from which
18 to load cache entries before the first pass through the project's
19 CMake listfiles. The loaded entries take priority over the
20 project's default values. The given file should be a CMake script
21 containing :command:`set` commands that use the ``CACHE`` option, not a
24 References to :variable:`CMAKE_SOURCE_DIR` and :variable:`CMAKE_BINARY_DIR`
25 within the script evaluate to the top-level source and build tree.
27 .. option:: -D <var>:<type>=<value>, -D <var>=<value>
29 Create or update a CMake ``CACHE`` entry.
31 When CMake is first run in an empty build tree, it creates a
32 ``CMakeCache.txt`` file and populates it with customizable settings for
33 the project. This option may be used to specify a setting that
34 takes priority over the project's default value. The option may be
35 repeated for as many ``CACHE`` entries as desired.
37 If the ``:<type>`` portion is given it must be one of the types
38 specified by the :command:`set` command documentation for its
40 If the ``:<type>`` portion is omitted the entry will be created
41 with no type if it does not exist with a type already. If a
42 command in the project sets the type to ``PATH`` or ``FILEPATH``
43 then the ``<value>`` will be converted to an absolute path.
45 This option may also be given as a single argument:
46 ``-D<var>:<type>=<value>`` or ``-D<var>=<value>``.
48 It's important to note that the order of ``-C`` and ``-D`` arguments is
49 significant. They will be carried out in the order they are listed, with the
50 last argument taking precedence over the previous ones. For example, if you
51 specify ``-DCMAKE_BUILD_TYPE=Debug``, followed by a ``-C`` argument with a
56 set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE)
58 then the ``-C`` argument will take precedence, and ``CMAKE_BUILD_TYPE`` will
59 be set to ``Release``. However, if the ``-D`` argument comes after the ``-C``
60 argument, it will be set to ``Debug``.
62 If a ``set(... CACHE ...)`` call in the ``-C`` file does not use ``FORCE``,
63 and a ``-D`` argument sets the same variable, the ``-D`` argument will take
64 precedence regardless of order because of the nature of non-``FORCE``
65 ``set(... CACHE ...)`` calls.
67 .. option:: -U <globbing_expr>
69 Remove matching entries from CMake ``CACHE``.
71 This option may be used to remove one or more variables from the
72 ``CMakeCache.txt`` file, globbing expressions using ``*`` and ``?`` are
73 supported. The option may be repeated for as many ``CACHE`` entries as
76 Use with care, you can make your ``CMakeCache.txt`` non-working.
78 .. option:: -G <generator-name>
80 Specify a build system generator.
82 CMake may support multiple native build systems on certain
83 platforms. A generator is responsible for generating a particular
84 build system. Possible generator names are specified in the
85 :manual:`cmake-generators(7)` manual.
87 If not specified, CMake checks the :envvar:`CMAKE_GENERATOR` environment
88 variable and otherwise falls back to a builtin default selection.
90 .. option:: -T <toolset-spec>
92 Toolset specification for the generator, if supported.
94 Some CMake generators support a toolset specification to tell
95 the native build system how to choose a compiler. See the
96 :variable:`CMAKE_GENERATOR_TOOLSET` variable for details.
98 .. option:: -A <platform-name>
100 Specify platform name if supported by generator.
102 Some CMake generators support a platform name to be given to the
103 native build system to choose a compiler or SDK. See the
104 :variable:`CMAKE_GENERATOR_PLATFORM` variable for details.
106 .. option:: --toolchain <path-to-file>
108 Specify the cross compiling toolchain file, equivalent to setting
109 :variable:`CMAKE_TOOLCHAIN_FILE` variable.
111 .. option:: --install-prefix <directory>
113 Specify the installation directory, used by the
114 :variable:`CMAKE_INSTALL_PREFIX` variable. Must be an absolute path.
118 Suppress developer warnings.
120 Suppress warnings that are meant for the author of the
121 ``CMakeLists.txt`` files. By default this will also turn off
122 deprecation warnings.
126 Enable developer warnings.
128 Enable warnings that are meant for the author of the ``CMakeLists.txt``
129 files. By default this will also turn on deprecation warnings.
131 .. option:: -Wdeprecated
133 Enable deprecated functionality warnings.
135 Enable warnings for usage of deprecated functionality, that are meant
136 for the author of the ``CMakeLists.txt`` files.
138 .. option:: -Wno-deprecated
140 Suppress deprecated functionality warnings.
142 Suppress warnings for usage of deprecated functionality, that are meant
143 for the author of the ``CMakeLists.txt`` files.
145 .. option:: -Werror=<what>
147 Treat CMake warnings as errors. ``<what>`` must be one of the following:
150 Make developer warnings errors.
152 Make warnings that are meant for the author of the ``CMakeLists.txt`` files
153 errors. By default this will also turn on deprecated warnings as errors.
156 Make deprecated macro and function warnings errors.
158 Make warnings for usage of deprecated macros and functions, that are meant
159 for the author of the ``CMakeLists.txt`` files, errors.
161 .. option:: -Wno-error=<what>
163 Do not treat CMake warnings as errors. ``<what>`` must be one of the following:
166 Make warnings that are meant for the author of the ``CMakeLists.txt`` files not
167 errors. By default this will also turn off deprecated warnings as errors.
170 Make warnings for usage of deprecated macros and functions, that are meant
171 for the author of the ``CMakeLists.txt`` files, not errors.