Skip to content

Commit 3005fde

Browse files
committed
Scan depth=2 for project_build_tools_unwrap_interface_link_libraries
1 parent 8d63e68 commit 3005fde

File tree

1 file changed

+28
-5
lines changed

1 file changed

+28
-5
lines changed

cmake/tools.cmake

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ function(__project_build_tools_recursive_scan_unwrap OUTPUT_VAR INPUT_VAR)
248248
endif()
249249
endfunction()
250250

251-
function(project_build_tools_unwrap_interface_link_libraries OUTPUT_VAR)
251+
function(__project_build_tools_unwrap_interface_link_libraries OUTPUT_VAR)
252252
set(optionArgs)
253253
set(oneValueArgs)
254254
set(multiValueArgs TARGET_NAME TARGET_MATCH)
@@ -265,20 +265,23 @@ function(project_build_tools_unwrap_interface_link_libraries OUTPUT_VAR)
265265
set(TARGET_NAME "${TARGET_NAME_ORIGIN}")
266266
endif()
267267

268-
if(TARGET ${TARGET_NAME})
268+
if(TARGET "${TARGET_NAME}")
269269
# Get the imported location of the target
270270
project_build_tools_get_imported_location(__TARGET_IMPORTED_LOCATION
271-
${TARGET_NAME})
271+
"${TARGET_NAME}")
272272
if(__TARGET_IMPORTED_LOCATION)
273273
list(APPEND __TARGET_CHECK_NAMES ${__TARGET_IMPORTED_LOCATION})
274274
endif()
275275

276276
# Get the interface link libraries of the target
277277
set(__TARGET_LINK_LIBRARIES)
278-
get_target_property(__TARGET_LINK_LIBRARIES ${TARGET_NAME}
278+
get_target_property(__TARGET_LINK_LIBRARIES "${TARGET_NAME}"
279279
INTERFACE_LINK_LIBRARIES)
280280
list(APPEND __TARGET_CHECK_NAMES ${__TARGET_LINK_LIBRARIES})
281-
281+
else()
282+
# If the name is not a target, it should be a link name. We can directly
283+
# append it to the checking list.
284+
list(APPEND __TARGET_CHECK_NAMES "${TARGET_NAME}")
282285
endif()
283286
endforeach()
284287

@@ -305,3 +308,23 @@ function(project_build_tools_unwrap_interface_link_libraries OUTPUT_VAR)
305308
${__OUTPUT_VAR}
306309
PARENT_SCOPE)
307310
endfunction()
311+
312+
function(project_build_tools_unwrap_interface_link_libraries OUTPUT_VAR)
313+
set(optionArgs)
314+
set(oneValueArgs)
315+
set(multiValueArgs TARGET_NAME TARGET_MATCH)
316+
cmake_parse_arguments(__SCAN_OPTION "${optionArgs}" "${oneValueArgs}"
317+
"${multiValueArgs}" "${ARGN}")
318+
319+
set(__OUTPUT_VAR_LEVEL_1)
320+
set(__OUTPUT_VAR_LEVEL_2)
321+
__project_build_tools_unwrap_interface_link_libraries(__OUTPUT_VAR_LEVEL_1
322+
"${ARGN}")
323+
__project_build_tools_unwrap_interface_link_libraries(
324+
__OUTPUT_VAR_LEVEL_2 TARGET_NAME ${__OUTPUT_VAR_LEVEL_1} TARGET_MATCH
325+
${__SCAN_OPTION_TARGET_MATCH})
326+
327+
set(${OUTPUT_VAR}
328+
${__OUTPUT_VAR_LEVEL_2}
329+
PARENT_SCOPE)
330+
endfunction()

0 commit comments

Comments
 (0)