Skip to content

Commit bc6795c

Browse files
authored
Merge pull request #68256 from compnerd/sanitary
build: clean up dependency tracking for portability
2 parents a53196e + fe42740 commit bc6795c

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

cmake/modules/AddPureSwift.cmake

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,16 @@ function(force_target_link_libraries TARGET)
55
cmake_parse_arguments(ARGS "" "" "PUBLIC" ${ARGN})
66

77
foreach(DEPENDENCY ${ARGS_PUBLIC})
8-
target_link_libraries(${TARGET} PRIVATE
9-
${DEPENDENCY}
10-
)
8+
target_link_libraries(${TARGET} PRIVATE ${DEPENDENCY})
119
add_dependencies(${TARGET} ${DEPENDENCY})
1210

13-
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/forced-${DEPENDENCY}-dep.swift
14-
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/forced-${DEPENDENCY}-dep.swift
11+
string(REGEX REPLACE [<>:\"/\\|?*] _ sanitized ${DEPENDENCY})
12+
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/forced-${sanitized}-dep.swift
13+
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/forced-${sanitized}-dep.swift
1514
DEPENDS ${DEPENDENCY}
1615
)
1716
target_sources(${TARGET} PRIVATE
18-
${CMAKE_CURRENT_BINARY_DIR}/forced-${DEPENDENCY}-dep.swift
17+
${CMAKE_CURRENT_BINARY_DIR}/forced-${sanitized}-dep.swift
1918
)
2019
endforeach()
2120
endfunction()

0 commit comments

Comments
 (0)