cmake: remove -D prefix from COMPILE_DEFINITIONS property

Unlike COMPILE_OPTIONS, COMPILE_DEFINITIONS CMake property assumes
values without the -D prefix, such as NAME or NAME=VAL.
Previously, IDF build system was passing COMPILE_DEFINITIONS build
property to CMake COMPILE_OPTIONS property, so -D prefix was not
a problem.
Now that COMPILE_DEFINITIONS CMake property is used, -D prefix has
to be removed.

(Note that this doesn't affect 'target_compile_definitions' function,
which strips -D prefix before adding the definition to the property.)
This commit is contained in:
Ivan Grokhotkov
2022-08-28 21:20:48 +02:00
parent 49dedb77ac
commit c392c06216
5 changed files with 7 additions and 7 deletions

View File

@@ -57,7 +57,7 @@ idf_build_set_property(__COMPONENT_REQUIRES_COMMON "${common_req}")
idf_build_set_property(__OUTPUT_SDKCONFIG 0)
project(bootloader)
idf_build_set_property(COMPILE_DEFINITIONS "-DBOOTLOADER_BUILD=1" APPEND)
idf_build_set_property(COMPILE_DEFINITIONS "BOOTLOADER_BUILD=1" APPEND)
idf_build_set_property(COMPILE_OPTIONS "-fno-stack-protector" APPEND)
idf_component_get_property(main_args esptool_py FLASH_ARGS)

View File

@@ -7,7 +7,7 @@ list(APPEND EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/tools/mocks/driver/")
list(APPEND EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/tools/mocks/freertos/")
list(APPEND EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/tools/mocks/spi_flash/")
idf_build_set_property(COMPILE_DEFINITIONS "-DNO_DEBUG_STORAGE" APPEND)
idf_build_set_property(COMPILE_DEFINITIONS "NO_DEBUG_STORAGE" APPEND)
project(test_nvs_page_host)

View File

@@ -6,7 +6,7 @@ set(sources "pthread.c"
idf_component_register(SRCS ${sources}
INCLUDE_DIRS include)
idf_build_set_property(COMPILE_DEFINITIONS "-D_POSIX_READER_WRITER_LOCKS" APPEND)
idf_build_set_property(COMPILE_DEFINITIONS "_POSIX_READER_WRITER_LOCKS" APPEND)
set(extra_link_flags "-u pthread_include_pthread_impl")
list(APPEND extra_link_flags "-u pthread_include_pthread_cond_impl")

View File

@@ -73,7 +73,7 @@ function(__build_get_idf_git_revision)
endif()
# cut IDF_VER to required 32 characters.
string(SUBSTRING "${idf_ver_t}" 0 31 idf_ver)
idf_build_set_property(COMPILE_DEFINITIONS "-DIDF_VER=\"${idf_ver}\"" APPEND)
idf_build_set_property(COMPILE_DEFINITIONS "IDF_VER=\"${idf_ver}\"" APPEND)
git_submodule_check("${idf_path}")
idf_build_set_property(IDF_VER ${idf_ver})
endfunction()
@@ -90,7 +90,7 @@ function(__build_set_default_build_specifications)
unset(c_compile_options)
unset(cxx_compile_options)
list(APPEND compile_definitions "-D_GNU_SOURCE")
list(APPEND compile_definitions "_GNU_SOURCE")
list(APPEND compile_options "-ffunction-sections"
"-fdata-sections"
@@ -592,7 +592,7 @@ macro(idf_build_process target)
# All targets built under this scope is with the ESP-IDF build system
set(ESP_PLATFORM 1)
idf_build_set_property(COMPILE_DEFINITIONS "-DESP_PLATFORM" APPEND)
idf_build_set_property(COMPILE_DEFINITIONS "ESP_PLATFORM" APPEND)
# Perform component processing (inclusion of project_include.cmake, adding component
# subdirectories, creating library targets, linking libraries, etc.)

View File

@@ -21,4 +21,4 @@ idf_component_mock(INCLUDE_DIRS ${include_dirs}
${original_driver_dir}/include/driver/i2c.h
${original_driver_dir}/include/driver/gpio.h)
idf_build_set_property(COMPILE_DEFINITIONS "-DSPI_MOCK" APPEND)
idf_build_set_property(COMPILE_DEFINITIONS "SPI_MOCK" APPEND)