diff --git a/tools/cmake/build.cmake b/tools/cmake/build.cmake index 585d26e195..97c43e8a23 100644 --- a/tools/cmake/build.cmake +++ b/tools/cmake/build.cmake @@ -365,12 +365,6 @@ macro(idf_build_process target) # Check for required Python modules __build_check_python() - # Generate config values in different formats - 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 # property BUILD_PROPERTIES_FILE. @@ -416,6 +410,7 @@ macro(idf_build_process target) idf_build_unset_property(BUILD_PROPERTIES_FILE) file(REMOVE ${build_properties_file}) + # Finally, do component expansion. In this case it simply means getting a final list # of build component targets given the requirements set by each component. if(__COMPONENTS) @@ -442,6 +437,12 @@ macro(idf_build_process target) idf_build_set_property(___COMPONENT_REQUIRES_COMMON ${lib} APPEND) endforeach() + # Generate config values in different formats + idf_build_get_property(sdkconfig SDKCONFIG) + idf_build_get_property(sdkconfig_defaults SDKCONFIG_DEFAULTS) + __kconfig_generate_config("${sdkconfig}" "${sdkconfig_defaults}") + __build_import_configs() + # Temporary trick to support both gcc5 and gcc8 builds if(CMAKE_C_COMPILER_VERSION VERSION_EQUAL 5.2.0) set(GCC_NOT_5_2_0 0 CACHE STRING "GCC is 5.2.0 version") diff --git a/tools/cmake/kconfig.cmake b/tools/cmake/kconfig.cmake index 020e595509..28be99371e 100644 --- a/tools/cmake/kconfig.cmake +++ b/tools/cmake/kconfig.cmake @@ -88,14 +88,17 @@ endfunction() function(__kconfig_generate_config sdkconfig sdkconfig_defaults) # List all Kconfig and Kconfig.projbuild in known components idf_build_get_property(component_targets __COMPONENT_TARGETS) + idf_build_get_property(build_component_targets __BUILD_COMPONENT_TARGETS) foreach(component_target ${component_targets}) - __component_get_property(kconfig ${component_target} KCONFIG) - __component_get_property(kconfig_projbuild ${component_target} KCONFIG_PROJBUILD) - if(kconfig) - list(APPEND kconfigs ${kconfig}) - endif() - if(kconfig_projbuild) - list(APPEND kconfig_projbuilds ${kconfig_projbuild}) + if(component_target IN_LIST build_component_targets) + __component_get_property(kconfig ${component_target} KCONFIG) + __component_get_property(kconfig_projbuild ${component_target} KCONFIG_PROJBUILD) + if(kconfig) + list(APPEND kconfigs ${kconfig}) + endif() + if(kconfig_projbuild) + list(APPEND kconfig_projbuilds ${kconfig_projbuild}) + endif() endif() endforeach()