aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2014-10-31 12:32:41 +0100
committerDaniel Stenberg <daniel@haxx.se>2014-11-03 09:10:54 +0100
commit5565d0ab079b274f4e12d528400308d54df1ffa6 (patch)
tree0f3c78866b88f1bc291b084a90363a3518cf3502
parent8cb010144964019b865fa224e166eb37f4e1d169 (diff)
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 <peter@lekensteyn.nl>
-rw-r--r--CMake/OtherTests.cmake28
1 files 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 <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)