geom_gate userland utility improvements
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

102 lines
3.4 KiB

  1. # Copyright (c) 2014, 2015 Alexander Lamaison <alexander.lamaison@gmail.com>
  2. #
  3. # Redistribution and use in source and binary forms,
  4. # with or without modification, are permitted provided
  5. # that the following conditions are met:
  6. #
  7. # Redistributions of source code must retain the above
  8. # copyright notice, this list of conditions and the
  9. # following disclaimer.
  10. #
  11. # Redistributions in binary form must reproduce the above
  12. # copyright notice, this list of conditions and the following
  13. # disclaimer in the documentation and/or other materials
  14. # provided with the distribution.
  15. #
  16. # Neither the name of the copyright holder nor the names
  17. # of any other contributors may be used to endorse or
  18. # promote products derived from this software without
  19. # specific prior written permission.
  20. #
  21. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
  22. # CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
  23. # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  24. # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  25. # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  26. # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  27. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  28. # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  29. # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  30. # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  31. # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  32. # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
  33. # USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  34. # OF SUCH DAMAGE.
  35. include(CheckIncludeFiles)
  36. include(CheckSymbolExists)
  37. include(CopyRuntimeDependencies)
  38. include(SocketLibraries)
  39. set(EXAMPLES
  40. direct_tcpip
  41. ssh2
  42. scp
  43. scp_nonblock
  44. scp_write
  45. scp_write_nonblock
  46. sftp
  47. sftp_nonblock
  48. sftp_write
  49. sftp_write_nonblock
  50. sftp_mkdir
  51. sftp_mkdir_nonblock
  52. sftp_RW_nonblock
  53. sftp_write_sliding
  54. sftpdir
  55. sftpdir_nonblock
  56. ssh2_exec
  57. ssh2_agent
  58. ssh2_agent_forwarding
  59. ssh2_echo
  60. sftp_append
  61. subsystem_netconf
  62. tcpip-forward)
  63. append_needed_socket_libraries(LIBRARIES)
  64. foreach(example ${EXAMPLES})
  65. add_executable(example-${example} ${example}.c)
  66. list(APPEND EXAMPLE_TARGETS example-${example})
  67. # to find generated header
  68. target_include_directories(example-${example} PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
  69. target_link_libraries(example-${example} libssh2 ${LIBRARIES})
  70. endforeach()
  71. add_target_to_copy_dependencies(
  72. TARGET copy_example_dependencies
  73. DEPENDENCIES ${RUNTIME_DEPENDENCIES}
  74. BEFORE_TARGETS ${EXAMPLE_TARGETS})
  75. ## Platform checks
  76. check_include_files(inttypes.h HAVE_INTTYPES_H)
  77. check_include_files(unistd.h HAVE_UNISTD_H)
  78. check_include_files(stdlib.h HAVE_STDLIB_H)
  79. check_include_files(sys/select.h HAVE_SYS_SELECT_H)
  80. check_include_files(sys/socket.h HAVE_SYS_SOCKET_H)
  81. check_include_files(sys/time.h HAVE_SYS_TIME_H)
  82. check_include_files(arpa/inet.h HAVE_ARPA_INET_H)
  83. check_include_files(netinet/in.h HAVE_NETINET_IN_H)
  84. check_include_files(winsock2.h HAVE_WINSOCK2_H)
  85. check_symbol_exists(strcasecmp strings.h HAVE_STRCASECMP)
  86. check_symbol_exists(_stricmp string.h HAVE__STRICMP)
  87. check_symbol_exists(snprintf stdio.h HAVE_SNPRINTF)
  88. check_symbol_exists(_snprintf stdio.h HAVE__SNPRINTF)
  89. check_symbol_exists(__func__ "" HAVE___FUNC__)
  90. check_symbol_exists(__FUNCTION__ "" HAVE___FUNCTION__)
  91. configure_file(
  92. ${CMAKE_CURRENT_SOURCE_DIR}/libssh2_config_cmake.h.in
  93. ${CMAKE_CURRENT_BINARY_DIR}/libssh2_config.h)