Lines Matching full:cmake

1 .. _module-pw_build-cmake:
3 CMake title
8 Pigweed's `CMake`_ support is provided primarily for projects that have an
9 existing CMake build and wish to integrate Pigweed without switching to a new
13 To run upstream Pigweed's CMake build use the ``pw build`` command:
19 This will install any required packages, generate cmake build files and invkoke ninja.
27cmake --fresh --debug-output -DCMAKE_MESSAGE_LOG_LEVEL=WARNING -S . -B ./out/cmake -G Ninja -DCMAK…
28 …19:37:10 INF [1/1] Run ==> ninja -C out/cmake pw_apps pw_run_tests.modules pw_run_tests.pw_bluetoo…
37 CMake functions
39 CMake convenience functions are defined in ``pw_build/pigweed.cmake``.
41 * ``pw_add_library_generic`` -- The base helper used to instantiate CMake
56 which only supports CMake targets and detects when the target does not exist.
64 messages cannot be used to catch problems during the CMake configuration
66 * ``pw_parse_arguments`` -- Helper to parse CMake function arguments.
70 See ``pw_build/pigweed.cmake`` for the complete documentation of these
74 standard CMake functions, such as ``add_library`` and ``target_link_libraries``.
78 The CMake build uses CMake cache variables for configuring
80 similar to GN's build args set with ``gn args``. Unlike GN, CMake does not
87 persist accross CMake invocations. These variables should be set in one of the
91 ``$ENV{PW_ROOT}/backends.cmake``. This file will setup all the backend targets
99 target's toolchain file. The toolchain file is provided to ``cmake`` with
102 CMake code executes.
107 cmake -B out/cmake_host -S "$PW_ROOT" -G Ninja \
108 -DCMAKE_TOOLCHAIN_FILE=$PW_ROOT/pw_toolchain/host_clang/toolchain.cmake \
112 ``cmake-gui``.
119 CMake Error at pw_build/pigweed.cmake:257 (message):
123 pw_build/pigweed.cmake:238:EVAL:1 (_pw_target_link_targets_deferred_check)
129 In CMake, the toolchain is configured by setting CMake variables, as described
130 in the `CMake documentation <https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html>`_.
131 These variables are typically set in a toolchain CMake file passed to ``cmake``
132 with the ``-D`` option (``-DCMAKE_TOOLCHAIN_FILE=path/to/file.cmake``).
145 The CMake build includes third-party libraries similarly to the GN build. A
156 Third party variables are set like any other cache global variable in CMake. It
159 * Set with the CMake ``set`` function in the toolchain file or a
160 ``CMakeLists.txt`` before other CMake code executes.
162 .. code-block:: cmake
170 cmake -B out/cmake_host -S "$PW_ROOT" -G Ninja \
171 -DCMAKE_TOOLCHAIN_FILE=$PW_ROOT/pw_toolchain/host_clang/toolchain.cmake \
174 * Set the variable interactively with ``ccmake`` or ``cmake-gui``.
176 .. _module-pw_build-existing-cmake-project:
178 Use Pigweed from an existing CMake project
180 To use Pigweed libraries form a CMake-based project, simply include the Pigweed
183 .. code-block:: cmake
192 .. code-block:: cmake
198 Additional Pigweed CMake function references:
200 - :bdg-ref-primary-line:`module-pw_protobuf_compiler-cmake`
201 - :bdg-ref-primary-line:`module-pw_unit_test-cmake`