File tree Expand file tree Collapse file tree 1 file changed +23
-3
lines changed Expand file tree Collapse file tree 1 file changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -370,6 +370,27 @@ function(_compile_swift_files dependency_target_out_var_name)
370
370
set (swift_compiler_tool "${SWIFT_SOURCE_DIR} /utils/check-incremental" "${swift_compiler_tool} " )
371
371
endif ()
372
372
373
+ set (outputs
374
+ ${SWIFTFILE_OUTPUT} "${module_file} " "${module_doc_file} "
375
+ ${apinote_files} )
376
+
377
+ if (XCODE )
378
+ # HACK: work around an issue with CMake Xcode generator and the Swift
379
+ # driver.
380
+ #
381
+ # The Swift driver does not update the mtime of the output files if the
382
+ # existing output files on disk are identical to the ones that are about
383
+ # to be written. This behavior confuses the makefiles used in CMake Xcode
384
+ # projects: the makefiles will not consider everything up to date after
385
+ # invoking the compiler. As a result, the standard library gets rebuilt
386
+ # multiple times during a single build.
387
+ #
388
+ # To work around this issue we touch the output files so that their mtime
389
+ # always gets updated.
390
+ set (command_touch_outputs
391
+ COMMAND "${CMAKE_COMMAND} " -E touch ${outputs} )
392
+ endif ()
393
+
373
394
add_custom_command_target (
374
395
dependency_target
375
396
${command_create_dirs}
@@ -380,9 +401,8 @@ function(_compile_swift_files dependency_target_out_var_name)
380
401
"${line_directive_tool} " "${source_files} " --
381
402
"${swift_compiler_tool} " "${main_command} " ${swift_flags}
382
403
${output_option} "${source_files} "
383
- OUTPUT
384
- ${SWIFTFILE_OUTPUT} "${module_file} " "${module_doc_file} "
385
- ${apinote_files}
404
+ ${command_touch_outputs}
405
+ OUTPUT ${outputs}
386
406
DEPENDS
387
407
${swift_compiler_tool_dep}
388
408
${source_files} ${SWIFTFILE_DEPENDS}
You can’t perform that action at this time.
0 commit comments