| 1 |
set(PACKAGE_NAME "ttxssh") |
| 2 |
|
| 3 |
option(TTXSSH_LIBRESSL "User LibreSSL" on) |
| 4 |
option(TTXSSH_OPENSSL3 "Use OpenSSL3" off) |
| 5 |
|
| 6 |
project(${PACKAGE_NAME}) |
| 7 |
|
| 8 |
include(${CMAKE_CURRENT_SOURCE_DIR}/../../libs/lib_zlib.cmake) |
| 9 |
if(TTXSSH_LIBRESSL) |
| 10 |
include(${CMAKE_CURRENT_SOURCE_DIR}/../../libs/lib_libressl.cmake) |
| 11 |
elseif(TTXSSH_OPENSSL3) |
| 12 |
include(${CMAKE_CURRENT_SOURCE_DIR}/../../libs/lib_openssl3.cmake) |
| 13 |
else() |
| 14 |
include(${CMAKE_CURRENT_SOURCE_DIR}/../../libs/lib_openssl.cmake) |
| 15 |
endif() |
| 16 |
|
| 17 |
add_library( |
| 18 |
${PACKAGE_NAME} SHARED |
| 19 |
) |
| 20 |
|
| 21 |
target_sources( |
| 22 |
${PACKAGE_NAME} |
| 23 |
PRIVATE |
| 24 |
../matcher/matcher.c |
| 25 |
arc4random.c |
| 26 |
arc4random.h |
| 27 |
auth.c |
| 28 |
auth.h |
| 29 |
buffer.c |
| 30 |
buffer.h |
| 31 |
chacha.c |
| 32 |
chacha.h |
| 33 |
cipher-3des1.c |
| 34 |
cipher-chachapoly-libcrypto.c |
| 35 |
cipher-chachapoly.h |
| 36 |
cipher-ctr.c |
| 37 |
cipher.c |
| 38 |
cipher.h |
| 39 |
comp.c |
| 40 |
comp.h |
| 41 |
config.h |
| 42 |
crypt.c |
| 43 |
crypt.h |
| 44 |
dns.c |
| 45 |
dns.h |
| 46 |
ed25519.c |
| 47 |
ed25519_bcrypt_pbkdf.c |
| 48 |
ed25519_blf.h |
| 49 |
ed25519_blocks.c |
| 50 |
ed25519_blowfish.c |
| 51 |
ed25519_crypto_api.h |
| 52 |
ed25519_fe25519.c |
| 53 |
ed25519_fe25519.h |
| 54 |
ed25519_ge25519.c |
| 55 |
ed25519_ge25519.h |
| 56 |
ed25519_hash.c |
| 57 |
ed25519_sc25519.c |
| 58 |
ed25519_sc25519.h |
| 59 |
ed25519_verify.c |
| 60 |
fwd-socks.c |
| 61 |
fwd-socks.h |
| 62 |
fwd.c |
| 63 |
fwd.h |
| 64 |
fwdui.c |
| 65 |
fwdui.h |
| 66 |
hostkey.c |
| 67 |
hostkey.h |
| 68 |
hosts.c |
| 69 |
hosts.h |
| 70 |
kex.c |
| 71 |
kex.h |
| 72 |
key.c |
| 73 |
key.h |
| 74 |
keyfiles.c |
| 75 |
keyfiles.h |
| 76 |
keyfiles-putty.c |
| 77 |
keyfiles-putty.h |
| 78 |
mac.c |
| 79 |
mac.h |
| 80 |
pkt.c |
| 81 |
pkt.h |
| 82 |
poly1305.c |
| 83 |
poly1305.h |
| 84 |
resource.h |
| 85 |
sftp.c |
| 86 |
sftp.h |
| 87 |
ssh.c |
| 88 |
ssh.h |
| 89 |
ssherr.c |
| 90 |
ssherr.h |
| 91 |
ttxssh-version.h |
| 92 |
ttxssh-version.rc |
| 93 |
ttxssh.c |
| 94 |
ttxssh.def |
| 95 |
ttxssh.h |
| 96 |
ttxssh.rc |
| 97 |
util.c |
| 98 |
util.h |
| 99 |
x11util.c |
| 100 |
x11util.h |
| 101 |
${COMMON_SRC} |
| 102 |
) |
| 103 |
|
| 104 |
target_sources( |
| 105 |
${PACKAGE_NAME} |
| 106 |
PRIVATE |
| 107 |
../../teraterm/teraterm/WSAAsyncGetAddrInfo.c |
| 108 |
../../teraterm/common/ttcommon.h |
| 109 |
../../teraterm/common/i18n.h |
| 110 |
../../teraterm/common/ttlib.h |
| 111 |
../../teraterm/common/ttlib.c |
| 112 |
../../teraterm/common/dlglib.h |
| 113 |
../../teraterm/common/servicenames.h |
| 114 |
../../teraterm/common/codeconv.h |
| 115 |
../../teraterm/common/tipwin.h |
| 116 |
../../teraterm/common/compat_win.h |
| 117 |
../../teraterm/common/dllutil.h |
| 118 |
) |
| 119 |
|
| 120 |
source_group( |
| 121 |
"common" |
| 122 |
REGULAR_EXPRESSION |
| 123 |
"teraterm\/common\/") |
| 124 |
|
| 125 |
if(SUPPORT_OLD_WINDOWS) |
| 126 |
if(MSVC) |
| 127 |
if(${CMAKE_VERSION} VERSION_LESS "3.12.0") |
| 128 |
set(CMAKE_C_STANDARD_LIBRARIES "") |
| 129 |
set(CMAKE_CXX_STANDARD_LIBRARIES "") |
| 130 |
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /NODEFAULTLIB") |
| 131 |
else() |
| 132 |
target_link_options( |
| 133 |
${PACKAGE_NAME} |
| 134 |
PRIVATE |
| 135 |
/NODEFAULTLIB |
| 136 |
) |
| 137 |
endif() |
| 138 |
target_sources( |
| 139 |
${PACKAGE_NAME} |
| 140 |
PRIVATE |
| 141 |
../../teraterm/common/compat_w95_vs2005.c |
| 142 |
) |
| 143 |
endif() |
| 144 |
if(MINGW) |
| 145 |
target_sources( |
| 146 |
${PACKAGE_NAME} |
| 147 |
PRIVATE |
| 148 |
../../teraterm/libmingw/tlssup.c |
| 149 |
) |
| 150 |
target_link_libraries( |
| 151 |
${PACKAGE_NAME} |
| 152 |
PRIVATE |
| 153 |
-Wl,--whole-archive |
| 154 |
mingw_msvcrt |
| 155 |
-Wl,--no-whole-archive |
| 156 |
) |
| 157 |
endif() |
| 158 |
endif(SUPPORT_OLD_WINDOWS) |
| 159 |
|
| 160 |
target_include_directories( |
| 161 |
${PACKAGE_NAME} |
| 162 |
PRIVATE |
| 163 |
../../teraterm/teraterm |
| 164 |
../../teraterm/common |
| 165 |
../matcher |
| 166 |
../putty |
| 167 |
${ZLIB_INCLUDE_DIRS} |
| 168 |
) |
| 169 |
|
| 170 |
if(TTXSSH_LIBRESSL) |
| 171 |
target_include_directories( |
| 172 |
${PACKAGE_NAME} |
| 173 |
PRIVATE |
| 174 |
${LIBRESSL_INCLUDE_DIRS} |
| 175 |
) |
| 176 |
elseif(TTXSSH_OPENSSL3) |
| 177 |
target_include_directories( |
| 178 |
${PACKAGE_NAME} |
| 179 |
PRIVATE |
| 180 |
${OPENSSL3_INCLUDE_DIRS} |
| 181 |
) |
| 182 |
else() |
| 183 |
target_include_directories( |
| 184 |
${PACKAGE_NAME} |
| 185 |
PRIVATE |
| 186 |
${OPENSSL_INCLUDE_DIRS} |
| 187 |
) |
| 188 |
endif() |
| 189 |
|
| 190 |
|
| 191 |
set_target_properties( |
| 192 |
${PACKAGE_NAME} |
| 193 |
PROPERTIES |
| 194 |
PREFIX "" |
| 195 |
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/" |
| 196 |
) |
| 197 |
|
| 198 |
target_compile_definitions( |
| 199 |
${PACKAGE_NAME} |
| 200 |
PRIVATE |
| 201 |
$<$<CONFIG:Debug>:_CRTDBG_MAP_ALLOC> |
| 202 |
) |
| 203 |
|
| 204 |
if(MINGW) |
| 205 |
target_link_options( |
| 206 |
ttxssh |
| 207 |
PRIVATE |
| 208 |
-Wl,-Map=ttxssh.map,-cref |
| 209 |
) |
| 210 |
endif() |
| 211 |
|
| 212 |
target_link_libraries( |
| 213 |
${PACKAGE_NAME} |
| 214 |
PRIVATE |
| 215 |
common_static |
| 216 |
libputty |
| 217 |
ttpcmn |
| 218 |
argon2 |
| 219 |
${ZLIB_LIB} |
| 220 |
) |
| 221 |
|
| 222 |
if(TTXSSH_LIBRESSL) |
| 223 |
target_link_libraries( |
| 224 |
${PACKAGE_NAME} |
| 225 |
PRIVATE |
| 226 |
${LIBRESSL_LIB} |
| 227 |
bcrypt.lib |
| 228 |
) |
| 229 |
elseif(TTXSSH_OPENSSL3) |
| 230 |
target_link_libraries( |
| 231 |
${PACKAGE_NAME} |
| 232 |
PRIVATE |
| 233 |
${OPENSSL3_LIB} |
| 234 |
bcrypt.lib |
| 235 |
) |
| 236 |
else() |
| 237 |
target_link_libraries( |
| 238 |
${PACKAGE_NAME} |
| 239 |
PRIVATE |
| 240 |
${OPENSSL_LIB} |
| 241 |
crypt32.lib # TODO このlibを使用しないパッチを適応したら削除すること |
| 242 |
) |
| 243 |
endif() |
| 244 |
|
| 245 |
if(SUPPORT_OLD_WINDOWS) |
| 246 |
target_link_libraries( |
| 247 |
${PACKAGE_NAME} |
| 248 |
PRIVATE |
| 249 |
layer_for_unicode |
| 250 |
) |
| 251 |
endif() |
| 252 |
|
| 253 |
target_link_libraries( |
| 254 |
${PACKAGE_NAME} |
| 255 |
PRIVATE |
| 256 |
ws2_32 |
| 257 |
gdi32 |
| 258 |
comdlg32 |
| 259 |
comctl32 |
| 260 |
) |
| 261 |
|
| 262 |
install( |
| 263 |
TARGETS ttxssh |
| 264 |
RUNTIME |
| 265 |
DESTINATION . |
| 266 |
) |