import_framework

Loads a stand-alone framework into a project.

Syntax

import_framework(
    NAME <name>
    PATH <relative path>
    CONFIGURATION <configuration>
    REFERENCES <references>

    BSP_ALIAS <alias>
)

Overview

The import_framework command loads a stand-alone framework into the project. Stand-alone frameworks are created by forking regular embedded frameworks via the menu command in Solution Explorer. They can be checked into source control and edited to modify the functionality of the original frameworks.

Parameters

NAME
Specifies the internal name of the CMake library that will be created for this framework. The name must be unique within the project. Applications must explicitly reference stand-alone frameworks by names via the target_link_libraries statement.

PATH
Specifies the relative path to the framework directory. The directory must contain the EFP.XML file that will be used to generate the framework.cmake file.

CONFIGURATION
Optional. Specifies a list of <key>=<value> pairs separated by spaces. The keys and values are specific to each specific framework. Use the Edit Framework Properties commandin Solution Explorer to edit the framework configuration in a meaningful way.

REFERENCES
If this framework depends on other stand-alone frameworks, this parameter should list the internal names of these frameworks.

BSP_ALIAS
Optional. If the project loads multiple BSPs, this parameter allows selecting a specific BSP instance. Defaults to "BSP". Stand-alone frameworks will automatically reference the BSP, inheriting the device-specific include directories and preprocessor macros.

Examples

The following example loads a stand-alone framework from the USBDevice folder and references it from the Application1 executable:

find_bsp(ID com.sysprogs.arm.stm32
         VERSION 2020.10
         MCU STM32F407VG)

import_framework(NAME USBFramework
                 PATH USBDevice)

add_bsp_based_executable(NAME Application1
                         SOURCES Application1.cpp)

target_link_libraries(Application1 PRIVATE USBFramework)

The same stand-alone framework can be loaded multiple times with different configuration, resulting in several independent CMake libraries:

import_framework(NAME CDCSupport
                 PATH USBFramework)
import_framework(NAME HIDSupport
                 PATH USBFramework
                 CONFIGURATION com.sysprogs.bspoptions.stm32.usb.devclass=HID)

target_link_libraries(CDCDemo PRIVATE CDCSupport)
target_link_libraries(HIDDemo PRIVATE HIDSupport)

See also

Framework-Related Statements, find_test_framework,