@@ -441,21 +441,23 @@ function(_compile_swift_files
441
441
set ("${dependency_target_out_var_name} " "${dependency_target} " PARENT_SCOPE )
442
442
443
443
# This is the target to generate the .swiftmodule and .swiftdoc
444
- add_custom_command_target (
445
- module_dependency_target
446
- COMMAND
447
- "${line_directive_tool} " "${source_files} " --
448
- "${swift_compiler_tool} " "${module_command} " ${swift_flags}
449
- "${source_files} "
450
- ${command_touch_module_outputs}
451
- OUTPUT ${module_outputs}
452
- DEPENDS
453
- ${swift_compiler_tool_dep}
454
- ${source_files} ${SWIFTFILE_DEPENDS}
455
- ${swift_ide_test_dependency} ${api_notes_dependency_target}
456
- ${obj_dirs_dependency_target}
457
- COMMENT "Generating ${module_file} " )
458
- set ("${dependency_module_target_out_var_name} " "${module_dependency_target} " PARENT_SCOPE )
444
+ if (module_file )
445
+ add_custom_command_target (
446
+ module_dependency_target
447
+ COMMAND
448
+ "${line_directive_tool} " "${source_files} " --
449
+ "${swift_compiler_tool} " "${module_command} " ${swift_flags}
450
+ "${source_files} "
451
+ ${command_touch_module_outputs}
452
+ OUTPUT ${module_outputs}
453
+ DEPENDS
454
+ ${swift_compiler_tool_dep}
455
+ ${source_files} ${SWIFTFILE_DEPENDS}
456
+ ${swift_ide_test_dependency} ${api_notes_dependency_target}
457
+ ${obj_dirs_dependency_target}
458
+ COMMENT "Generating ${module_file} " )
459
+ set ("${dependency_module_target_out_var_name} " "${module_dependency_target} " PARENT_SCOPE )
460
+ endif ()
459
461
460
462
# Make sure the build system knows the file is a generated object file.
461
463
set_source_files_properties (${SWIFTFILE_OUTPUT}
0 commit comments