Skip to content

Commit fe42740

Browse files
committed
build: clean up dependency tracking for portability
`:` is not a valid file system character but is used to namespace the imported targets. This is then used to create the stamp file. Sanitize the name prior to use as a stamp file name.
1 parent 5422f9a commit fe42740

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)