curl-library
[PATCH 4/4] cmake: fix struct sockaddr_storage check
From: Peter Wu <peter_at_lekensteyn.nl>
Date: Fri, 31 Oct 2014 12:32:41 +0100
Date: Fri, 31 Oct 2014 12:32:41 +0100
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 <peter_at_lekensteyn.nl>
---
CMake/OtherTests.cmake | 28 +++++-----------------------
1 file changed, 5 insertions(+), 23 deletions(-)
diff --git a/CMake/OtherTests.cmake b/CMake/OtherTests.cmake
index 6dec37f..4f07f22 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 <windows.h>")
- if(HAVE_WINSOCK2_H)
- set(CHECK_TYPE_SIZE_PREINCLUDE "${CHECK_TYPE_SIZE_PREINCLUDE}\n#include <winsock2.h>")
- 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)
--
2.1.2
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-10-31