Skip to content

Commit 5f99c9f

Browse files
committed
[libc] include sdk path
Signed-off-by: Shreeyash Pandey <[email protected]>
1 parent 4a1140a commit 5f99c9f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

libc/cmake/modules/LLVMLibCCompileOptionRules.cmake

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,19 @@ function(_get_common_compile_options output_var flags)
170170
list(APPEND compile_options "-idirafter${LIBC_KERNEL_HEADERS}")
171171
endif()
172172
endif()
173+
if(LIBC_TARGET_OS_IS_DARWIN)
174+
execute_process(
175+
COMMAND xcrun --sdk macosx --show-sdk-path
176+
OUTPUT_VARIABLE MACOSX_SDK_PATH
177+
RESULT_VARIABLE MACOSX_SDK_PATH_RESULT
178+
OUTPUT_STRIP_TRAILING_WHITESPACE
179+
)
180+
if(MACOSX_SDK_PATH_RESULT EQUAL 0)
181+
list(APPEND compile_options "-I" "${MACOSX_SDK_PATH}/usr/include")
182+
else()
183+
message(WARNING "Could not find macOS SDK path. `xcrun --sdk macosx --show-sdk-path` failed.")
184+
endif()
185+
endif()
173186
endif()
174187

175188
if(LIBC_COMPILER_HAS_FIXED_POINT)

0 commit comments

Comments
 (0)