Revision: 7952 https://osdn.net/projects/ttssh2/scm/svn/commits/7952 Author: zmatsuo Date: 2019-08-14 01:22:11 +0900 (Wed, 14 Aug 2019) Log Message: ----------- ttxsshをdebugビルド時マクロ再定義警告が出ないようにした - r7949 以外に codeconv.cpp でも警告が出ていた - ttxssh を cmake でビルドするときにも _CRTDBG_MAP_ALLOC を define するようにした - ttxssh/CMakeLists.txt を非推奨コマンドをなるべく使わないように修正 Revision Links: -------------- https://osdn.net/projects/ttssh2/scm/svn/commits/7949 Modified Paths: -------------- trunk/libs/lib_zlib.cmake trunk/teraterm/common/codeconv.cpp trunk/ttssh2/ttxssh/CMakeLists.txt -------------- next part -------------- Modified: trunk/libs/lib_zlib.cmake =================================================================== --- trunk/libs/lib_zlib.cmake 2019-08-13 15:29:48 UTC (rev 7951) +++ trunk/libs/lib_zlib.cmake 2019-08-13 16:22:11 UTC (rev 7952) @@ -8,3 +8,13 @@ set(ZLIB_INCLUDE_DIRS ${ZLIB_ROOT}/include) set(ZLIB_LIBRARY_DIRS ${ZLIB_ROOT}/lib) +if(MINGW) + set(ZLIB_LIB + ${ZLIB_LIBRARY_DIRS}/libzlibstatic.a + ) +else() + set(ZLIB_LIB + debug ${ZLIB_LIBRARY_DIRS}/zlibstaticd.lib + optimized ${ZLIB_LIBRARY_DIRS}/zlibstatic.lib + ) +endif() Modified: trunk/teraterm/common/codeconv.cpp =================================================================== --- trunk/teraterm/common/codeconv.cpp 2019-08-13 15:29:48 UTC (rev 7951) +++ trunk/teraterm/common/codeconv.cpp 2019-08-13 16:22:11 UTC (rev 7952) @@ -47,7 +47,7 @@ typedef unsigned int uint32_t; #endif -#ifdef _DEBUG +#if defined(_DEBUG) && !defined(_CRTDBG_MAP_ALLOC) #define malloc(l) _malloc_dbg((l), _NORMAL_BLOCK, __FILE__, __LINE__) #define free(p) _free_dbg((p), _NORMAL_BLOCK) #define _strdup(s) _strdup_dbg((s), _NORMAL_BLOCK, __FILE__, __LINE__) Modified: trunk/ttssh2/ttxssh/CMakeLists.txt =================================================================== --- trunk/ttssh2/ttxssh/CMakeLists.txt 2019-08-13 15:29:48 UTC (rev 7951) +++ trunk/ttssh2/ttxssh/CMakeLists.txt 2019-08-13 16:22:11 UTC (rev 7952) @@ -5,34 +5,17 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/../../libs/lib_zlib.cmake) include(${CMAKE_CURRENT_SOURCE_DIR}/../../libs/lib_openssl.cmake) -if(USE_UNICODE_API) - add_definitions(-DUNICODE -D_UNICODE) +if (MSVC) + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DELAYLOAD:dnsapi.dll") endif() -set(COMMON_SRC - ../../teraterm/teraterm/WSAAsyncGetAddrInfo.c - ../../teraterm/common/ttcommon.h - ../../teraterm/common/i18n.h - ../../teraterm/common/ttlib.h - ../../teraterm/common/ttlib.c - ../../teraterm/common/dlglib.h - ../../teraterm/common/dlglib.c - ../../teraterm/common/dlglib_cpp.cpp - ../../teraterm/common/dlglib_tmpl.cpp - ../../teraterm/common/servicenames.h - ../../teraterm/common/codeconv.cpp - ../../teraterm/common/codeconv.h - ../../teraterm/common/tipwin.cpp - ../../teraterm/common/tipwin.h +add_library( + ttxssh SHARED ) -source_group( - "common" - FILES - ${COMMON_SRC} - ) - -set(SRC +target_sources( + ttxssh + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/puttyversion.h ../matcher/matcher.c arc4random.c @@ -98,8 +81,33 @@ ${COMMON_SRC} ) +target_sources( + ttxssh + PRIVATE + ../../teraterm/teraterm/WSAAsyncGetAddrInfo.c + ../../teraterm/common/ttcommon.h + ../../teraterm/common/i18n.h + ../../teraterm/common/ttlib.h + ../../teraterm/common/ttlib.c + ../../teraterm/common/dlglib.h + ../../teraterm/common/dlglib.c + ../../teraterm/common/dlglib_cpp.cpp + ../../teraterm/common/dlglib_tmpl.cpp + ../../teraterm/common/servicenames.h + ../../teraterm/common/codeconv.cpp + ../../teraterm/common/codeconv.h + ../../teraterm/common/tipwin.cpp + ../../teraterm/common/tipwin.h + ) -include_directories( +source_group( + "common" + REGULAR_EXPRESSION + "teraterm\/common\/") + +target_include_directories( + ttxssh + PRIVATE ../../teraterm/teraterm ../../teraterm/common ../matcher @@ -106,21 +114,8 @@ ../putty ${OPENSSL_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS} - ) +) -link_directories( - ${ZLIB_LIBRARY_DIRS} - ) - -if (MSVC) - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DELAYLOAD:dnsapi.dll") -endif() - -add_library( - ttxssh SHARED - ${SRC} - ) - set_target_properties( ttxssh PROPERTIES @@ -127,12 +122,26 @@ PREFIX "" ) +target_compile_definitions( + ttxssh + PRIVATE + $<$<CONFIG:Debug>:_CRTDBG_MAP_ALLOC> + ) +if(USE_UNICODE_API) + target_compile_definitions( + ttxssh + PRIVATE + UNICODE + _UNICODE + ) +endif() + + target_link_libraries( ttxssh libputty ttpcmn - debug zlibstaticd - optimized zlibstatic + ${ZLIB_LIB} ${OPENSSL_LIB} # ws2_32