cmake: check ALL headers inside the look (including sys/types.h)

main
Anonymous Maarten 2022-11-01 13:08:38 +01:00 committed by Anonymous Maarten
parent 500bac0b13
commit 6e46090a30
1 changed files with 23 additions and 5 deletions

View File

@ -1004,12 +1004,30 @@ if(SDL_LIBC)
set(STDC_HEADERS 1) set(STDC_HEADERS 1)
else() else()
set(HAVE_LIBC TRUE) set(HAVE_LIBC TRUE)
check_include_file(sys/types.h HAVE_SYS_TYPES_H) set(headers_to_check
foreach(_HEADER ctype.h
stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h limits.h float.h float.h
strings.h wchar.h inttypes.h stdint.h ctype.h math.h iconv.h signal.h libunwind.h) iconv.h
inttypes.h
libunwind
limits.h
malloc.h
math.h
memory.h
signal.h
stdarg.h
stddef.h
stdint.h
stdio.h
stdlib.h
string.h
strings.h
sys/types.h
wchar.h
)
foreach(_HEADER ${headers_to_check})
string(TOUPPER "HAVE_${_HEADER}" _UPPER) string(TOUPPER "HAVE_${_HEADER}" _UPPER)
string(REPLACE "." "_" _HAVE_H ${_UPPER}) string(REGEX REPLACE "[./]" "_" _HAVE_H ${_UPPER})
check_include_file("${_HEADER}" ${_HAVE_H}) check_include_file("${_HEADER}" ${_HAVE_H})
endforeach() endforeach()
check_include_file(linux/input.h HAVE_LINUX_INPUT_H) check_include_file(linux/input.h HAVE_LINUX_INPUT_H)