From d3e814fe195dee14f372d05ff943bc1954b87d6d Mon Sep 17 00:00:00 2001 From: Renz Christian Bagaporo Date: Fri, 12 Jul 2019 16:02:47 +0800 Subject: [PATCH] cmake: set COMPONENT_DIR in early expansion Gives same treatment to COMPONENT_DIR as COMPONENT_PATH in https://gitlab.espressif.cn:6688/espressif/esp-idf/merge_requests/4557 Closes https://github.com/espressif/esp-idf/issues/3771 --- CMakeLists.txt | 2 +- tools/cmake/scripts/component_get_requirements.cmake | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8facf36a2..1b4810648 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -70,7 +70,7 @@ foreach(component_target ${build_component_targets}) set(COMPONENT_NAME ${_name}) set(COMPONENT_DIR ${dir}) set(COMPONENT_ALIAS ${alias}) - set(COMPONENT_PATH ${dir}) # also deprecated, see comment in previous loop + set(COMPONENT_PATH ${dir}) # for backward compatibility only, COMPONENT_DIR is preferred idf_build_get_property(build_prefix __PREFIX) set(__idf_component_context 1) if(NOT prefix STREQUAL build_prefix) diff --git a/tools/cmake/scripts/component_get_requirements.cmake b/tools/cmake/scripts/component_get_requirements.cmake index 0b0d18727..24637008b 100644 --- a/tools/cmake/scripts/component_get_requirements.cmake +++ b/tools/cmake/scripts/component_get_requirements.cmake @@ -53,6 +53,10 @@ function(__component_get_requirements) # and set by the included CMakeLists.txt does not bleed into the next inclusion. # We are only interested in the public and private requirements of components __component_get_property(__component_dir ${__component_target} COMPONENT_DIR) + __component_get_property(__component_name ${__component_target} COMPONENT_NAME) + set(COMPONENT_NAME ${__component_name}) + set(COMPONENT_DIR ${__component_dir}) + set(COMPONENT_PATH ${__component_dir}) # for backward compatibility only, COMPONENT_DIR is preferred include(${__component_dir}/CMakeLists.txt OPTIONAL) spaces2list(__component_requires)