2010-01-21 21:54:20 +01:00
|
|
|
project(libssh-examples C CXX)
|
2009-07-25 17:03:01 +02:00
|
|
|
|
|
|
|
set(examples_SRCS
|
|
|
|
authentication.c
|
|
|
|
knownhosts.c
|
2009-09-06 12:54:57 +03:00
|
|
|
connect_ssh.c
|
2009-07-25 17:03:01 +02:00
|
|
|
)
|
|
|
|
|
2020-04-15 09:14:23 +02:00
|
|
|
include_directories(${libssh_BINARY_DIR}/include ${libssh_BINARY_DIR})
|
2009-07-25 17:03:01 +02:00
|
|
|
|
2016-05-03 12:12:23 +02:00
|
|
|
if (ARGP_INCLUDE_DIR)
|
|
|
|
include_directories(${ARGP_INCLUDE_DIR})
|
|
|
|
endif()
|
|
|
|
|
2013-07-22 10:50:35 +02:00
|
|
|
if (UNIX AND NOT WIN32)
|
2011-01-23 18:57:35 +01:00
|
|
|
add_executable(libssh_scp libssh_scp.c ${examples_SRCS})
|
2018-08-20 15:17:09 +02:00
|
|
|
target_compile_options(libssh_scp PRIVATE ${DEFAULT_C_COMPILE_FLAGS})
|
2019-11-06 09:03:11 +01:00
|
|
|
target_link_libraries(libssh_scp ssh::ssh)
|
2010-05-17 20:03:44 +02:00
|
|
|
|
2011-01-23 18:57:35 +01:00
|
|
|
add_executable(scp_download scp_download.c ${examples_SRCS})
|
2018-08-20 15:17:09 +02:00
|
|
|
target_compile_options(scp_download PRIVATE ${DEFAULT_C_COMPILE_FLAGS})
|
2019-11-06 09:03:11 +01:00
|
|
|
target_link_libraries(scp_download ssh::ssh)
|
2009-07-25 17:03:01 +02:00
|
|
|
|
2011-01-23 18:57:35 +01:00
|
|
|
add_executable(sshnetcat sshnetcat.c ${examples_SRCS})
|
2018-08-20 15:17:09 +02:00
|
|
|
target_compile_options(sshnetcat PRIVATE ${DEFAULT_C_COMPILE_FLAGS})
|
2019-11-06 09:03:11 +01:00
|
|
|
target_link_libraries(sshnetcat ssh::ssh)
|
2009-10-09 21:44:05 +02:00
|
|
|
|
2011-01-23 18:57:35 +01:00
|
|
|
if (WITH_SFTP)
|
|
|
|
add_executable(samplesftp samplesftp.c ${examples_SRCS})
|
2018-08-20 15:17:09 +02:00
|
|
|
target_compile_options(samplesftp PRIVATE ${DEFAULT_C_COMPILE_FLAGS})
|
2019-11-06 09:03:11 +01:00
|
|
|
target_link_libraries(samplesftp ssh::ssh)
|
2011-01-23 18:57:35 +01:00
|
|
|
endif (WITH_SFTP)
|
2009-10-09 21:44:05 +02:00
|
|
|
|
2017-11-07 15:28:52 +01:00
|
|
|
add_executable(ssh-client ssh_client.c ${examples_SRCS})
|
2018-08-20 15:17:09 +02:00
|
|
|
target_compile_options(ssh-client PRIVATE ${DEFAULT_C_COMPILE_FLAGS})
|
2019-11-06 09:03:11 +01:00
|
|
|
target_link_libraries(ssh-client ssh::ssh)
|
2013-03-04 00:36:16 +01:00
|
|
|
|
2017-11-08 16:28:35 +01:00
|
|
|
if (WITH_SERVER AND (ARGP_LIBRARY OR HAVE_ARGP_H))
|
2014-02-16 17:59:46 +01:00
|
|
|
if (HAVE_LIBUTIL)
|
2021-05-05 22:44:36 -07:00
|
|
|
add_executable(ssh_server_fork ssh_server.c)
|
|
|
|
target_compile_options(ssh_server_fork PRIVATE ${DEFAULT_C_COMPILE_FLAGS} -DWITH_FORK)
|
2019-11-06 09:03:11 +01:00
|
|
|
target_link_libraries(ssh_server_fork ssh::ssh ${ARGP_LIBRARY} util)
|
2021-05-05 22:44:36 -07:00
|
|
|
|
|
|
|
add_executable(ssh_server_pthread ssh_server.c)
|
|
|
|
target_compile_options(ssh_server_pthread PRIVATE ${DEFAULT_C_COMPILE_FLAGS})
|
|
|
|
target_link_libraries(ssh_server_pthread ssh::ssh ${ARGP_LIBRARY} pthread util)
|
2014-02-16 17:59:46 +01:00
|
|
|
endif (HAVE_LIBUTIL)
|
|
|
|
|
2013-07-24 20:02:49 +02:00
|
|
|
if (WITH_GSSAPI AND GSSAPI_FOUND)
|
2013-07-22 10:50:35 +02:00
|
|
|
add_executable(proxy proxy.c)
|
2018-08-20 15:17:09 +02:00
|
|
|
target_compile_options(proxy PRIVATE ${DEFAULT_C_COMPILE_FLAGS})
|
2019-11-06 09:03:11 +01:00
|
|
|
target_link_libraries(proxy ssh::ssh ${ARGP_LIBRARY})
|
2019-02-05 02:03:44 +01:00
|
|
|
|
|
|
|
add_executable(sshd_direct-tcpip sshd_direct-tcpip.c)
|
|
|
|
target_compile_options(sshd_direct-tcpip PRIVATE ${DEFAULT_C_COMPILE_FLAGS})
|
2019-11-06 09:03:11 +01:00
|
|
|
target_link_libraries(sshd_direct-tcpip ssh::ssh ${ARGP_LIBRARY})
|
2013-07-24 20:02:49 +02:00
|
|
|
endif (WITH_GSSAPI AND GSSAPI_FOUND)
|
2013-03-05 10:10:55 +01:00
|
|
|
|
2013-07-22 10:50:35 +02:00
|
|
|
add_executable(samplesshd-kbdint samplesshd-kbdint.c)
|
2018-08-20 15:17:09 +02:00
|
|
|
target_compile_options(samplesshd-kbdint PRIVATE ${DEFAULT_C_COMPILE_FLAGS})
|
2019-11-06 09:03:11 +01:00
|
|
|
target_link_libraries(samplesshd-kbdint ssh::ssh ${ARGP_LIBRARY})
|
2013-02-11 21:44:25 +01:00
|
|
|
|
2019-11-07 13:43:04 +01:00
|
|
|
add_executable(keygen2 keygen2.c ${examples_SRCS})
|
|
|
|
target_compile_options(keygen2 PRIVATE ${DEFAULT_C_COMPILE_FLAGS})
|
2019-11-06 09:03:11 +01:00
|
|
|
target_link_libraries(keygen2 ssh::ssh)
|
2019-11-07 13:43:04 +01:00
|
|
|
|
2017-11-08 16:28:35 +01:00
|
|
|
endif()
|
2013-07-22 10:50:35 +02:00
|
|
|
endif (UNIX AND NOT WIN32)
|
2009-10-09 21:44:05 +02:00
|
|
|
|
2021-05-01 12:17:53 -07:00
|
|
|
if (WITH_SERVER)
|
|
|
|
add_executable(samplesshd-cb samplesshd-cb.c)
|
|
|
|
target_compile_options(samplesshd-cb PRIVATE ${DEFAULT_C_COMPILE_FLAGS})
|
2021-06-07 11:27:46 +02:00
|
|
|
target_link_libraries(samplesshd-cb ssh::ssh)
|
|
|
|
if (ARGP_LIBRARY OR HAVE_ARGP_H)
|
|
|
|
target_link_libraries(samplesshd-cb ${ARGP_LIBRARY})
|
|
|
|
endif(ARGP_LIBRARY OR HAVE_ARGP_H)
|
2021-05-01 12:17:53 -07:00
|
|
|
endif()
|
|
|
|
|
2011-01-23 21:49:13 +01:00
|
|
|
add_executable(exec exec.c ${examples_SRCS})
|
2018-08-20 15:17:09 +02:00
|
|
|
target_compile_options(exec PRIVATE ${DEFAULT_C_COMPILE_FLAGS})
|
2019-11-06 09:03:11 +01:00
|
|
|
target_link_libraries(exec ssh::ssh)
|
2011-01-23 21:49:13 +01:00
|
|
|
|
|
|
|
add_executable(senddata senddata.c ${examples_SRCS})
|
2018-08-20 15:17:09 +02:00
|
|
|
target_compile_options(senddata PRIVATE ${DEFAULT_C_COMPILE_FLAGS})
|
2019-11-06 09:03:11 +01:00
|
|
|
target_link_libraries(senddata ssh::ssh)
|
2011-01-23 21:49:13 +01:00
|
|
|
|
2019-02-04 22:40:37 +01:00
|
|
|
add_executable(keygen keygen.c)
|
|
|
|
target_compile_options(keygen PRIVATE ${DEFAULT_C_COMPILE_FLAGS})
|
2019-11-06 09:03:11 +01:00
|
|
|
target_link_libraries(keygen ssh::ssh)
|
2019-02-04 22:40:37 +01:00
|
|
|
|
2011-01-23 18:57:35 +01:00
|
|
|
add_executable(libsshpp libsshpp.cpp)
|
2019-11-06 09:03:11 +01:00
|
|
|
target_link_libraries(libsshpp ssh::ssh)
|
2011-01-23 18:57:35 +01:00
|
|
|
|
|
|
|
add_executable(libsshpp_noexcept libsshpp_noexcept.cpp)
|
2019-11-06 09:03:11 +01:00
|
|
|
target_link_libraries(libsshpp_noexcept ssh::ssh)
|