Skip to content

Commit 0165f09

Browse files
committed
[CMake] Improve argument list handling of force_target_link_libraries
The argument list handling was a hack and confusing.
1 parent f8f7109 commit 0165f09

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

cmake/modules/AddPureSwift.cmake

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,15 @@ include(macCatalystUtils)
22

33
# Workaround a cmake bug, see the corresponding function in swift-syntax
44
function(force_target_link_libraries TARGET)
5-
cmake_parse_arguments(ARGS "" "" "PUBLIC" ${ARGN})
6-
7-
foreach(DEPENDENCY ${ARGS_PUBLIC})
8-
target_link_libraries(${TARGET} PRIVATE ${DEPENDENCY})
9-
add_dependencies(${TARGET} ${DEPENDENCY})
5+
target_link_libraries(${TARGET} ${ARGN})
106

7+
cmake_parse_arguments(ARGS "PUBLIC;PRIVATE;INTERFACE" "" "" ${ARGN})
8+
foreach(DEPENDENCY ${ARGS_UNPARSED_ARGUMENTS})
119
string(REGEX REPLACE [<>:\"/\\|?*] _ sanitized ${DEPENDENCY})
1210
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/forced-${sanitized}-dep.swift
1311
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/forced-${sanitized}-dep.swift
1412
DEPENDS ${DEPENDENCY}
15-
)
13+
)
1614
target_sources(${TARGET} PRIVATE
1715
${CMAKE_CURRENT_BINARY_DIR}/forced-${sanitized}-dep.swift
1816
)

0 commit comments

Comments
 (0)