File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -73,3 +73,6 @@ check_cxx_compiler_flag("-ftrivial-auto-var-init=pattern" LIBC_CC_SUPPORTS_PATTE
73
73
74
74
# clang-6+, gcc-13+
75
75
check_cxx_compiler_flag ("-nostdlib++" LIBC_CC_SUPPORTS_NOSTDLIBPP )
76
+
77
+ # clang-3.0+
78
+ check_cxx_compiler_flag ("-nostdlibinc" LIBC_CC_SUPPORTS_NOSTDLIBINC )
Original file line number Diff line number Diff line change @@ -46,6 +46,14 @@ function(_get_common_compile_options output_var flags)
46
46
list (APPEND compile_options "-DLIBC_FULL_BUILD" )
47
47
# Only add -ffreestanding flag in full build mode.
48
48
list (APPEND compile_options "-ffreestanding" )
49
+ # Manually disable standard include paths to prevent system headers from
50
+ # being included.
51
+ if (LIBC_CC_SUPPORTS_NOSTDLIBINC )
52
+ list (APPEND compile_options "-nostdlibinc" )
53
+ else ()
54
+ list (APPEND compile_options "-isystem${COMPILER_RESOURCE_DIR} /include" )
55
+ list (APPEND compile_options "-nostdinc" )
56
+ endif ()
49
57
endif ()
50
58
51
59
if (LIBC_COMPILER_HAS_FIXED_POINT )
@@ -108,11 +116,6 @@ function(_get_common_compile_options output_var flags)
108
116
elseif (LIBC_TARGET_ARCHITECTURE_IS_AMDGPU )
109
117
list (APPEND compile_options "SHELL:-Xclang -mcode-object-version=none" )
110
118
endif ()
111
-
112
- # Manually disable all standard include paths and include the resource
113
- # directory to prevent system headers from being included.
114
- list (APPEND compile_options "-isystem${COMPILER_RESOURCE_DIR} /include" )
115
- list (APPEND compile_options "-nostdinc" )
116
119
endif ()
117
120
set (${output_var} ${compile_options} PARENT_SCOPE )
118
121
endfunction ()
You can’t perform that action at this time.
0 commit comments