Skip to content

Commit 58c259f

Browse files
committed
build: simplify the ICU include handling
This simplifies the ICU flags handling. This inlines the use into just the library case, as the ICU usage is for the standard library targets only. It uses CMake to properly add the include paths as a system search path. This should fix the Linux builds as the include flags were being de-duplicated as we are now using CMake more than we were previously.
1 parent ff6fc09 commit 58c259f

File tree

1 file changed

+3
-24
lines changed

1 file changed

+3
-24
lines changed

cmake/modules/AddSwift.cmake

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -373,30 +373,6 @@ function(_add_variant_c_compile_flags)
373373
endforeach()
374374
endif()
375375

376-
set(ICU_UC_INCLUDE_DIR ${SWIFT_${CFLAGS_SDK}_${CFLAGS_ARCH}_ICU_UC_INCLUDE})
377-
if(NOT "${ICU_UC_INCLUDE_DIR}" STREQUAL "" AND
378-
NOT "${ICU_UC_INCLUDE_DIR}" STREQUAL "/usr/include" AND
379-
NOT "${ICU_UC_INCLUDE_DIR}" STREQUAL "/usr/${SWIFT_SDK_${CFLAGS_SDK}_ARCH_${CFLAGS_ARCH}_TRIPLE}/include" AND
380-
NOT "${ICU_UC_INCLUDE_DIR}" STREQUAL "/usr/${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_ARCH_${SWIFT_HOST_VARIANT_ARCH}_TRIPLE}/include")
381-
if(SWIFT_COMPILER_IS_MSVC_LIKE)
382-
list(APPEND result -I;${ICU_UC_INCLUDE_DIR})
383-
else()
384-
list(APPEND result -isystem;${ICU_UC_INCLUDE_DIR})
385-
endif()
386-
endif()
387-
388-
set(ICU_I18N_INCLUDE_DIR ${SWIFT_${CFLAGS_SDK}_${CFLAGS_ARCH}_ICU_I18N_INCLUDE})
389-
if(NOT "${ICU_I18N_INCLUDE_DIR}" STREQUAL "" AND
390-
NOT "${ICU_I18N_INCLUDE_DIR}" STREQUAL "/usr/include" AND
391-
NOT "${ICU_I18N_INCLUDE_DIR}" STREQUAL "/usr/${SWIFT_SDK_${CFLAGS_SDK}_ARCH_${CFLAGS_ARCH}_TRIPLE}/include" AND
392-
NOT "${ICU_I18N_INCLUDE_DIR}" STREQUAL "/usr/${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_ARCH_${SWIFT_HOST_VARIANT_ARCH}_TRIPLE}/include")
393-
if(SWIFT_COMPILER_IS_MSVC_LIKE)
394-
list(APPEND result -I;${ICU_I18N_INCLUDE_DIR})
395-
else()
396-
list(APPEND result -isystem;${ICU_I18N_INCLUDE_DIR})
397-
endif()
398-
endif()
399-
400376
set("${CFLAGS_RESULT_VAR_NAME}" "${result}" PARENT_SCOPE)
401377
endfunction()
402378

@@ -1447,6 +1423,9 @@ function(_add_swift_library_single target name)
14471423
endif()
14481424

14491425
# Set compilation and link flags.
1426+
target_include_directories(${target} SYSTEM PRIVATE
1427+
${SWIFT_${SWIFTLIB_SINGLE_SDK}_${SWIFTLIB_SINGLE_ARCHITECTURE}_ICU_UC_INCLUDE}
1428+
${SWIFT_${SWIFTLIB_SINGLE_SDK}_${SWIFTLIB_SINGLE_ARCHITECTURE}_ICU_I18N_INCLUDE})
14501429
target_compile_options(${target} PRIVATE
14511430
${c_compile_flags})
14521431
target_link_options(${target} PRIVATE

0 commit comments

Comments
 (0)