Skip to content

Swift: Exclude SDK include paths

Populate CMAKE_Swift_IMPLICIT_INCLUDE_DIRECTORIES with the macOS SDK's include directory so that we filter such implicit directories out of Swift targets.

Original Description

Xcode: Avoid SDK paths to be added to solution

When imported target had path to SDK as public include it cmGlobalXCodeGenerator tried to add such header as an attribute SYSTEM_HEADER_SEARCH_PATHS to build settings and Xcode adds such header with -isystem flag when compiles cxx code. This patch collects paths to all headers and adds them to internal variable CMAKE_APPLE_AVAILABLE_SYSROOTS. This variable then used in cmGlobalXCodeGenerator to avoid adding includes like ${CMAKE_APPLE_AVAILABLE_SYSROOTS}/usr/include to solution.

Fixes: #19845 (closed)
Backport: release
Topic-rename: swift-no-sdk-include

Edited by Brad King

Merge request reports