1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00

Move some add_executable() calls to top-level CMakeLists.

Now that the main source file of Plink in each platform directory has
the same name, we can put centralise the main definition of the
program in the main CMakeLists.txt, and in the platform directory,
just add the few extra modules needed to clear up platform-specific
details.

The same goes for psocks. And PSCP and PSFTP could have been moved to
the top level already - I just hadn't done it in the initial setup.
This commit is contained in:
Simon Tatham 2021-04-23 06:46:02 +01:00
parent f39c51f9a7
commit 77940f8fa3
6 changed files with 53 additions and 83 deletions

View File

@ -75,7 +75,42 @@ add_executable(test_wildcard
target_compile_definitions(test_wildcard PRIVATE TEST)
target_link_libraries(test_wildcard utils ${platform_libraries})
foreach(subdir ${PLATFORM_SUBDIRS})
add_executable(plink
${platform}/plink.c
be_all_s.c)
target_link_libraries(plink
eventloop noterminal console sshclient otherbackends settings network crypto
utils
${platform_libraries})
installed_program(plink)
add_executable(pscp
pscp.c
be_ssh.c)
target_link_libraries(pscp
sftpclient eventloop console sshclient settings network crypto utils
${platform_libraries})
installed_program(pscp)
add_executable(psftp
psftp.c
be_ssh.c)
target_link_libraries(psftp
sftpclient eventloop console sshclient settings network crypto utils
${platform_libraries})
installed_program(psftp)
add_executable(psocks
${platform}/psocks.c
psocks.c
norand.c
nocproxy.c
ssh/portfwd.c)
target_link_libraries(psocks
eventloop console network utils
${platform_libraries})
foreach(subdir ${platform} ${extra_dirs})
add_subdirectory(${subdir})
endforeach()

View File

@ -1,5 +1,3 @@
set(PLATFORM_SUBDIRS charset unix)
set(PUTTY_GSSAPI DYNAMIC
CACHE STRING "Build PuTTY with dynamically or statically linked \
Kerberos / GSSAPI support, if possible")
@ -80,6 +78,8 @@ add_optional_system_lib(m pow)
add_optional_system_lib(rt clock_gettime)
add_optional_system_lib(xnet socket)
set(extra_dirs charset)
if(PUTTY_GSSAPI STREQUAL DYNAMIC)
add_optional_system_lib(dl dlopen)
if(HAVE_NO_LIBdl)

View File

@ -1,5 +1,3 @@
set(PLATFORM_SUBDIRS windows)
set(PUTTY_MINEFIELD OFF
CACHE BOOL "Build PuTTY with its built-in memory debugger 'Minefield'")
set(PUTTY_GSSAPI ON

View File

@ -61,16 +61,20 @@ function(add_sources_from_current_dir target)
target_sources(${target} PRIVATE ${sources})
endfunction()
set(extra_dirs)
if(CMAKE_SYSTEM_NAME MATCHES "Windows" OR WINELIB)
include(cmake/platforms/windows.cmake)
set(platform windows)
else()
include(cmake/platforms/unix.cmake)
set(platform unix)
endif()
include(cmake/platforms/${platform}.cmake)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${GENERATED_SOURCES_DIR}
${PLATFORM_SUBDIRS})
${platform}
${extra_dirs})
if(PUTTY_DEBUG)
add_compile_definitions(DEBUG)

View File

@ -61,40 +61,10 @@ target_link_libraries(fuzzterm
add_executable(osxlaunch
osxlaunch.c)
add_executable(plink
plink.c
${CMAKE_SOURCE_DIR}/be_all_s.c
no-gtk.c)
target_link_libraries(plink
eventloop noterminal console sshclient otherbackends settings network crypto
utils)
installed_program(plink)
add_executable(pscp
${CMAKE_SOURCE_DIR}/pscp.c
${CMAKE_SOURCE_DIR}/be_ssh.c
no-gtk.c)
target_link_libraries(pscp
sftpclient eventloop console sshclient settings network crypto utils)
installed_program(pscp)
add_executable(psftp
${CMAKE_SOURCE_DIR}/psftp.c
${CMAKE_SOURCE_DIR}/be_ssh.c
no-gtk.c)
target_link_libraries(psftp
sftpclient eventloop console sshclient settings network crypto utils)
installed_program(psftp)
add_executable(psocks
psocks.c
${CMAKE_SOURCE_DIR}/psocks.c
${CMAKE_SOURCE_DIR}/norand.c
${CMAKE_SOURCE_DIR}/nocproxy.c
${CMAKE_SOURCE_DIR}/ssh/portfwd.c
no-gtk.c)
target_link_libraries(psocks
eventloop console network utils)
add_sources_from_current_dir(plink no-gtk.c)
add_sources_from_current_dir(pscp no-gtk.c)
add_sources_from_current_dir(psftp no-gtk.c)
add_sources_from_current_dir(psocks no-gtk.c)
add_executable(psusan
psusan.c

View File

@ -68,53 +68,16 @@ set_target_properties(pageant PROPERTIES
LINK_FLAGS "${LFLAG_MANIFEST_NO}")
installed_program(pageant)
add_executable(plink
plink.c
${CMAKE_SOURCE_DIR}/be_all_s.c
no-jump-list.c
nohelp.c
plink.rc)
add_sources_from_current_dir(plink no-jump-list.c nohelp.c plink.rc)
add_dependencies(plink generated_licence_h)
target_link_libraries(plink
eventloop console noterminal sshclient otherbackends settings network crypto
utils
${platform_libraries})
installed_program(plink)
add_executable(pscp
${CMAKE_SOURCE_DIR}/pscp.c
${CMAKE_SOURCE_DIR}/be_ssh.c
no-jump-list.c
nohelp.c
pscp.rc)
add_sources_from_current_dir(pscp no-jump-list.c nohelp.c pscp.rc)
add_dependencies(pscp generated_licence_h)
target_link_libraries(pscp
sftpclient eventloop console sshclient settings network crypto utils
${platform_libraries})
installed_program(pscp)
add_executable(psftp
${CMAKE_SOURCE_DIR}/psftp.c
${CMAKE_SOURCE_DIR}/be_ssh.c
no-jump-list.c
nohelp.c
psftp.rc)
add_sources_from_current_dir(psftp no-jump-list.c nohelp.c psftp.rc)
add_dependencies(psftp generated_licence_h)
target_link_libraries(psftp
sftpclient eventloop console sshclient settings network crypto utils
${platform_libraries})
installed_program(psftp)
add_executable(psocks
psocks.c
nohelp.c
${CMAKE_SOURCE_DIR}/psocks.c
${CMAKE_SOURCE_DIR}/norand.c
${CMAKE_SOURCE_DIR}/nocproxy.c
${CMAKE_SOURCE_DIR}/ssh/portfwd.c)
target_link_libraries(psocks
eventloop console network utils
${platform_libraries})
add_sources_from_current_dir(psocks nohelp.c)
add_executable(putty
window.c