From 11f954e7ec25ed64d1547ac49ef87585371f29b1 Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Fri, 14 Oct 2022 22:01:48 -0500 Subject: [PATCH] Correctly query termios.h and ioctl.h for `struct winsize` The previous check was including these as relative includes, meaning the actual system header files weren't actually being explicitly included and the check could spuriously fail. CMAKE_EXTRA_INCLUDE_FILES doesn't seem to have a way to specify that the includes should be treated as system/global includes and CHECK_TYPE_SIZE() isn't documented as being affected by any other variables that do, so switch to another method altogether. This requires that `struct winsize` have a member `ws_row`, but as best as I can tell that is always the case. Closes #9279. --- cmake/ConfigureChecks.cmake | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cmake/ConfigureChecks.cmake b/cmake/ConfigureChecks.cmake index 7961013c1..b2b47c0d3 100644 --- a/cmake/ConfigureChecks.cmake +++ b/cmake/ConfigureChecks.cmake @@ -173,10 +173,9 @@ check_cxx_symbol_exists(wcstod_l "${WCSTOD_L_INCLUDES}" HAVE_WCSTOD_L) check_cxx_symbol_exists(uselocale "locale.h;xlocale.h" HAVE_USELOCALE) cmake_push_check_state() -set(CMAKE_EXTRA_INCLUDE_FILES termios.h sys/ioctl.h) -check_type_size("struct winsize" STRUCT_WINSIZE LANGUAGE CXX) +check_struct_has_member("struct winsize" ws_row "termios.h;sys/ioctl.h" _HAVE_WINSIZE) check_cxx_symbol_exists("TIOCGWINSZ" "termios.h;sys/ioctl.h" HAVE_TIOCGWINSZ) -if(STRUCT_WINSIZE GREATER -1 AND HAVE_TIOCGWINSZ EQUAL 1) +if(_HAVE_WINSIZE EQUAL 1 AND HAVE_TIOCGWINSZ EQUAL 1) set(HAVE_WINSIZE 1) endif() cmake_pop_check_state()