[ESP32] Use the backward compatible option for linking wifi libs (#26923)

diff --git a/config/esp32/components/chip/CMakeLists.txt b/config/esp32/components/chip/CMakeLists.txt
index 2412e825..316ded0 100644
--- a/config/esp32/components/chip/CMakeLists.txt
+++ b/config/esp32/components/chip/CMakeLists.txt
@@ -392,7 +392,7 @@
 list(APPEND chip_libraries $<TARGET_FILE:${lwip_lib}>)
 
 
-if (CONFIG_ESP_WIFI_ENABLED)
+if (CONFIG_ESP32_WIFI_ENABLED)
     idf_component_get_property(esp_wifi_lib esp_wifi COMPONENT_LIB)
     idf_component_get_property(esp_wifi_dir esp_wifi COMPONENT_DIR)
     list(APPEND chip_libraries $<TARGET_FILE:${esp_wifi_lib}>)