Skip to content

Commit d7acca0

Browse files
artemdinaburgclaude
andcommitted
Fix macOS build with Homebrew LLVM
On macOS with Homebrew LLVM, explicitly adding LLVM_INCLUDE_DIRS breaks libc++ header search order (include_next can't find libc++'s wrapper headers). The Homebrew clang compiler already knows where its LLVM/Clang headers are located, so we don't need to add them explicitly. On Linux and other platforms, we still add the include paths explicitly since system LLVM packages don't interfere with the stdlib. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent d8a1169 commit d7acca0

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

lib/CMakeLists.txt

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -133,13 +133,16 @@ target_include_directories("${PROJECT_NAME}"
133133
$<INSTALL_INTERFACE:include>
134134
)
135135

136-
# Use SYSTEM to avoid interfering with stdlib header search order on macOS
137-
# (Homebrew LLVM bundles its own libc++ and -I paths break include_next)
138-
target_include_directories("${PROJECT_NAME}" SYSTEM
139-
PUBLIC
140-
${LLVM_INCLUDE_DIRS}
141-
${CLANG_INCLUDE_DIRS}
142-
)
136+
# On macOS with Homebrew LLVM, the compiler already knows where its headers are.
137+
# Adding explicit -I/-isystem paths breaks libc++ header search order (#include_next fails).
138+
# On Linux/other platforms, we need to add the paths explicitly.
139+
if(NOT APPLE)
140+
target_include_directories("${PROJECT_NAME}"
141+
PUBLIC
142+
${LLVM_INCLUDE_DIRS}
143+
${CLANG_INCLUDE_DIRS}
144+
)
145+
endif()
143146

144147
if(RELLIC_ENABLE_INSTALL)
145148
include(GNUInstallDirs)

0 commit comments

Comments
 (0)