1.. _tfm_cmake_configuration:
2
3###################
4Build configuration
5###################
6
7All configuration options are provided by cmake variables, and their default
8values, with docstrings, can be found in ``config/config_base.cmake``.
9
10Configuration is provided in multiple stages. Each stage will not override any
11config that has already been set at any of the prior stages.
12
13   1. Command-line variable settings are applied.
14   2. If the ``TFM_EXTRA_CONFIG_PATH`` variable has been set, that file is
15      loaded.
16   3. If TEST_PSA_TEST is set, then PSA API test related config is applied from
17      ``config/tests/config_test_psa_api.cmake``.
18   4. If it exists, CMAKE_BUILD_TYPE specific config is applied from
19      ``config/build_type/<build_type>.cmake``.
20   5. Target specific config from ``platform/ext/target/<target_platform>/config.cmake``
21      is applied.
22   6. If CRYPTO_HW_ACCELERATOR is set, then a config specific to the
23      accelerator type is applied if it exists.
24   7. If it exists, TFM Profile specific config is applied from
25      ``config/profile/<tfm_profile>.cmake``.
26   8. ``config/config_default.cmake`` is loaded.
27   9. If ``TEST_S`` or ``TEST_NS`` or other single test suite config like
28      ``TEST_NS_ATTESTATION`` (see :ref:`test_configuration`) is set, then
29      config from ``${TFM_TEST_REPO_PATH}/test/config/set_config.cmake`` and
30      ``${TFM_TEST_REPO_PATH}/test/config/default_ns_test_config.cmake`` or
31      ``${TFM_TEST_REPO_PATH}/test/config/default_s_test_config.cmake`` or
32      ``${TFM_TEST_REPO_PATH}/test/config/default_test_config.cmake`` is
33      applied.
34
35.. Warning::
36    This means that command-line settings are not applied when they conflict
37    with required platform settings. If it is required to override platform
38    settings (this is not usually a good idea) then TFM_EXTRA_CONFIG_PATH should be
39    used.
40