From 5565d0ab079b274f4e12d528400308d54df1ffa6 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Fri, 31 Oct 2014 12:32:41 +0100 Subject: cmake: fix struct sockaddr_storage check CHECK_TYPE_SIZE_PREINCLUDE is an internal, undocumented variable which was removed in cmake 2.8.1. According to the MSDN docs[1], inclusion of winsock2.h is sufficient. WIN32_LEAN_AND_MEAN does not really seem to affect the tests, so remove it too[2]. For the non-windows case, remove inet headers as POSIX only requires sys/socket.h. [1]: http://msdn.microsoft.com/en-us/library/windows/desktop/ms740504%28v=vs.85%29.aspx [2]: http://stackoverflow.com/questions/11040133/what-does-defining-win32-lean-and-mean-exclude-exactly Signed-off-by: Peter Wu --- CMake/OtherTests.cmake | 28 +++++----------------------- 1 file changed, 5 insertions(+), 23 deletions(-) diff --git a/CMake/OtherTests.cmake b/CMake/OtherTests.cmake index 6dec37fd4..4f07f2251 100644 --- a/CMake/OtherTests.cmake +++ b/CMake/OtherTests.cmake @@ -213,32 +213,14 @@ if(HAVE_SIZEOF_SIG_ATOMIC_T) endif(NOT HAVE_SIG_ATOMIC_T_NOT_VOLATILE) endif(HAVE_SIZEOF_SIG_ATOMIC_T) -set(CHECK_TYPE_SIZE_PREINCLUDE - "#undef inline") - if(HAVE_WINDOWS_H) - set(CHECK_TYPE_SIZE_PREINCLUDE "${CHECK_TYPE_SIZE_PREINCLUDE} - #ifndef WIN32_LEAN_AND_MEAN - #define WIN32_LEAN_AND_MEAN - #endif - #include ") - if(HAVE_WINSOCK2_H) - set(CHECK_TYPE_SIZE_PREINCLUDE "${CHECK_TYPE_SIZE_PREINCLUDE}\n#include ") - endif(HAVE_WINSOCK2_H) -else(HAVE_WINDOWS_H) + set(CMAKE_EXTRA_INCLUDE_FILES winsock2.h) +else() + set(CMAKE_EXTRA_INCLUDE_FILES) if(HAVE_SYS_SOCKET_H) - set(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES} - "sys/socket.h") + set(CMAKE_EXTRA_INCLUDE_FILES sys/socket.h) endif(HAVE_SYS_SOCKET_H) - if(HAVE_NETINET_IN_H) - set(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES} - "netinet/in.h") - endif(HAVE_NETINET_IN_H) - if(HAVE_ARPA_INET_H) - set(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES} - "arpa/inet.h") - endif(HAVE_ARPA_INET_H) -endif(HAVE_WINDOWS_H) +endif() check_type_size("struct sockaddr_storage" SIZEOF_STRUCT_SOCKADDR_STORAGE) if(HAVE_SIZEOF_STRUCT_SOCKADDR_STORAGE) -- cgit v1.2.3