mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-13 21:44:16 +00:00
Fix sys/sysctl.h depreciation error under glibc 2.30+
glibc 2.30 and up emit an ugly depreciation warning on `#include <sys/sysctl.h>` - this patch makes the build system fail the include test for `sys/sysctl.h` by forcibly setting `-Werror` before the call to `check_include_files` (which internally uses `try_compile`) to get `HAVE_SYS_SYSCTL` to not be defined (even if it's there) if it would cause such a depreciation message to be emitted. Ideally, we would not have to manually massage `CMAKE_C_FLAGS` before calling `check_include_files` and could just tweak that to either always or conditionally try compilation with `-Werror`, but try_compile doesn't actually use any overridden `CMAKE_C_FLAGS` values [0] (dating back to 2006). [0]: https://cmake.org/pipermail/cmake/2006-October/011649.html
This commit is contained in:
parent
02241d19be
commit
372f03ba20
1 changed files with 7 additions and 0 deletions
|
@ -115,7 +115,14 @@ check_struct_has_member("struct stat" st_mtim.tv_nsec "sys/stat.h" HAVE_STRUCT_S
|
|||
LANGUAGE CXX)
|
||||
check_include_file_cxx(sys/ioctl.h HAVE_SYS_IOCTL_H)
|
||||
check_include_file_cxx(sys/select.h HAVE_SYS_SELECT_H)
|
||||
|
||||
# glibc 2.30 deprecated <sys/sysctl.h> because that's what glibc does.
|
||||
# Checking for that here rather than hardcoding a check on the glibc
|
||||
# version in the C++ sources at point of use makes more sense.
|
||||
SET(OLD_CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
|
||||
check_include_files("sys/types.h;sys/sysctl.h" HAVE_SYS_SYSCTL_H)
|
||||
SET(CMAKE_C_FLAGS "${OLD_CMAKE_C_FLAGS}")
|
||||
|
||||
check_cxx_symbol_exists(eventfd sys/eventfd.h HAVE_EVENTFD)
|
||||
check_cxx_symbol_exists(pipe2 unistd.h HAVE_PIPE2)
|
||||
|
|
Loading…
Reference in a new issue