File: vtkTestSocketFeatures.cmake

package info (click to toggle)
vtk9 9.1.0%2Breally9.1.0%2Bdfsg2-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 153,832 kB
  • sloc: cpp: 1,800,419; ansic: 261,033; python: 86,332; yacc: 4,033; java: 3,977; xml: 3,068; sh: 2,702; perl: 2,189; lex: 1,761; objc: 143; makefile: 139; tcl: 59
file content (33 lines) | stat: -rw-r--r-- 1,540 bytes parent folder | download | duplicates (3)
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
# See if we need to link the socket library
include(CheckLibraryExists)
include(CheckSymbolExists)

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)