From 6dd7a44272943bc53fff467c173960769898115e Mon Sep 17 00:00:00 2001 From: Shubham Patil Date: Mon, 6 May 2024 11:52:19 +0530 Subject: [PATCH] Fix building examples if placed outside the repo Fixes https://github.com/espressif/esp-matter/issues/916 Build path using ESP_MATTER_PATH variable and not with CMAKE_CURRENT_LIST_DIR. If example is moved out from their current place then the compilation breaks, becuase it tries to find the file wrt to current project directory. --- examples/controller/CMakeLists.txt | 2 +- examples/generic_switch/CMakeLists.txt | 2 +- examples/light/CMakeLists.txt | 2 +- examples/light_switch/CMakeLists.txt | 2 +- examples/refrigerator/CMakeLists.txt | 2 +- examples/room_air_conditioner/CMakeLists.txt | 2 +- examples/zap_light/CMakeLists.txt | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/controller/CMakeLists.txt b/examples/controller/CMakeLists.txt index b9187295c..9b122e1d5 100644 --- a/examples/controller/CMakeLists.txt +++ b/examples/controller/CMakeLists.txt @@ -26,7 +26,7 @@ include($ENV{IDF_PATH}/tools/cmake/project.cmake) include($ENV{ESP_MATTER_DEVICE_PATH}/esp_matter_device.cmake) set(EXTRA_COMPONENT_DIRS - "../common" + "${ESP_MATTER_PATH}/examples/common" "${MATTER_SDK_PATH}/config/esp32/components" "${ESP_MATTER_PATH}/components" "${ESP_MATTER_PATH}/device_hal/device" diff --git a/examples/generic_switch/CMakeLists.txt b/examples/generic_switch/CMakeLists.txt index 9c59282d5..81a144fac 100644 --- a/examples/generic_switch/CMakeLists.txt +++ b/examples/generic_switch/CMakeLists.txt @@ -33,7 +33,7 @@ set(MATTER_SDK_PATH ${ESP_MATTER_PATH}/connectedhomeip/connectedhomeip) # This should be done before using the IDF_TARGET variable. include($ENV{IDF_PATH}/tools/cmake/project.cmake) include($ENV{ESP_MATTER_DEVICE_PATH}/esp_matter_device.cmake) -include(${CMAKE_CURRENT_LIST_DIR}/../common/cmake_common/components_include.cmake) +include(${ESP_MATTER_PATH}/examples/common/cmake_common/components_include.cmake) set(EXTRA_COMPONENT_DIRS "${ESP_MATTER_PATH}/examples/common" diff --git a/examples/light/CMakeLists.txt b/examples/light/CMakeLists.txt index 0e38e605d..76b17f8d7 100644 --- a/examples/light/CMakeLists.txt +++ b/examples/light/CMakeLists.txt @@ -14,7 +14,7 @@ set(MATTER_SDK_PATH ${ESP_MATTER_PATH}/connectedhomeip/connectedhomeip) # This should be done before using the IDF_TARGET variable. include($ENV{IDF_PATH}/tools/cmake/project.cmake) -include(${CMAKE_CURRENT_LIST_DIR}/../common/cmake_common/components_include.cmake) +include(${ESP_MATTER_PATH}/examples/common/cmake_common/components_include.cmake) set(EXTRA_COMPONENT_DIRS "${ESP_MATTER_PATH}/examples/common" diff --git a/examples/light_switch/CMakeLists.txt b/examples/light_switch/CMakeLists.txt index d30c82e76..cce8f9247 100644 --- a/examples/light_switch/CMakeLists.txt +++ b/examples/light_switch/CMakeLists.txt @@ -33,7 +33,7 @@ set(MATTER_SDK_PATH ${ESP_MATTER_PATH}/connectedhomeip/connectedhomeip) # This should be done before using the IDF_TARGET variable. include($ENV{IDF_PATH}/tools/cmake/project.cmake) include($ENV{ESP_MATTER_DEVICE_PATH}/esp_matter_device.cmake) -include(${CMAKE_CURRENT_LIST_DIR}/../common/cmake_common/components_include.cmake) +include(${ESP_MATTER_PATH}/examples/common/cmake_common/components_include.cmake) set(EXTRA_COMPONENT_DIRS "${ESP_MATTER_PATH}/examples/common" diff --git a/examples/refrigerator/CMakeLists.txt b/examples/refrigerator/CMakeLists.txt index 9667937d2..5cd714c0c 100644 --- a/examples/refrigerator/CMakeLists.txt +++ b/examples/refrigerator/CMakeLists.txt @@ -34,7 +34,7 @@ set(ZAP_GENERATED_PATH ${CMAKE_CURRENT_LIST_DIR}/main/zap-generated) # This should be done before using the IDF_TARGET variable. include($ENV{IDF_PATH}/tools/cmake/project.cmake) include($ENV{ESP_MATTER_DEVICE_PATH}/esp_matter_device.cmake) -include(${CMAKE_CURRENT_LIST_DIR}/../common/cmake_common/components_include.cmake) +include(${ESP_MATTER_PATH}/examples/common/cmake_common/components_include.cmake) set(EXTRA_COMPONENT_DIRS "${ESP_MATTER_PATH}/examples/common" diff --git a/examples/room_air_conditioner/CMakeLists.txt b/examples/room_air_conditioner/CMakeLists.txt index 098df5ece..446515182 100644 --- a/examples/room_air_conditioner/CMakeLists.txt +++ b/examples/room_air_conditioner/CMakeLists.txt @@ -33,7 +33,7 @@ set(MATTER_SDK_PATH ${ESP_MATTER_PATH}/connectedhomeip/connectedhomeip) # This should be done before using the IDF_TARGET variable. include($ENV{IDF_PATH}/tools/cmake/project.cmake) include($ENV{ESP_MATTER_DEVICE_PATH}/esp_matter_device.cmake) -include(${CMAKE_CURRENT_LIST_DIR}/../common/cmake_common/components_include.cmake) +include($ENV{ESP_MATTER_PATH}/examples/common/cmake_common/components_include.cmake) set(EXTRA_COMPONENT_DIRS "${ESP_MATTER_PATH}/examples/common" diff --git a/examples/zap_light/CMakeLists.txt b/examples/zap_light/CMakeLists.txt index 950671444..47ba58815 100644 --- a/examples/zap_light/CMakeLists.txt +++ b/examples/zap_light/CMakeLists.txt @@ -33,7 +33,7 @@ set(MATTER_SDK_PATH ${ESP_MATTER_PATH}/connectedhomeip/connectedhomeip) # This should be done before using the IDF_TARGET variable. include($ENV{IDF_PATH}/tools/cmake/project.cmake) include($ENV{ESP_MATTER_DEVICE_PATH}/esp_matter_device.cmake) -include(${CMAKE_CURRENT_LIST_DIR}/../common/cmake_common/components_include.cmake) +include(${ESP_MATTER_PATH}/examples/common/cmake_common/components_include.cmake) set(EXTRA_COMPONENT_DIRS "${ESP_MATTER_PATH}/examples/common"