Check the socket data types more properly.
This commit was SVN r21585.
Этот коммит содержится в:
родитель
22666721a5
Коммит
0ee21848b5
@ -9,8 +9,10 @@
|
||||
#
|
||||
|
||||
#
|
||||
# Try to compile and run a test program.
|
||||
# If the type is defined, then return the size of the type.
|
||||
# Some data types are defined in SDK headers, but the SDK include path
|
||||
# is only reachable from Visual Studio ENV. So try to compile and run a test
|
||||
# program to check if the data types is defined in SDK headers.
|
||||
# If the type is defined, also return the size of the type.
|
||||
#
|
||||
# TYPE: the type to check
|
||||
# TYPE_NAME: the uppercase of the type, with underlines if necessary.
|
||||
@ -23,8 +25,15 @@ MACRO(CHECK_C_TYPE_EXISTS TYPE TYPE_NAME INCLUDE_HEADERS)
|
||||
|
||||
MESSAGE( STATUS "Checking for ${TYPE}...")
|
||||
|
||||
SET(INCLUDE "")
|
||||
FOREACH(HEADER ${INCLUDE_HEADERS})
|
||||
SET(INCLUDE ${INCLUDE} "#include <${HEADER}>\n")
|
||||
ENDFOREACH(HEADER ${INCLUDE_HEADERS})
|
||||
|
||||
STRING(REPLACE ";" "" INCLUDE ${INCLUDE})
|
||||
|
||||
FILE(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/check_${TYPE_NAME}.c"
|
||||
"${INCLUDE_HEADERS}
|
||||
"${INCLUDE}
|
||||
int main(){ ${TYPE} test; return sizeof(${TYPE});}")
|
||||
|
||||
TRY_RUN(SIZEOF_${TYPE_NAME} COMPILE_RESULT "${CMAKE_BINARY_DIR}"
|
||||
|
@ -120,13 +120,17 @@ MACRO(OMPI_MICROSOFT_COMPILER)
|
||||
ENDFOREACH(${FUNCTION})
|
||||
|
||||
INCLUDE(check_c_type_exists)
|
||||
CHECK_C_TYPE_EXISTS(socklen_t SOCKLEN_T
|
||||
"#include <winsock2.h>\n"
|
||||
"#include <ws2tcpip.h>\n")
|
||||
CHECK_C_TYPE_EXISTS(socklen_t SOCKLEN_T
|
||||
"winsock2.h;ws2tcpip.h")
|
||||
|
||||
CHECK_C_TYPE_EXISTS("struct sockaddr_in" STRUCT_SOCKADDR_IN
|
||||
"#include <winsock2.h>\n"
|
||||
"#include <ws2tcpip.h>\n")
|
||||
CHECK_C_TYPE_EXISTS("struct sockaddr_in" STRUCT_SOCKADDR_IN
|
||||
"winsock2.h")
|
||||
|
||||
CHECK_C_TYPE_EXISTS("struct sockaddr_in6" STRUCT_SOCKADDR_IN6
|
||||
"ws2tcpip.h")
|
||||
|
||||
CHECK_C_TYPE_EXISTS("struct sockaddr_storage" STRUCT_SOCKADDR_STORAGE
|
||||
"winsock2.h;ws2tcpip.h")
|
||||
|
||||
ELSE(CL_EXE_OK)
|
||||
MESSAGE(FATAL_ERROR "No working Microsoft compiler found. Please check if Visual Studio VC is correctly installed.")
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user