.. _cmake-macro-reference-label: CMake Macros ============ .. _cmake-macro-spl-add-component: spl_add_component ----------------- Add a component to a variant. .. code-block:: cmake spl_add_component() This macro is intended to be used in the variant's parts.cmake file to add a component to the variant. The arguments are: ```` The relative path from project root to the component's directory. Example: Adding a component to the variant in its parts.cmake: .. code-block:: cmake spl_add_component(src/led_driver) This example adds a component located in the "src/led_driver" directory to the variant. spl_add_named_component ----------------------- Add a named component to a variant. .. code-block:: cmake spl_add_named_component() This macro is intended to be used in the variant's parts.cmake file to add a named component to the variant. The arguments are: ```` The name of a CMake variable that contains the path (either absolute or relative from project root) to the component's directory. The variable name becomes the name of the component in the build system. Examples: Adding a named component to the variant in its parts.cmake: .. code-block:: cmake set(LED_DRIVER_COMPONENT src/led_driver) spl_add_named_component(LED_DRIVER_COMPONENT) This example adds a named component to the variant using the variable ``LED_DRIVER_COMPONENT`` that contains the path to the component's directory. .. code-block:: cmake set(LED_DRIVER_COMPONENT ${CMAKE_CURRENT_SOURCE_DIR}/some_package/src/led_driver) spl_add_named_component(LED_DRIVER_COMPONENT) This example adds a named component to the variant using the variable ``LED_DRIVER_COMPONENT`` that contains the absolute path to the component's directory. spl_add_include --------------- Add an include directory to the project's list of include directories. .. code-block:: cmake spl_add_include() This macro is intended to be used in the variant's parts.cmake file to add an include directory to the build's list of include directories, making header files in this directory accessible to the compiler. The arguments are: ```` The relative path to the include directory you want to add to the build's list of include directories. Example: Adding an include directory to the project: .. code-block:: cmake spl_add_include(include/my_library) This example adds the "include/my_library" directory to the project's list of include directories, making header files within this directory accessible to the project's source code. .. _spl_add_source: spl_add_source -------------- Add a source file of a component to the list of sources to be compiled. .. code-block:: cmake spl_add_source( [COMPILE_OPTIONS "