bsp_include_directories

Specifies a list of include directories that will be applied when compiling the BSP and all related targets.

Syntax

bsp_include_directories(
    BSP_ALIAS <alias>

    <Directory 1>
    <Directory 2>
    ...
    <Directory N>
)

Overview

The bsp_include_directories command adds the specified include directories to a specific BSP instance, and to all targets referencing it (see add_bsp_based_executable and add_bsp_based_library).

Parameters

BSP_ALIAS
Optional. If the project loads multiple BSPs, this parameter allows selecting a specific BSP instance.
Directories
Specifies one or more directory paths, relative to the current source directory, that will be added to the include directory list. Use the ${BSP_ROOT} syntax to specify a directory inside the BSP.

Remarks

You can configure the list of include directories applied to a specific BSP instance by locating the BSP node in Solution Explorer and using the Properties -> Compiler Settings -> Additional Include Directories setting.

Examples

The following example adds the config_files directory to the include directory list for the primary BSP, and the Application1 executable:

find_bsp(ID com.sysprogs.arm.stm32
         VERSION 2020.10
         MCU STM32F407VG)
bsp_include_directories(config_files)
add_bsp_based_executable(NAME Application1
                         SOURCES Application1.cpp)

You can now place the stm32f4xx_hal_conf.h file inside config_files, and both BSP and the application will be able to find it there.

If the project contains multiple BSPs, use the BSP_ALIAS parameter to select a specific instance:

find_bsp(ID com.sysprogs.arm.stm32
         VERSION 2020.10
         MCU STM32F746NG
         ALIAS SecondaryBSP)
bsp_include_directories(BSP_ALIAS SecondaryBSP
                        config_files_2)
add_bsp_based_executable(NAME Application12
                         BSP_ALIAS SecondaryBSP
                         SOURCES Application2.cpp)

See also

BSP-Related Statements, bsp_compile_definitions, bsp_compile_flags, bsp_linker_flags, find_bsp