Skip to content

Commit 209a910

Browse files
yashicarlescufi
authored andcommitted
cmake: compiler: gcc: Explicitly spell out stddef.h and limits.h
Depending on how compiler is built, it prints a different include directory with `--print-file-name=include`. What we want, instead, is directories with `stddef.h` and `include-fixed/limits.h`. This commit explicitly specify the header files we want to use, then take the directory from the returned path. Signed-off-by: Yasushi SHOJI <[email protected]>
1 parent 9336e3e commit 209a910

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

cmake/compiler/clang/target.cmake

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@ find_program(CMAKE_CXX_COMPILER clang++ ${find_program_clang_args})
2020

2121
if(NOT "${ARCH}" STREQUAL "posix")
2222

23-
foreach(file_name include include-fixed)
23+
foreach(file_name include/stddef.h include-fixed/limits.h)
2424
execute_process(
2525
COMMAND ${CMAKE_C_COMPILER} --print-file-name=${file_name}
2626
OUTPUT_VARIABLE _OUTPUT
2727
)
28+
get_filename_component(_OUTPUT "${_OUTPUT}" DIRECTORY)
2829
string(REGEX REPLACE "\n" "" _OUTPUT ${_OUTPUT})
2930

3031
list(APPEND NOSTDINC ${_OUTPUT})

cmake/compiler/gcc/target.cmake

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,12 @@ if(NOT DEFINED NOSYSDEF_CFLAG)
2929
set(NOSYSDEF_CFLAG -undef)
3030
endif()
3131

32-
foreach(file_name include include-fixed)
32+
foreach(file_name include/stddef.h include-fixed/limits.h)
3333
execute_process(
3434
COMMAND ${CMAKE_C_COMPILER} --print-file-name=${file_name}
3535
OUTPUT_VARIABLE _OUTPUT
3636
)
37+
get_filename_component(_OUTPUT "${_OUTPUT}" DIRECTORY)
3738
string(REGEX REPLACE "\n" "" _OUTPUT "${_OUTPUT}")
3839

3940
list(APPEND NOSTDINC ${_OUTPUT})

cmake/compiler/host-gcc/target.cmake

+2-1
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,12 @@ if(NOT DEFINED NOSYSDEF_CFLAG)
6060
set(NOSYSDEF_CFLAG -undef)
6161
endif()
6262

63-
foreach(file_name include)
63+
foreach(file_name include/stddef.h)
6464
execute_process(
6565
COMMAND ${CMAKE_C_COMPILER} --print-file-name=${file_name}
6666
OUTPUT_VARIABLE _OUTPUT
6767
)
68+
get_filename_component(_OUTPUT "${_OUTPUT}" DIRECTORY)
6869
string(REGEX REPLACE "\n" "" _OUTPUT "${_OUTPUT}")
6970

7071
list(APPEND NOSTDINC ${_OUTPUT})

cmake/compiler/xcc/target.cmake

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,12 @@ if(NOT DEFINED NOSYSDEF_CFLAG)
2929
set(NOSYSDEF_CFLAG -undef)
3030
endif()
3131

32-
foreach(file_name include include-fixed)
32+
foreach(file_name include/stddef.h include-fixed/limits.h)
3333
execute_process(
3434
COMMAND ${CMAKE_C_COMPILER} --print-file-name=${file_name}
3535
OUTPUT_VARIABLE _OUTPUT
3636
)
37+
get_filename_component(_OUTPUT "${_OUTPUT}" DIRECTORY)
3738
string(REGEX REPLACE "\n" "" _OUTPUT "${_OUTPUT}")
3839

3940
list(APPEND NOSTDINC ${_OUTPUT})

0 commit comments

Comments
 (0)