|
|
@@ -30,6 +30,9 @@ endfunction()
|
|
|
function(idf_build_set_property property value)
|
|
|
cmake_parse_arguments(_ "APPEND" "" "" ${ARGN})
|
|
|
|
|
|
+ # Fixup property value, e.g. for compatibility. (Overwrites variable 'value'.)
|
|
|
+ __build_fixup_property("${property}" "${value}" value)
|
|
|
+
|
|
|
if(__APPEND)
|
|
|
set_property(TARGET __idf_build_target APPEND PROPERTY ${property} ${value})
|
|
|
else()
|
|
|
@@ -73,7 +76,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 +93,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"
|
|
|
@@ -164,6 +167,21 @@ function(__build_set_lang_version)
|
|
|
idf_build_set_property(CXX_COMPILE_OPTIONS "-std=${cxx_std}" APPEND)
|
|
|
endfunction()
|
|
|
|
|
|
+#
|
|
|
+# Perform any fixes or adjustments to the values stored in IDF build properties.
|
|
|
+# This function only gets called from 'idf_build_set_property' and doesn't affect
|
|
|
+# the properties set directly via 'set_property'.
|
|
|
+#
|
|
|
+function(__build_fixup_property property value out_var)
|
|
|
+
|
|
|
+ # Fixup COMPILE_DEFINITIONS property to support -D prefix, which had to be used in IDF v4.x projects.
|
|
|
+ if(property STREQUAL "COMPILE_DEFINITIONS" AND NOT "${value}" STREQUAL "")
|
|
|
+ string(REGEX REPLACE "^-D" "" stripped_value "${value}")
|
|
|
+ set("${out_var}" "${stripped_value}" PARENT_SCOPE)
|
|
|
+ endif()
|
|
|
+
|
|
|
+endfunction()
|
|
|
+
|
|
|
#
|
|
|
# Initialize the build. This gets called upon inclusion of idf.cmake to set internal
|
|
|
# properties used for the processing phase of the build.
|
|
|
@@ -592,7 +610,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.)
|
|
|
@@ -612,8 +630,7 @@ endmacro()
|
|
|
function(idf_build_executable elf)
|
|
|
# Set additional link flags for the executable
|
|
|
idf_build_get_property(link_options LINK_OPTIONS)
|
|
|
- # Using LINK_LIBRARIES here instead of LINK_OPTIONS, as the latter is not in CMake 3.5.
|
|
|
- set_property(TARGET ${elf} APPEND PROPERTY LINK_LIBRARIES "${link_options}")
|
|
|
+ set_property(TARGET ${elf} APPEND PROPERTY LINK_OPTIONS "${link_options}")
|
|
|
|
|
|
# Propagate link dependencies from component library targets to the executable
|
|
|
idf_build_get_property(link_depends __LINK_DEPENDS)
|