Specify the executable *executable* for ESP-IDF build. This attaches additional targets such as dependencies related to
flashing, generating additional binary files, etc. Should be called after ``idf_build_process``.
+.. code-block:: none
+
+ idf_build_get_config(var config [GENERATOR_EXPRESSION])
+
+Get the value of the specified config. Much like build properties, specifying
+*GENERATOR_EXPRESSION* will retrieve the generator expression string for that config, instead of the actual value, which
+can be used with CMake commands that support generator expressions. Actual config values are only known after call to `idf_build_process`, however.
+
.. _cmake-build-properties:
idf-build-properties
unset(_var)
endmacro()
+#
+# Import configs as build instance properties so that they are accessible
+# using idf_build_get_config(). Config has to have been generated before calling
+# this command.
+#
+function(__build_import_configs)
+ # Include the sdkconfig cmake file, since the following operations require
+ # knowledge of config values.
+ idf_build_get_property(sdkconfig_cmake SDKCONFIG_CMAKE)
+ include(${sdkconfig_cmake})
+
+ idf_build_set_property(__CONFIG_VARIABLES "${CONFIGS_LIST}")
+ foreach(config ${CONFIGS_LIST})
+ set_property(TARGET __idf_build_target PROPERTY ${config} "${${config}}")
+ endforeach()
+endfunction()
+
# idf_build_process
#
# @brief Main processing step for ESP-IDF build: config generation, adding components to the build,
idf_build_get_property(sdkconfig SDKCONFIG)
idf_build_get_property(sdkconfig_defaults SDKCONFIG_DEFAULTS)
__kconfig_generate_config("${sdkconfig}" "${sdkconfig_defaults}")
+ __build_import_configs()
# Write the partial build properties to a temporary file.
# The path to this generated file is set to a short-lived build
# Add dependency of the build target to the executable
add_dependencies(${elf} __idf_build_target)
+endfunction()
+
+# idf_build_get_config
+#
+# @brief Get value of specified config variable
+function(idf_build_get_config var config)
+ cmake_parse_arguments(_ "GENERATOR_EXPRESSION" "" "" ${ARGN})
+ if(__GENERATOR_EXPRESSION)
+ set(val "$<TARGET_PROPERTY:__idf_build_target,${config}>")
+ else()
+ get_property(val TARGET __idf_build_target PROPERTY ${config})
+ endif()
+ set(${var} ${val} PARENT_SCOPE)
endfunction()
\ No newline at end of file
idf_build_executable(${project_elf})
__project_info("${test_components}")
+
+ # Make build variables and config variables available after project call (of course the value
+ # of these variables can be accessed via idf_build_get_property or idf_build_get_config)
+ idf_build_get_property(sdkconfig_cmake SDKCONFIG_CMAKE)
+ include(${sdkconfig_cmake})
+
+ idf_build_get_property(build_properties __BUILD_PROPERTIES)
+ foreach(build_property ${build_properties})
+ idf_build_get_property(val ${build_property})
+ set(${build_property} "${val}")
+ endforeach()
endmacro()