Merge branch 'contrib/github_pr_18103_v5.5' into 'release/v5.5'

Fix "IMPORTED_LOCATION not set for imported target" CMake errors during codemodel-v2 api queries with CMake 4.2 (GitHub PR) (v5.5)

See merge request espressif/esp-idf!45200
This commit is contained in:
Roland Dobai
2026-01-20 20:42:22 +01:00
2 changed files with 4 additions and 0 deletions
+2
View File
@@ -239,6 +239,8 @@ function(__build_init idf_path)
# Create the build target, to which the ESP-IDF build properties, dependencies are attached to.
# Must be global so as to be accessible from any subdirectory in custom projects.
add_library(__idf_build_target STATIC IMPORTED GLOBAL)
# Set the IMPORTED_LOCATION property to avoid errors on IDE codemodel queries with CMake >=4.2
set_property(TARGET __idf_build_target PROPERTY IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/dummy.a")
# Set the Python path (which may be passed in via -DPYTHON=) and store in a build property
set_default(PYTHON "python")
+2
View File
@@ -167,6 +167,8 @@ function(__component_add component_dir prefix component_source)
if(NOT component_target IN_LIST component_targets)
if(NOT TARGET ${component_target})
add_library(${component_target} STATIC IMPORTED)
# Set the IMPORTED_LOCATION property to avoid errors on IDE codemodel queries with CMake >=4.2
set_property(TARGET ${component_target} PROPERTY IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/dummy.a")
endif()
idf_build_set_property(__COMPONENT_TARGETS ${component_target} APPEND)
else()