From 7e8fdad2d51255330a87fd7e44b4b108836e232b Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Tue, 12 Dec 2023 22:00:59 +0000 Subject: [PATCH] cmake: prefill/cache `HAVE_STRUCT_SOCKADDR_STORAGE` Also add missing include to `OtherTests.cmake`. It didn't cause an issue because the parent already included this earlier by chance. Closes #12537 --- CMake/OtherTests.cmake | 7 ++++--- CMake/Platforms/WindowsCache.cmake | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CMake/OtherTests.cmake b/CMake/OtherTests.cmake index a7599c44d7..ae964f5bf1 100644 --- a/CMake/OtherTests.cmake +++ b/CMake/OtherTests.cmake @@ -23,6 +23,7 @@ ########################################################################### include(CheckCSourceCompiles) include(CheckCSourceRuns) +include(CheckTypeSize) # The begin of the sources (macros and includes) set(_source_epilogue "#undef inline") @@ -74,9 +75,9 @@ if(NOT WIN32) endif() endif() -check_type_size("struct sockaddr_storage" SIZEOF_STRUCT_SOCKADDR_STORAGE) -if(HAVE_SIZEOF_STRUCT_SOCKADDR_STORAGE) - set(HAVE_STRUCT_SOCKADDR_STORAGE 1) +if(NOT DEFINED HAVE_STRUCT_SOCKADDR_STORAGE) + check_type_size("struct sockaddr_storage" SIZEOF_STRUCT_SOCKADDR_STORAGE) + set(HAVE_STRUCT_SOCKADDR_STORAGE ${HAVE_SIZEOF_STRUCT_SOCKADDR_STORAGE}) endif() unset(CMAKE_TRY_COMPILE_TARGET_TYPE) diff --git a/CMake/Platforms/WindowsCache.cmake b/CMake/Platforms/WindowsCache.cmake index ec09fd4bd1..d3391d92f8 100644 --- a/CMake/Platforms/WindowsCache.cmake +++ b/CMake/Platforms/WindowsCache.cmake @@ -171,6 +171,7 @@ set(HAVE_POSIX_STRERROR_R 0) set(HAVE_BUILTIN_AVAILABLE 0) set(HAVE_MSG_NOSIGNAL 0) set(HAVE_STRUCT_TIMEVAL 1) +set(HAVE_STRUCT_SOCKADDR_STORAGE 1) set(HAVE_GETHOSTBYNAME_R_3 0) set(HAVE_GETHOSTBYNAME_R_3_REENTRANT 0)