Options Build
Options Build
option:: -S <path-to-source>
.. option:: -B <path-to-build>
Path to directory which CMake will use as the root of build directory.
.. option:: -C <initial-cache>
It's important to note that the order of ``-C`` and ``-D`` arguments is
significant. They will be carried out in the order they are listed, with the
last argument taking precedence over the previous ones. For example, if you
specify ``-DCMAKE_BUILD_TYPE=Debug``, followed by a ``-C`` argument with a
file that calls:
.. code-block:: cmake
then the ``-C`` argument will take precedence, and ``CMAKE_BUILD_TYPE`` will
be set to ``Release``. However, if the ``-D`` argument comes after the ``-C``
argument, it will be set to ``Debug``.
If a ``set(... CACHE ...)`` call in the ``-C`` file does not use ``FORCE``,
and a ``-D`` argument sets the same variable, the ``-D`` argument will take
precedence regardless of order because of the nature of non-``FORCE``
``set(... CACHE ...)`` calls.
.. option:: -U <globbing_expr>
This option may be used to remove one or more variables from the
``CMakeCache.txt`` file, globbing expressions using ``*`` and ``?`` are
supported. The option may be repeated for as many ``CACHE`` entries as
desired.
.. option:: -G <generator-name>
.. option:: -T <toolset-spec>
.. option:: -A <platform-name>
.. versionadded:: 3.21
.. versionadded:: 3.21
.. option:: -Wdev
Enable warnings that are meant for the author of the ``CMakeLists.txt``
files. By default this will also turn on deprecation warnings.
.. option:: -Wdeprecated
.. option:: -Wno-deprecated
.. option:: -Werror=<what>
``dev``
Make developer warnings errors.
Make warnings that are meant for the author of the ``CMakeLists.txt`` files
errors. By default this will also turn on deprecated warnings as errors.
``deprecated``
Make deprecated macro and function warnings errors.
Make warnings for usage of deprecated macros and functions, that are meant
for the author of the ``CMakeLists.txt`` files, errors.
.. option:: -Wno-error=<what>
Do not treat CMake warnings as errors. ``<what>`` must be one of the following:
``dev``
Make warnings that are meant for the author of the ``CMakeLists.txt`` files not
errors. By default this will also turn off deprecated warnings as errors.
``deprecated``
Make warnings for usage of deprecated macros and functions, that are meant
for the author of the ``CMakeLists.txt`` files, not errors.