File: vtkTestSocketFeatures.cmake

package info (click to toggle)
vtk9 9.5.2%2Bdfsg3-4
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 205,916 kB
  • sloc: cpp: 2,336,565; ansic: 327,116; python: 111,200; yacc: 4,104; java: 3,977; sh: 3,032; xml: 2,771; perl: 2,189; lex: 1,787; makefile: 178; javascript: 165; objc: 153; tcl: 59
file content (38 lines) | stat: -rw-r--r-- 1,641 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# See if we need to link the socket library
include(CheckLibraryExists)
include(CheckSymbolExists)

if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
  set(VTK_NO_PLATFORM_SOCKETS ON)
  return ()
endif ()

check_library_exists("socket" getsockname "" VTK_HAVE_LIBSOCKET)

if(NOT DEFINED VTK_HAVE_GETSOCKNAME_WITH_SOCKLEN_T)
  set(VTK_GETSOCKNAME_LIBS)
  message(STATUS "Checking for getsockname with socklen_t")
  try_compile(VTK_HAVE_GETSOCKNAME_WITH_SOCKLEN_T_COMPILED
    ${CMAKE_CURRENT_BINARY_DIR}/CMakeTmp/SocklenT
    ${CMAKE_CURRENT_SOURCE_DIR}/vtkTestSocklenT.cxx
    CMAKE_FLAGS "-DLINK_LIBRARIES:STRING=${VTK_GETSOCKNAME_LIBS}"
    OUTPUT_VARIABLE OUTPUT)
  if(VTK_HAVE_GETSOCKNAME_WITH_SOCKLEN_T_COMPILED)
    set(vtk_getsockname_with_socklen_t_detection "success")
    set(vtk_have_getsockname_with_socklen_t 1)
  else()
    set(vtk_getsockname_with_socklen_t_detection "failed")
    set(vtk_have_getsockname_with_socklen_t 0)
  endif()
  message(STATUS "Checking for getsockname with socklen_t -- ${vtk_have_getsockname_with_socklen_t}")
  set(VTK_HAVE_GETSOCKNAME_WITH_SOCKLEN_T ${vtk_have_getsockname_with_socklen_t}
    CACHE INTERNAL "Support for getsockname with socklen_t")
  file(APPEND "${CMAKE_BINARY_DIR}/CMakeFiles/CMakeOutput.log"
    "Determining if getsockname accepts socklen_t type  "
    "completed with the following output:\n"
    "${OUTPUT}\n")
endif()

# e.g. IBM BlueGene/L doesn't have SO_REUSEADDR, because "setsockopt is not needed for
# BlueGene/L applications" according to the BlueGene/L Application Development handbook
check_symbol_exists(SO_REUSEADDR "sys/types.h;sys/socket.h" VTK_HAVE_SO_REUSEADDR)