ESP32-Template/CMakeLists.txt

21 lines
738 B
CMake
Executable File

# The following five lines of boilerplate have to be in your project's
# CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.16)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
# Read version from version.txt
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/version.txt" CURRENT_VERSION_CONTENT)
string(STRIP "${CURRENT_VERSION_CONTENT}" CURRENT_VERSION) # Remove leading/trailing whitespace
# Get the current Git branch
execute_process(
COMMAND git rev-parse --abbrev-ref HEAD
OUTPUT_VARIABLE GIT_DEFAULT_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
#Add the Git branch as a preprocessor definition
add_compile_definitions(GIT_DEFAULT_BRANCH="${GIT_DEFAULT_BRANCH}")
project(esp32template)