From 4084b6da8052f0a07e8a240fcbb4a1555ef14c5b Mon Sep 17 00:00:00 2001 From: Martin Lambertsen Date: Sat, 20 Jul 2024 22:23:39 +0200 Subject: [PATCH] Add IMPORTED_CONFIGURATIONS property for CMake targets Some frameworks use the property in order to find libraries, e.g. like https://github.com/ros/catkin/blob/noetic-devel/cmake/catkin_libraries.cmake#L150 In order to support these kind of usages, this commit adds the property to all targets. This should solve #14606 and #16688. --- conan/tools/cmake/cmakedeps/templates/macros.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/conan/tools/cmake/cmakedeps/templates/macros.py b/conan/tools/cmake/cmakedeps/templates/macros.py index b5c0e185b8a..6ae7b33b9eb 100644 --- a/conan/tools/cmake/cmakedeps/templates/macros.py +++ b/conan/tools/cmake/cmakedeps/templates/macros.py @@ -88,6 +88,9 @@ def template(self): message(DEBUG "Created target ${_LIB_NAME} ${library_type} IMPORTED") set_target_properties(${_LIB_NAME} PROPERTIES IMPORTED_LOCATION${config_suffix} ${CONAN_FOUND_LIBRARY} IMPORTED_NO_SONAME ${no_soname_mode}) endif() + string(REGEX REPLACE "^_" "" _LOWER_CASE_CONFIG ${config_suffix}) + string(TOUPPER ${_LOWER_CASE_CONFIG} _CONFIG) + set_target_properties(${_LIB_NAME} PROPERTIES IMPORTED_CONFIGURATIONS ${_CONFIG}) list(APPEND _out_libraries_target ${_LIB_NAME}) message(VERBOSE "Conan: Found: ${CONAN_FOUND_LIBRARY}") else()