diff --git a/examples/protocols/esp_http_client/CMakeLists.txt b/examples/protocols/esp_http_client/CMakeLists.txt index 3316f636e7..82b67bb743 100644 --- a/examples/protocols/esp_http_client/CMakeLists.txt +++ b/examples/protocols/esp_http_client/CMakeLists.txt @@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.16) set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) -if(${IDF_TARGET} STREQUAL "linux") +if("${IDF_TARGET}" STREQUAL "linux") list(APPEND EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/tools/mocks/freertos/" "$ENV{IDF_PATH}/examples/protocols/linux_stubs/esp_stubs") set(COMPONENTS main) diff --git a/examples/protocols/esp_http_client/main/CMakeLists.txt b/examples/protocols/esp_http_client/main/CMakeLists.txt index 70ed376538..6367af7fde 100644 --- a/examples/protocols/esp_http_client/main/CMakeLists.txt +++ b/examples/protocols/esp_http_client/main/CMakeLists.txt @@ -2,7 +2,9 @@ # # (If this was a component, we would set COMPONENT_EMBED_TXTFILES here.) set(requires "") -if(${IDF_TARGET} STREQUAL "linux") +idf_build_get_property(target IDF_TARGET) + +if(${target} STREQUAL "linux") list(APPEND requires esp_stubs esp-tls esp_http_client protocol_examples_common nvs_flash) endif() idf_component_register(SRCS "esp_http_client_example.c" diff --git a/examples/protocols/http_server/simple/CMakeLists.txt b/examples/protocols/http_server/simple/CMakeLists.txt index 33574050bb..4efbe60333 100644 --- a/examples/protocols/http_server/simple/CMakeLists.txt +++ b/examples/protocols/http_server/simple/CMakeLists.txt @@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.16) set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) -if(${IDF_TARGET} STREQUAL "linux") +if("${IDF_TARGET}" STREQUAL "linux") list(APPEND EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/tools/mocks/freertos/" "$ENV{IDF_PATH}/examples/protocols/linux_stubs/esp_stubs") set(COMPONENTS main) diff --git a/examples/protocols/http_server/simple/main/CMakeLists.txt b/examples/protocols/http_server/simple/main/CMakeLists.txt index 28894fd56e..564c3f54f6 100644 --- a/examples/protocols/http_server/simple/main/CMakeLists.txt +++ b/examples/protocols/http_server/simple/main/CMakeLists.txt @@ -1,5 +1,7 @@ set(requires "") -if(${IDF_TARGET} STREQUAL "linux") +idf_build_get_property(target IDF_TARGET) + +if(${target} STREQUAL "linux") list(APPEND requires esp_stubs esp-tls esp_http_server protocol_examples_common nvs_flash) endif() idf_component_register(SRCS "main.c" diff --git a/examples/protocols/sockets/tcp_client/main/CMakeLists.txt b/examples/protocols/sockets/tcp_client/main/CMakeLists.txt index 721b9c9316..6710f66dee 100644 --- a/examples/protocols/sockets/tcp_client/main/CMakeLists.txt +++ b/examples/protocols/sockets/tcp_client/main/CMakeLists.txt @@ -1,4 +1,6 @@ -if(${IDF_TARGET} STREQUAL "linux") +idf_build_get_property(target IDF_TARGET) + +if(${target} STREQUAL "linux") set(requires esp_stubs protocol_examples_common nvs_flash) endif()