@@ -58,26 +58,33 @@ if (SWIFT_SWIFT_PARSER)
58
58
${CMAKE_SHARED_LIBRARY_SUFFIX}
59
59
OUTPUT_VARIABLE SWIFT_SYNTAX_SHARED_LIBRARIES )
60
60
61
- # The complete set of files that get installed.
62
- set (SWIFT_SYNTAX_DEST_FILES )
61
+ # Interface library to collect swiftinterfaces and swiftmodules from
62
+ # SwiftSyntax
63
+ add_library (swiftSyntaxLibraries INTERFACE )
63
64
64
65
# Copy over all of the shared libraries from earlyswiftsyntax so they can
65
66
# be found via RPATH.
66
67
foreach (sharedlib ${SWIFT_SYNTAX_SHARED_LIBRARIES} )
67
68
add_custom_command (
68
- OUTPUT ${SWIFT_HOST_LIBRARIES_DEST_DIR} /${sharedlib}
69
+ OUTPUT "${SWIFT_HOST_LIBRARIES_DEST_DIR} /${sharedlib} "
70
+ DEPENDS "${SWIFT_SYNTAX_LIBRARIES_SOURCE_DIR} /${sharedlib} "
69
71
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SWIFT_SYNTAX_LIBRARIES_SOURCE_DIR} /${sharedlib} ${SWIFT_HOST_LIBRARIES_DEST_DIR} /${sharedlib}
72
+ )
73
+
74
+ add_custom_target (copy_swiftSyntaxLibrary_${sharedlib}
75
+ DEPENDS "${SWIFT_HOST_LIBRARIES_DEST_DIR} /${sharedlib} "
70
76
COMMENT "Copying ${sharedlib} "
71
77
)
72
78
73
- list ( APPEND SWIFT_SYNTAX_DEST_FILES ${SWIFT_HOST_LIBRARIES_DEST_DIR} / ${sharedlib} )
79
+ add_dependencies ( swiftSyntaxLibraries copy_swiftSyntaxLibrary_ ${sharedlib} )
74
80
endforeach ()
75
81
76
82
# Copy all of the Swift modules from earlyswiftsyntax so they can be found
77
83
# in the same relative place within the build directory as in the final
78
84
# toolchain.
79
85
list (TRANSFORM SWIFT_SYNTAX_MODULES APPEND ".swiftmodule"
80
86
OUTPUT_VARIABLE SWIFT_SYNTAX_MODULE_DIRS )
87
+
81
88
foreach (module_dir ${SWIFT_SYNTAX_MODULE_DIRS} )
82
89
# Find all of the source module files.
83
90
file (GLOB module_files
@@ -93,17 +100,18 @@ if (SWIFT_SWIFT_PARSER)
93
100
94
101
add_custom_command (
95
102
OUTPUT ${dest_module_files}
103
+ DEPENDS ${module_files}
96
104
COMMAND ${CMAKE_COMMAND} -E make_directory ${SWIFT_HOST_LIBRARIES_DEST_DIR} /${module_dir}
97
105
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${module_files} ${SWIFT_HOST_LIBRARIES_DEST_DIR} /${module_dir}/
106
+ )
107
+
108
+ add_custom_target (copy_swiftSyntaxModule_${module_dir}
109
+ DEPENDS ${dest_module_files}
98
110
COMMENT "Copying ${module_dir} "
99
111
)
100
112
101
- list ( APPEND SWIFT_SYNTAX_DEST_FILES ${dest_module_files } )
113
+ add_dependencies ( swiftSyntaxLibraries copy_swiftSyntaxModule_${module_dir } )
102
114
endforeach ()
103
-
104
- # Add a custom target to copy over the SwiftSyntax build products into
105
- # their final places.
106
- add_custom_target (swiftSyntaxLibraries DEPENDS ${SWIFT_SYNTAX_DEST_FILES} )
107
115
endif ()
108
116
109
117
# Workaround a cmake bug, see the corresponding function in swift-syntax
0 commit comments