@@ -160,6 +160,21 @@ function(add_swift_compiler_modules_library name)
160
160
if (add_to_syntaxparse )
161
161
set (syntaxparse_obj_files ${syntaxparse_obj_files} ${module_obj_file} )
162
162
endif ()
163
+ set (c_include_paths
164
+ # LLVM modules and headers.
165
+ "${LLVM_MAIN_INCLUDE_DIR} "
166
+ # Generated LLVM headers.
167
+ "${LLVM_INCLUDE_DIR} "
168
+ # Clang modules and headers.
169
+ ${CLANG_INCLUDE_DIRS}
170
+ # Bridging modules and headers.
171
+ "${SWIFT_MAIN_INCLUDE_DIR} "
172
+ # Generated C headers.
173
+ "${CMAKE_CURRENT_BINARY_DIR} /../include" )
174
+ set (c_include_paths_args )
175
+ foreach (c_include_path ${c_include_paths} )
176
+ list (APPEND c_include_paths_args "-Xcc" "-I" "-Xcc" "${c_include_path} " )
177
+ endforeach ()
163
178
164
179
# Compile the module into an object file
165
180
add_custom_command_target (dep_target OUTPUT ${module_obj_file}
@@ -173,14 +188,7 @@ function(add_swift_compiler_modules_library name)
173
188
"-emit-module-path" "${build_dir} /${module} .swiftmodule"
174
189
"-parse-as-library" ${sources}
175
190
"-wmo" ${swift_compile_options}
176
- # LLVM modules and headers.
177
- "-Xcc" "-I" "-Xcc" "${LLVM_MAIN_INCLUDE_DIR} "
178
- # Generated LLVM headers.
179
- "-Xcc" "-I" "-Xcc" "${LLVM_INCLUDE_DIR} "
180
- # Bridging modules and headers.
181
- "-Xcc" "-I" "-Xcc" "${SWIFT_SOURCE_DIR} /include"
182
- # Generated C headers.
183
- "-Xcc" "-I" "-Xcc" "${CMAKE_CURRENT_BINARY_DIR} /../include"
191
+ ${c_include_paths_args}
184
192
# Generated swift modules.
185
193
"-I" "${build_dir} "
186
194
COMMENT "Building swift module ${module} " )
0 commit comments