ttxsshをdebugビルド時マクロ再定義警告が出ないようにした
- r7949 以外に codeconv.cpp でも警告が出ていた
- ttxssh を cmake でビルドするときにも _CRTDBG_MAP_ALLOC を define するようにした
- ttxssh/CMakeLists.txt を非推奨コマンドをなるべく使わないように修正
@@ -47,7 +47,7 @@ | ||
47 | 47 | typedef unsigned int uint32_t; |
48 | 48 | #endif |
49 | 49 | |
50 | -#ifdef _DEBUG | |
50 | +#if defined(_DEBUG) && !defined(_CRTDBG_MAP_ALLOC) | |
51 | 51 | #define malloc(l) _malloc_dbg((l), _NORMAL_BLOCK, __FILE__, __LINE__) |
52 | 52 | #define free(p) _free_dbg((p), _NORMAL_BLOCK) |
53 | 53 | #define _strdup(s) _strdup_dbg((s), _NORMAL_BLOCK, __FILE__, __LINE__) |
@@ -5,34 +5,17 @@ | ||
5 | 5 | include(${CMAKE_CURRENT_SOURCE_DIR}/../../libs/lib_zlib.cmake) |
6 | 6 | include(${CMAKE_CURRENT_SOURCE_DIR}/../../libs/lib_openssl.cmake) |
7 | 7 | |
8 | -if(USE_UNICODE_API) | |
9 | - add_definitions(-DUNICODE -D_UNICODE) | |
8 | +if (MSVC) | |
9 | + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DELAYLOAD:dnsapi.dll") | |
10 | 10 | endif() |
11 | 11 | |
12 | -set(COMMON_SRC | |
13 | - ../../teraterm/teraterm/WSAAsyncGetAddrInfo.c | |
14 | - ../../teraterm/common/ttcommon.h | |
15 | - ../../teraterm/common/i18n.h | |
16 | - ../../teraterm/common/ttlib.h | |
17 | - ../../teraterm/common/ttlib.c | |
18 | - ../../teraterm/common/dlglib.h | |
19 | - ../../teraterm/common/dlglib.c | |
20 | - ../../teraterm/common/dlglib_cpp.cpp | |
21 | - ../../teraterm/common/dlglib_tmpl.cpp | |
22 | - ../../teraterm/common/servicenames.h | |
23 | - ../../teraterm/common/codeconv.cpp | |
24 | - ../../teraterm/common/codeconv.h | |
25 | - ../../teraterm/common/tipwin.cpp | |
26 | - ../../teraterm/common/tipwin.h | |
12 | +add_library( | |
13 | + ttxssh SHARED | |
27 | 14 | ) |
28 | 15 | |
29 | -source_group( | |
30 | - "common" | |
31 | - FILES | |
32 | - ${COMMON_SRC} | |
33 | - ) | |
34 | - | |
35 | -set(SRC | |
16 | +target_sources( | |
17 | + ttxssh | |
18 | + PRIVATE | |
36 | 19 | ${CMAKE_CURRENT_BINARY_DIR}/puttyversion.h |
37 | 20 | ../matcher/matcher.c |
38 | 21 | arc4random.c |
@@ -98,8 +81,33 @@ | ||
98 | 81 | ${COMMON_SRC} |
99 | 82 | ) |
100 | 83 | |
84 | +target_sources( | |
85 | + ttxssh | |
86 | + PRIVATE | |
87 | + ../../teraterm/teraterm/WSAAsyncGetAddrInfo.c | |
88 | + ../../teraterm/common/ttcommon.h | |
89 | + ../../teraterm/common/i18n.h | |
90 | + ../../teraterm/common/ttlib.h | |
91 | + ../../teraterm/common/ttlib.c | |
92 | + ../../teraterm/common/dlglib.h | |
93 | + ../../teraterm/common/dlglib.c | |
94 | + ../../teraterm/common/dlglib_cpp.cpp | |
95 | + ../../teraterm/common/dlglib_tmpl.cpp | |
96 | + ../../teraterm/common/servicenames.h | |
97 | + ../../teraterm/common/codeconv.cpp | |
98 | + ../../teraterm/common/codeconv.h | |
99 | + ../../teraterm/common/tipwin.cpp | |
100 | + ../../teraterm/common/tipwin.h | |
101 | + ) | |
101 | 102 | |
102 | -include_directories( | |
103 | +source_group( | |
104 | + "common" | |
105 | + REGULAR_EXPRESSION | |
106 | + "teraterm\/common\/") | |
107 | + | |
108 | +target_include_directories( | |
109 | + ttxssh | |
110 | + PRIVATE | |
103 | 111 | ../../teraterm/teraterm |
104 | 112 | ../../teraterm/common |
105 | 113 | ../matcher |
@@ -106,21 +114,8 @@ | ||
106 | 114 | ../putty |
107 | 115 | ${OPENSSL_INCLUDE_DIRS} |
108 | 116 | ${ZLIB_INCLUDE_DIRS} |
109 | - ) | |
117 | +) | |
110 | 118 | |
111 | -link_directories( | |
112 | - ${ZLIB_LIBRARY_DIRS} | |
113 | - ) | |
114 | - | |
115 | -if (MSVC) | |
116 | - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DELAYLOAD:dnsapi.dll") | |
117 | -endif() | |
118 | - | |
119 | -add_library( | |
120 | - ttxssh SHARED | |
121 | - ${SRC} | |
122 | - ) | |
123 | - | |
124 | 119 | set_target_properties( |
125 | 120 | ttxssh |
126 | 121 | PROPERTIES |
@@ -127,12 +122,26 @@ | ||
127 | 122 | PREFIX "" |
128 | 123 | ) |
129 | 124 | |
125 | +target_compile_definitions( | |
126 | + ttxssh | |
127 | + PRIVATE | |
128 | + $<$<CONFIG:Debug>:_CRTDBG_MAP_ALLOC> | |
129 | + ) | |
130 | +if(USE_UNICODE_API) | |
131 | + target_compile_definitions( | |
132 | + ttxssh | |
133 | + PRIVATE | |
134 | + UNICODE | |
135 | + _UNICODE | |
136 | + ) | |
137 | +endif() | |
138 | + | |
139 | + | |
130 | 140 | target_link_libraries( |
131 | 141 | ttxssh |
132 | 142 | libputty |
133 | 143 | ttpcmn |
134 | - debug zlibstaticd | |
135 | - optimized zlibstatic | |
144 | + ${ZLIB_LIB} | |
136 | 145 | ${OPENSSL_LIB} |
137 | 146 | # |
138 | 147 | ws2_32 |