@@ -917,11 +917,16 @@ function(_compile_swift_files
917
917
# list in the Python script.
918
918
string (REPLACE ";" "'\n '" source_files_quoted "${source_files} " )
919
919
string (SHA1 file_name "'${source_files_quoted} '" )
920
+ set (file_path_target "filelist-${file_name} " )
920
921
set (file_path "${CMAKE_CURRENT_BINARY_DIR} /${file_name} .txt" )
921
- file (WRITE "${file_path} .tmp" "'${source_files_quoted} '" )
922
- add_custom_command (
923
- OUTPUT "${file_path} "
924
- COMMAND ${CMAKE_COMMAND} -E copy_if_different "${file_path} .tmp" "${file_path} " )
922
+
923
+ if (NOT TARGET ${file_path_target} )
924
+ file (WRITE "${file_path} .tmp" "'${source_files_quoted} '" )
925
+ add_custom_command_target (unused_var
926
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different "${file_path} .tmp" "${file_path} "
927
+ CUSTOM_TARGET_NAME ${file_path_target}
928
+ OUTPUT "${file_path} " )
929
+ endif ()
925
930
926
931
# If this platform/architecture combo supports backward deployment to old
927
932
# Objective-C runtimes, we need to copy a YAML file with legacy type layout
@@ -950,7 +955,7 @@ function(_compile_swift_files
950
955
OUTPUT ${standard_outputs}
951
956
DEPENDS
952
957
"${line_directive_tool} "
953
- "${file_path } "
958
+ "${file_path_target } "
954
959
${swift_compiler_tool_dep}
955
960
${source_files} ${SWIFTFILE_DEPENDS}
956
961
${swift_ide_test_dependency}
@@ -993,7 +998,7 @@ function(_compile_swift_files
993
998
OUTPUT ${module_outputs}
994
999
DEPENDS
995
1000
"${line_directive_tool} "
996
- "${file_path } "
1001
+ "${file_path_target } "
997
1002
${swift_compiler_tool_dep}
998
1003
${source_files} ${SWIFTFILE_DEPENDS}
999
1004
${swift_ide_test_dependency}
@@ -1022,7 +1027,7 @@ function(_compile_swift_files
1022
1027
DEPENDS
1023
1028
"${module_dependency_target} "
1024
1029
"${line_directive_tool} "
1025
- "${file_path } "
1030
+ "${file_path_target } "
1026
1031
${swift_compiler_tool_dep}
1027
1032
${source_files} ${SWIFTFILE_DEPENDS}
1028
1033
${swift_ide_test_dependency}
@@ -1063,7 +1068,7 @@ function(_compile_swift_files
1063
1068
${maccatalyst_module_outputs}
1064
1069
DEPENDS
1065
1070
"${line_directive_tool} "
1066
- "${file_path } "
1071
+ "${file_path_target } "
1067
1072
${swift_compiler_tool_dep}
1068
1073
${source_files}
1069
1074
${SWIFTFILE_DEPENDS}
@@ -1093,7 +1098,7 @@ function(_compile_swift_files
1093
1098
OUTPUT ${sib_outputs}
1094
1099
DEPENDS
1095
1100
"${line_directive_tool} "
1096
- "${file_path } "
1101
+ "${file_path_target } "
1097
1102
${swift_compiler_tool_dep}
1098
1103
${source_files} ${SWIFTFILE_DEPENDS}
1099
1104
${copy_legacy_layouts_dep}
@@ -1113,7 +1118,7 @@ function(_compile_swift_files
1113
1118
OUTPUT ${sibopt_outputs}
1114
1119
DEPENDS
1115
1120
"${line_directive_tool} "
1116
- "${file_path } "
1121
+ "${file_path_target } "
1117
1122
${swift_compiler_tool_dep}
1118
1123
${source_files} ${SWIFTFILE_DEPENDS}
1119
1124
${copy_legacy_layouts_dep}
@@ -1134,7 +1139,7 @@ function(_compile_swift_files
1134
1139
OUTPUT ${sibgen_outputs}
1135
1140
DEPENDS
1136
1141
"${line_directive_tool} "
1137
- "${file_path } "
1142
+ "${file_path_target } "
1138
1143
${swift_compiler_tool_dep}
1139
1144
${source_files} ${SWIFTFILE_DEPENDS}
1140
1145
${copy_legacy_layouts_dep}
0 commit comments