EasyManuals Logo

Espressif ESP32-S2 User Manual

Espressif ESP32-S2
1695 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #1288 background imageLoading...
Page #1288 background image
Chapter 4. API Guides
COMPONENT_DIR: The component directory. Evaluates to the absolute path of the directory con-
taining CMakeLists.txt. The component path cannot contain spaces. This is the same as the
CMAKE_CURRENT_SOURCE_DIR variable.
COMPONENT_NAME: Name of the component. Same as the name of the component directory.
COMPONENT_ALIAS: Alias of the library created internally by the build system for the component.
COMPONENT_LIB: Name of the library created internally by the build system for the component.
The following variables are set at the project level, but available for use in component CMakeLists:
CONFIG_*: Each value in the project configuration has a corresponding variable available in cmake. All
names begin with CONFIG_. More information here.
ESP_PLATFORM: Set to 1 when the CMake file is processed within ESP-IDF build system.
Build/Project Variables
The following are some project/build variables that are available as build properties and whose values can be queried
using idf_build_get_property from the component CMakeLists.txt:
PROJECT_NAME: Name of the project, as set in project CMakeLists.txt file.
PROJECT_DIR: Absolute path of the project directory containing the project CMakeLists. Same as the
CMAKE_SOURCE_DIR variable.
COMPONENTS: Names of all components that are included in this build, formatted as a semicolon-delimited
CMake list.
IDF_VER: Git version of ESP-IDF (produced by git describe)
IDF_VERSION_MAJOR, IDF_VERSION_MINOR, IDF_VERSION_PATCH: Components of ESP-IDF
version, to be used in conditional expressions. Note that this information is less precise than that provided
by IDF_VER variable. v4.0-dev-*, v4.0-beta1, v4.0-rc1 and v4.0 will all have the same values
of IDF_VERSION_* variables, but different IDF_VER values.
IDF_TARGET: Name of the target for which the project is being built.
PROJECT_VER: Project version.
If CONFIG_APP_PROJECT_VER_FROM_CONFIG option is set, the value of CON-
FIG_APP_PROJECT_VER will be used.
Else, if PROJECT_VER variable is set in project CMakeLists.txt file, its value will be used.
Else, if the PROJECT_DIR/version.txt exists, its contents will be used as PROJECT_VER.
Else, if the project is located inside a Git repository, the output of git describe will be used.
Otherwise, PROJECT_VER will be 1.
Other build properties are listed here.
Controlling Component Compilation
To pass compiler options when compiling source files belonging to a particular component, use the tar-
get_compile_options function:
target_compile_options(${COMPONENT_LIB} PRIVATE -Wno-unused-variable)
To apply the compilation flags to a single source file, use the CMake set_source_files_properties command:
set_source_files_properties(mysrc.c
PROPERTIES COMPILE_FLAGS
-Wno-unused-variable
)
This can be useful if there is upstream code that emits warnings.
When using these commands, place them after the call to idf_component_register in the component
CMakeLists file.
Espressif Systems 1277
Submit Document Feedback
Release v4.4

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Espressif ESP32-S2 and is the answer not in the manual?

Espressif ESP32-S2 Specifications

General IconGeneral
BrandEspressif
ModelESP32-S2
CategorySingle board computers
LanguageEnglish