Skip to content

Commit

Permalink
gcc/target.cmake: fix build with gcc-13
Browse files Browse the repository at this point in the history
Configuration error:
| -- Configuring done (4.9s)
| CMake Error in CMakeLists.txt:
|   Target "zephyr_interface" contains relative path in its
|   INTERFACE_INCLUDE_DIRECTORIES:
|
|     "include-fixed"

With GCC-13, limits.h and syslimits.h header files
are always being installed to include folder.
https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=be9dd80f933480

Signed-off-by: Naveen Saini <[email protected]>
  • Loading branch information
saininav authored and tristanseifert committed Jun 10, 2024
1 parent c8e0a17 commit 4bf0fbb
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion cmake/compiler/gcc/target.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,21 @@ if(NOT DEFINED NOSYSDEF_CFLAG)
set(NOSYSDEF_CFLAG -undef)
endif()

foreach(file_name include/stddef.h include-fixed/limits.h)
# GCC-13, does not install limits.h on include-fixed anymore
# https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=be9dd80f933480
# Add check for GCC version >= 13.1
execute_process(
COMMAND ${CMAKE_C_COMPILER} -dumpversion
OUTPUT_VARIABLE temp_compiler_version
)

if("${temp_compiler_version}" VERSION_GREATER_EQUAL 13.1.0)
set(fix_header_file include/limits.h)
else()
set(fix_header_file include-fixed/limits.h)
endif()

foreach(file_name include/stddef.h "${fix_header_file}")
execute_process(
COMMAND ${CMAKE_C_COMPILER} --print-file-name=${file_name}
OUTPUT_VARIABLE _OUTPUT
Expand Down

0 comments on commit 4bf0fbb

Please sign in to comment.