| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443 |
- .. cmake-manual-description: CMake Configure Log
- cmake-configure-log(7)
- **********************
- .. versionadded:: 3.26
- .. only:: html
- .. contents::
- Introduction
- ============
- CMake writes a running log, known as the *configure log*,
- of certain events that occur during the Configure step.
- The configure log does *not* contain a log of all output, errors,
- or messages printed while configuring a project. It is a log of
- detailed information about specific events, such as toolchain inspection
- by :command:`try_compile`, meant for use in debugging the configuration
- of a build tree.
- For human use, this version of CMake writes the configure log to the file:
- .. code-block:: cmake
- ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeConfigureLog.yaml
- However, the *location and name of the log file may change* in future
- versions of CMake. Tools that read the configure log should get its
- location using a :ref:`configureLog <file-api configureLog>` query to
- the :manual:`cmake-file-api(7)`.
- See the `Log Versioning`_ section below for details.
- Log Structure
- =============
- The configure log is designed to be both machine- and human-readable.
- The log file is a YAML document stream containing zero or more YAML
- documents separated by document markers. Each document begins
- with a ``---`` document marker line, contains a single YAML mapping
- that logs events from one CMake "configure" step, and, if the configure
- step finished normally, ends with a ``...`` document marker line:
- .. code-block:: yaml
- ---
- events:
- -
- kind: "try_compile-v1"
- # (other fields omitted)
- -
- kind: "try_compile-v1"
- # (other fields omitted)
- ...
- A new document is appended to the log every time CMake configures
- the build tree and logs new events.
- The keys of each document root mapping are:
- ``events``
- A YAML block sequence of nodes corresponding to events logged during
- one CMake "configure" step. Each event is a YAML node containing one
- of the `Event Kinds`_ documented below.
- Log Versioning
- --------------
- Each of the `Event Kinds`_ is versioned independently. The set of
- keys an event's log entry provides is specific to its major version.
- When an event is logged, the latest version of its event kind that is
- known to the running version of CMake is always written to the log.
- Tools reading the configure log must ignore event kinds and versions
- they do not understand:
- * A future version of CMake may introduce a new event kind or version.
- * If an existing build tree is re-configured with a different version of
- CMake, the log may contain different versions of the same event kind.
- * If :manual:`cmake-file-api(7)` queries request one or more
- :ref:`configureLog <file-api configureLog>` object versions,
- the log may contain multiple entries for the same event, each
- with a different version of its event kind.
- IDEs should write a :manual:`cmake-file-api(7)` query requesting a
- specific :ref:`configureLog <file-api configureLog>` object version,
- before running CMake, and then read the configure log only as described
- by the file-api reply.
- Text Block Encoding
- -------------------
- In order to make the log human-readable, text blocks are always
- represented using YAML literal block scalars (``|``).
- Since literal block scalars do not support escaping, backslashes
- and non-printable characters are encoded at the application layer:
- * ``\\`` encodes a backslash.
- * ``\xXX`` encodes a byte using two hexadecimal digits, ``XX``.
- .. _`configure-log event kinds`:
- Event Kinds
- ===========
- Every event kind is represented by a YAML mapping of the form:
- .. code-block:: yaml
- kind: "<kind>-v<major>"
- backtrace:
- - "<file>:<line> (<function>)"
- checks:
- - "Checking for something"
- #...event-specific keys...
- The keys common to all events are:
- ``kind``
- A string identifying the event kind and major version.
- ``backtrace``
- A YAML block sequence reporting the call stack of CMake source
- locations at which the event occurred, from most-recent to
- least-recent. Each node is a string specifying one location
- formatted as ``<file>:<line> (<function>)``.
- ``checks``
- An optional key that is present when the event occurred with
- at least one pending :command:`message(CHECK_START)`. Its value
- is a YAML block sequence reporting the stack of pending checks,
- from most-recent to least-recent. Each node is a string containing
- a pending check message.
- Additional mapping keys are specific to each (versioned) event kind,
- described below.
- .. _`message configure-log event`:
- Event Kind ``message``
- ----------------------
- The :command:`message(CONFIGURE_LOG)` command logs ``message`` events.
- There is only one ``message`` event major version, version 1.
- .. _`message-v1 event`:
- ``message-v1`` Event
- ^^^^^^^^^^^^^^^^^^^^
- A ``message-v1`` event is a YAML mapping:
- .. code-block:: yaml
- kind: "message-v1"
- backtrace:
- - "CMakeLists.txt:123 (message)"
- checks:
- - "Checking for something"
- message: |
- # ...
- The keys specific to ``message-v1`` mappings are:
- ``message``
- A YAML literal block scalar containing the message text,
- represented using our `Text Block Encoding`_.
- .. _`try_compile configure-log event`:
- Event Kind ``try_compile``
- --------------------------
- The :command:`try_compile` command logs ``try_compile`` events.
- There is only one ``try_compile`` event major version, version 1.
- .. _`try_compile-v1 event`:
- ``try_compile-v1`` Event
- ^^^^^^^^^^^^^^^^^^^^^^^^
- A ``try_compile-v1`` event is a YAML mapping:
- .. code-block:: yaml
- kind: "try_compile-v1"
- backtrace:
- - "CMakeLists.txt:123 (try_compile)"
- checks:
- - "Checking for something"
- description: "Explicit LOG_DESCRIPTION"
- directories:
- source: "/path/to/.../TryCompile-01234"
- binary: "/path/to/.../TryCompile-01234"
- cmakeVariables:
- SOME_VARIABLE: "Some Value"
- buildResult:
- variable: "COMPILE_RESULT"
- cached: true
- stdout: |
- # ...
- exitCode: 0
- The keys specific to ``try_compile-v1`` mappings are:
- ``description``
- An optional key that is present when the ``LOG_DESCRIPTION <text>`` option
- was used. Its value is a string containing the description ``<text>``.
- ``directories``
- A mapping describing the directories associated with the
- compilation attempt. It has the following keys:
- ``source``
- String specifying the source directory of the
- :command:`try_compile` project.
- ``binary``
- String specifying the binary directory of the
- :command:`try_compile` project.
- For non-project invocations, this is often the same as
- the source directory.
- ``cmakeVariables``
- An optional key that is present when CMake propagates variables
- into the test project, either automatically or due to the
- :variable:`CMAKE_TRY_COMPILE_PLATFORM_VARIABLES` variable.
- Its value is a mapping from variable names to their values.
- ``buildResult``
- A mapping describing the result of compiling the test code.
- It has the following keys:
- ``variable``
- A string specifying the name of the CMake variable
- storing the result of trying to build the test project.
- ``cached``
- A boolean indicating whether the above result ``variable``
- is stored in the CMake cache.
- ``stdout``
- A YAML literal block scalar containing the output from building
- the test project, represented using our `Text Block Encoding`_.
- This contains build output from both stdout and stderr.
- ``exitCode``
- An integer specifying the build tool exit code from trying
- to build the test project.
- .. _`try_run configure-log event`:
- Event Kind ``try_run``
- ----------------------
- The :command:`try_run` command logs ``try_run`` events.
- There is only one ``try_run`` event major version, version 1.
- .. _`try_run-v1 event`:
- ``try_run-v1`` Event
- ^^^^^^^^^^^^^^^^^^^^
- A ``try_run-v1`` event is a YAML mapping:
- .. code-block:: yaml
- kind: "try_run-v1"
- backtrace:
- - "CMakeLists.txt:456 (try_run)"
- checks:
- - "Checking for something"
- description: "Explicit LOG_DESCRIPTION"
- directories:
- source: "/path/to/.../TryCompile-56789"
- binary: "/path/to/.../TryCompile-56789"
- buildResult:
- variable: "COMPILE_RESULT"
- cached: true
- stdout: |
- # ...
- exitCode: 0
- runResult:
- variable: "RUN_RESULT"
- cached: true
- stdout: |
- # ...
- stderr: |
- # ...
- exitCode: 0
- The keys specific to ``try_run-v1`` mappings include those
- documented by the `try_compile-v1 event`_, plus:
- ``runResult``
- A mapping describing the result of running the test code.
- It has the following keys:
- ``variable``
- A string specifying the name of the CMake variable
- storing the result of trying to run the test executable.
- ``cached``
- A boolean indicating whether the above result ``variable``
- is stored in the CMake cache.
- ``stdout``
- An optional key that is present when the test project built successfully.
- Its value is a YAML literal block scalar containing output from running
- the test executable, represented using our `Text Block Encoding`_.
- If ``RUN_OUTPUT_VARIABLE`` was used, stdout and stderr are captured
- together, so this will contain both. Otherwise, this will contain
- only the stdout output.
- ``stderr``
- An optional key that is present when the test project built successfully
- and the ``RUN_OUTPUT_VARIABLE`` option was not used.
- Its value is a YAML literal block scalar containing output from running
- the test executable, represented using our `Text Block Encoding`_.
- If ``RUN_OUTPUT_VARIABLE`` was used, stdout and stderr are captured
- together in the ``stdout`` key, and this key will not be present.
- Otherwise, this will contain the stderr output.
- ``exitCode``
- An optional key that is present when the test project built successfully.
- Its value is an integer specifying the exit code, or a string containing
- an error message, from trying to run the test executable.
- .. _`find configure-log event`:
- Event Kind ``find``
- -------------------
- The :command:`find_file`, :command:`find_path`, :command:`find_library`, and
- :command:`find_program` commands log ``find`` events.
- There is only one ``find`` event major version, version 1.
- .. _`find-v1 event`:
- ``find-v1`` Event
- ^^^^^^^^^^^^^^^^^
- .. versionadded:: 4.1
- A ``find-v1`` event is a YAML mapping:
- .. code-block:: yaml
- kind: "find-v1"
- backtrace:
- - "CMakeLists.txt:456 (find_program)"
- mode: "program"
- variable: "PROGRAM_PATH"
- description: "Docstring for variable"
- settings:
- SearchFramework: "NEVER"
- SearchAppBundle: "NEVER"
- CMAKE_FIND_USE_CMAKE_PATH: true
- CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: true
- CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: true
- CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: true
- CMAKE_FIND_USE_INSTALL_PREFIX: true
- names:
- - "name1"
- - "name2"
- candidate_directories:
- - "/path/to/search"
- - "/other/path/to/search"
- - "/path/to/found"
- - "/further/path/to/search"
- searched_directories:
- - "/path/to/search"
- - "/other/path/to/search"
- found: "/path/to/found/program"
- The keys specific to ``find-v1`` mappings are:
- ``mode``
- A string describing the command using the search performed. One of ``file``,
- ``path``, ``program``, or ``library``.
- ``variable``
- The variable to which the search stored its result.
- ``description``
- The documentation string of the variable.
- ``settings``
- Search settings active for the search.
- ``SearchFramework``
- A string describing how framework search is performed. One of ``FIRST``,
- ``LAST``, ``ONLY``, or ``NEVER``. See :variable:`CMAKE_FIND_FRAMEWORK`.
- ``SearchAppBundle``
- A string describing how application bundle search is performed. One of
- ``FIRST``, ``LAST``, ``ONLY``, or ``NEVER``. See
- :variable:`CMAKE_FIND_APPBUNDLE`.
- ``CMAKE_FIND_USE_CMAKE_PATH``
- A boolean indicating whether or not CMake-specific cache variables are
- used when searching. See :variable:`CMAKE_FIND_USE_CMAKE_PATH`.
- ``CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH``
- A boolean indicating whether or not CMake-specific environment variables
- are used when searching. See
- :variable:`CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH`.
- ``CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH``
- A boolean indicating whether or not platform-specific environment
- variables are used when searching. See
- :variable:`CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH`.
- ``CMAKE_FIND_USE_CMAKE_SYSTEM_PATH``
- A boolean indicating whether or not platform-specific CMake variables are
- used when searching. See :variable:`CMAKE_FIND_USE_CMAKE_SYSTEM_PATH`.
- ``CMAKE_FIND_USE_INSTALL_PREFIX``
- A boolean indicating whether or not the install prefix is used when
- searching. See :variable:`CMAKE_FIND_USE_INSTALL_PREFIX`.
- ``names``
- The names to look for the queries.
- ``candidate_directories``
- Candidate directories, in order, to look in during the search.
- ``searched_directories``
- Directories, in order, looked at during the search process.
- ``found``
- Either a string representing the found value or ``false`` if it was not
- found.
|