[libc] Fix Linux kernel headers being included on all OS's
Summary:
The changes in
43bd7e3bb9
altered how we handled including headers, this included the system on
the GPU target which poisoned the include path that was curated to not
include any system headers. Change this to only apply is the target OS
is Linux.
This commit is contained in:
parent
bf2f5773d9
commit
9c26170dd7
@ -47,8 +47,6 @@ set(LIBC_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
set(LIBC_ENABLE_USE_BY_CLANG OFF CACHE BOOL "Whether or not to place libc in a build directory findable by a just built clang")
|
||||
|
||||
set(LIBC_KERNEL_HEADERS "/usr/include" CACHE STRING "Path to Linux kernel headers")
|
||||
|
||||
# Defining a global namespace to enclose all libc functions.
|
||||
set(default_namespace "__llvm_libc")
|
||||
if(LLVM_VERSION_MAJOR)
|
||||
@ -146,6 +144,11 @@ option(LLVM_LIBC_ALL_HEADERS "Outputs all functions in header files, regardless
|
||||
|
||||
option(LIBC_CONFIG_PATH "The path to user provided folder that configures the build for the target system." OFF)
|
||||
|
||||
if(LIBC_TARGET_OS_IS_LINUX)
|
||||
set(kernel_headers "/usr/include")
|
||||
endif()
|
||||
set(LIBC_KERNEL_HEADERS "${kernel_headers}" CACHE STRING "Path to Linux kernel headers")
|
||||
|
||||
set(LIBC_ENABLE_UNITTESTS ON)
|
||||
set(LIBC_ENABLE_HERMETIC_TESTS ${LLVM_LIBC_FULL_BUILD})
|
||||
|
||||
|
||||
@ -30,7 +30,9 @@ elseif (RUNTIMES_USE_LIBC STREQUAL "llvm-libc")
|
||||
check_cxx_compiler_flag(-nostdlibinc CXX_SUPPORTS_NOSTDLIBINC_FLAG)
|
||||
if(CXX_SUPPORTS_NOSTDLIBINC_FLAG)
|
||||
target_compile_options(runtimes-libc-headers INTERFACE "-nostdlibinc")
|
||||
target_compile_options(runtimes-libc-headers INTERFACE "-idirafter${LIBC_KERNEL_HEADERS}")
|
||||
if(LIBC_KERNEL_HEADERS)
|
||||
target_compile_options(runtimes-libc-headers INTERFACE "-idirafter${LIBC_KERNEL_HEADERS}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_library(runtimes-libc-static INTERFACE)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user