CMakeLists.txt 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
  2. add_sources_from_current_dir(utils
  3. utils/arm_arch_queries.c
  4. utils/block_signal.c
  5. utils/cloexec.c
  6. utils/cmdline_arg.c
  7. utils/dputs.c
  8. utils/filename.c
  9. utils/fontspec.c
  10. utils/getticks.c
  11. utils/get_username.c
  12. utils/keysym_to_unicode.c
  13. utils/make_dir_and_check_ours.c
  14. utils/make_dir_path.c
  15. utils/make_spr_sw_abort_errno.c
  16. utils/nonblock.c
  17. utils/open_for_write_would_lose_data.c
  18. utils/pgp_fingerprints.c
  19. utils/pollwrap.c
  20. utils/signal.c
  21. utils/x11_ignore_error.c
  22. # We want the ISO C implementation of ltime(), because we don't have
  23. # a local better alternative
  24. ../utils/ltime.c)
  25. # Compiled icon pixmap files
  26. add_library(puttyxpms STATIC
  27. putty-xpm.c
  28. putty-config-xpm.c)
  29. add_library(ptermxpms STATIC
  30. pterm-xpm.c
  31. pterm-config-xpm.c)
  32. add_sources_from_current_dir(eventloop
  33. cliloop.c uxsel.c)
  34. add_sources_from_current_dir(console
  35. console.c)
  36. add_sources_from_current_dir(settings
  37. storage.c)
  38. add_sources_from_current_dir(network
  39. network.c fd-socket.c agent-socket.c peerinfo.c local-proxy.c x11.c)
  40. add_sources_from_current_dir(sshcommon
  41. noise.c)
  42. add_sources_from_current_dir(sshclient
  43. gss.c agent-client.c sharing.c)
  44. add_sources_from_current_dir(sshserver
  45. sftpserver.c procnet.c)
  46. add_sources_from_current_dir(sftpclient
  47. sftp.c)
  48. add_sources_from_current_dir(otherbackends
  49. serial.c)
  50. add_sources_from_current_dir(agent
  51. agent-client.c)
  52. add_executable(fuzzterm
  53. ${CMAKE_SOURCE_DIR}/test/fuzzterm.c
  54. ${CMAKE_SOURCE_DIR}/stubs/no-print.c
  55. unicode.c
  56. no-gtk.c
  57. $<TARGET_OBJECTS:logging>)
  58. be_list(fuzzterm FuZZterm)
  59. add_dependencies(fuzzterm generated_licence_h)
  60. target_link_libraries(fuzzterm
  61. guiterminal eventloop charset settings utils)
  62. add_executable(osxlaunch
  63. osxlaunch.c)
  64. add_sources_from_current_dir(plink unicode.c no-gtk.c)
  65. add_sources_from_current_dir(pscp unicode.c no-gtk.c)
  66. add_sources_from_current_dir(psftp unicode.c no-gtk.c)
  67. add_sources_from_current_dir(psocks no-gtk.c)
  68. add_executable(psusan
  69. psusan.c
  70. ${CMAKE_SOURCE_DIR}/stubs/no-gss.c
  71. ${CMAKE_SOURCE_DIR}/ssh/scpserver.c
  72. unicode.c
  73. no-gtk.c
  74. pty.c)
  75. be_list(psusan psusan)
  76. target_link_libraries(psusan
  77. eventloop sshserver keygen settings network crypto utils)
  78. installed_program(psusan)
  79. add_library(puttygen-common OBJECT
  80. ${CMAKE_SOURCE_DIR}/stubs/no-timing.c
  81. keygen-noise.c
  82. no-gtk.c
  83. noise.c
  84. storage.c
  85. ${CMAKE_SOURCE_DIR}/sshpubk.c
  86. ${CMAKE_SOURCE_DIR}/sshrand.c)
  87. add_executable(puttygen
  88. ${CMAKE_SOURCE_DIR}/cmdgen.c
  89. $<TARGET_OBJECTS:puttygen-common>)
  90. target_link_libraries(puttygen keygen console crypto utils)
  91. installed_program(puttygen)
  92. add_executable(cgtest
  93. ${CMAKE_SOURCE_DIR}/cgtest.c
  94. $<TARGET_OBJECTS:puttygen-common>)
  95. target_link_libraries(cgtest keygen console crypto utils)
  96. if(HAVE_ALIGNED_ALLOC)
  97. add_library(overaligned_alloc OBJECT
  98. ${CMAKE_SOURCE_DIR}/utils/memory.c)
  99. target_compile_definitions(overaligned_alloc PRIVATE ALLOCATION_ALIGNMENT=128)
  100. add_executable(testsc
  101. ${CMAKE_SOURCE_DIR}/test/testsc.c
  102. $<TARGET_OBJECTS:overaligned_alloc>)
  103. target_link_libraries(testsc keygen crypto utils)
  104. endif()
  105. add_executable(testzlib
  106. ${CMAKE_SOURCE_DIR}/test/testzlib.c
  107. ${CMAKE_SOURCE_DIR}/ssh/zlib.c)
  108. target_link_libraries(testzlib utils)
  109. add_executable(uppity
  110. uppity.c
  111. ${CMAKE_SOURCE_DIR}/ssh/scpserver.c
  112. no-gtk.c
  113. pty.c
  114. unicode.c
  115. ${CMAKE_SOURCE_DIR}/stubs/no-gss.c)
  116. be_list(uppity Uppity)
  117. target_link_libraries(uppity
  118. eventloop sshserver keygen settings network crypto utils)
  119. if(GTK_FOUND)
  120. add_sources_from_current_dir(utils
  121. utils/align_label_left.c
  122. utils/buildinfo_gtk_version.c
  123. utils/get_label_text_dimensions.c
  124. utils/get_x11_display.c
  125. utils/our_dialog.c
  126. utils/string_width.c
  127. columns.c)
  128. add_sources_from_current_dir(guiterminal
  129. window.c unifont.c dialog.c config-gtk.c gtk-common.c config-unix.c unicode.c printing.c)
  130. add_dependencies(guiterminal generated_licence_h) # dialog.c uses licence.h
  131. add_executable(pterm
  132. pterm.c
  133. main-gtk-simple.c
  134. ${CMAKE_SOURCE_DIR}/stubs/no-gss.c
  135. ${CMAKE_SOURCE_DIR}/stubs/no-ca-config.c
  136. ${CMAKE_SOURCE_DIR}/stubs/no-console.c
  137. ${CMAKE_SOURCE_DIR}/proxy/nosshproxy.c
  138. pty.c)
  139. be_list(pterm pterm)
  140. target_link_libraries(pterm
  141. guiterminal eventloop settings utils ptermxpms
  142. ${GTK_LIBRARIES} ${X11_LIBRARIES})
  143. installed_program(pterm)
  144. if(GTK_VERSION GREATER_EQUAL 3)
  145. add_executable(ptermapp
  146. pterm.c
  147. main-gtk-application.c
  148. ${CMAKE_SOURCE_DIR}/stubs/no-cmdline.c
  149. ${CMAKE_SOURCE_DIR}/stubs/no-gss.c
  150. ${CMAKE_SOURCE_DIR}/stubs/no-ca-config.c
  151. ${CMAKE_SOURCE_DIR}/stubs/no-console.c
  152. ${CMAKE_SOURCE_DIR}/proxy/nosshproxy.c
  153. pty.c)
  154. be_list(ptermapp pterm)
  155. target_link_libraries(ptermapp
  156. guiterminal eventloop settings utils ptermxpms
  157. ${GTK_LIBRARIES} ${X11_LIBRARIES})
  158. endif()
  159. add_executable(putty
  160. putty.c
  161. main-gtk-simple.c
  162. ${CMAKE_SOURCE_DIR}/stubs/no-console.c)
  163. be_list(putty PuTTY SSH SERIAL OTHERBACKENDS)
  164. target_link_libraries(putty
  165. guiterminal eventloop sshclient otherbackends settings
  166. network crypto utils puttyxpms
  167. ${GTK_LIBRARIES} ${X11_LIBRARIES})
  168. set_target_properties(putty
  169. PROPERTIES LINK_INTERFACE_MULTIPLICITY 2)
  170. installed_program(putty)
  171. if(GTK_VERSION GREATER_EQUAL 3)
  172. add_executable(puttyapp
  173. putty.c
  174. main-gtk-application.c
  175. ${CMAKE_SOURCE_DIR}/stubs/no-cmdline.c
  176. ${CMAKE_SOURCE_DIR}/stubs/no-console.c)
  177. be_list(puttyapp PuTTY SSH SERIAL OTHERBACKENDS)
  178. target_link_libraries(puttyapp
  179. guiterminal eventloop sshclient otherbackends settings
  180. network crypto utils puttyxpms
  181. ${GTK_LIBRARIES} ${X11_LIBRARIES})
  182. endif()
  183. add_executable(puttytel
  184. putty.c
  185. main-gtk-simple.c
  186. ${CMAKE_SOURCE_DIR}/stubs/no-gss.c
  187. ${CMAKE_SOURCE_DIR}/stubs/no-ca-config.c
  188. ${CMAKE_SOURCE_DIR}/stubs/no-console.c
  189. ${CMAKE_SOURCE_DIR}/stubs/no-rand.c
  190. ${CMAKE_SOURCE_DIR}/proxy/nocproxy.c
  191. ${CMAKE_SOURCE_DIR}/proxy/nosshproxy.c)
  192. be_list(puttytel PuTTYtel SERIAL OTHERBACKENDS)
  193. target_link_libraries(puttytel
  194. guiterminal eventloop otherbackends settings network utils
  195. puttyxpms
  196. ${GTK_LIBRARIES} ${X11_LIBRARIES})
  197. add_executable(test_lineedit
  198. ${CMAKE_SOURCE_DIR}/test/test_lineedit.c
  199. ${CMAKE_SOURCE_DIR}/stubs/no-gss.c
  200. ${CMAKE_SOURCE_DIR}/stubs/no-logging.c
  201. ${CMAKE_SOURCE_DIR}/stubs/no-printing.c
  202. ${CMAKE_SOURCE_DIR}/stubs/no-storage.c
  203. ${CMAKE_SOURCE_DIR}/stubs/no-timing.c)
  204. target_link_libraries(test_lineedit
  205. guiterminal settings eventloop utils ${platform_libraries})
  206. add_executable(test_terminal
  207. ${CMAKE_SOURCE_DIR}/test/test_terminal.c
  208. ${CMAKE_SOURCE_DIR}/stubs/no-gss.c
  209. ${CMAKE_SOURCE_DIR}/stubs/no-storage.c
  210. ${CMAKE_SOURCE_DIR}/stubs/no-timing.c)
  211. target_link_libraries(test_terminal
  212. guiterminal settings eventloop utils ${platform_libraries})
  213. endif()
  214. # Pageant is built whether we have GTK or not; in its absence we
  215. # degrade to a version that doesn't provide the GTK askpass.
  216. if(GTK_FOUND)
  217. set(pageant_conditional_sources askpass.c)
  218. set(pageant_libs ${GTK_LIBRARIES})
  219. else()
  220. set(pageant_conditional_sources noaskpass.c no-gtk.c)
  221. set(pageant_libs)
  222. endif()
  223. add_executable(pageant
  224. pageant.c
  225. ${CMAKE_SOURCE_DIR}/stubs/no-gss.c
  226. x11.c
  227. noise.c
  228. ${CMAKE_SOURCE_DIR}/ssh/x11fwd.c
  229. ${CMAKE_SOURCE_DIR}/proxy/nosshproxy.c
  230. ${pageant_conditional_sources})
  231. be_list(pageant Pageant)
  232. target_link_libraries(pageant
  233. eventloop console agent settings network crypto utils
  234. ${pageant_libs})
  235. installed_program(pageant)
  236. add_sources_from_current_dir(test_conf unicode.c stubs/no-uxsel.c)