Skip to content

Commit 3f0ef2f

Browse files
committed
[libc] move darwin check to Architecture.cmake from CompileOptionsRules.cmake
1 parent e718db1 commit 3f0ef2f

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

libc/cmake/modules/LLVMLibCArchitectures.cmake

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,20 @@ if(explicit_target_triple AND
216216
endif()
217217
endif()
218218

219+
if(LIBC_TARGET_OS_IS_DARWIN)
220+
execute_process(
221+
COMMAND xcrun --sdk macosx --show-sdk-path
222+
OUTPUT_VARIABLE MACOSX_SDK_PATH
223+
RESULT_VARIABLE MACOSX_SDK_PATH_RESULT
224+
OUTPUT_STRIP_TRAILING_WHITESPACE
225+
)
226+
if(MACOSX_SDK_PATH_RESULT EQUAL 0)
227+
list(APPEND LIBC_COMPILE_OPTIONS_DEFAULT "-I" "${MACOSX_SDK_PATH}/usr/include")
228+
else()
229+
message(WARNING "Could not find macOS SDK path. `xcrun --sdk macosx --show-sdk-path` failed.")
230+
endif()
231+
endif()
232+
219233

220234
# Windows does not support full mode build.
221235
if (LIBC_TARGET_OS_IS_WINDOWS AND LLVM_LIBC_FULL_BUILD)

libc/cmake/modules/LLVMLibCCompileOptionRules.cmake

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -170,19 +170,6 @@ 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()
186173
endif()
187174

188175
if(LIBC_COMPILER_HAS_FIXED_POINT)

0 commit comments

Comments
 (0)