| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 | 
#国密加解密库message(STATUS "***** Find ssh2 Library *****")#寻找头文件unset(ssh2_INCLUDE_DIR CACHE)unset(INCLUDE_PATH)find_path(INCLUDE_PATH    NAMES libssh2.h    PATHS ${CMAKE_CURRENT_LIST_DIR}/include    NO_DEFAULT_PATH)list(APPEND ssh2_INCLUDE_DIR ${INCLUDE_PATH})#查找库文件,需要判断操作系统,位数if(CMAKE_SYSTEM_NAME MATCHES "Windows")    message(WARNING "Windows is not supported")    # if(CMAKE_SIZEOF_VOID_P EQUAL 8)    #     if(CMAKE_BUILD_TYPE MATCHES "Debug")    #         list(APPEND SM_LIB_LIBRARY ${CMAKE_CURRENT_LIST_DIR}/libs/win/x64/with_debug_info/libSM_DLL.lib)    #         list(APPEND SM_LIB_LIBRARY ${CMAKE_CURRENT_LIST_DIR}/libs/win/x64/ucrtbased.dll)    #         list(APPEND SM_LIB_LIBRARY ${CMAKE_CURRENT_LIST_DIR}/libs/win/x64/vcruntime140d.dll)    #     else()    #         list(APPEND SM_LIB_LIBRARY ${CMAKE_CURRENT_LIST_DIR}/libs/win/x64/libSM_DLL.lib)    #         list(APPEND SM_LIB_LIBRARY ${CMAKE_CURRENT_LIST_DIR}/libs/win/x64/ucrtbase.dll)    #         list(APPEND SM_LIB_LIBRARY ${CMAKE_CURRENT_LIST_DIR}/libs/win/x64/vcruntime140.dll)    #     endif()    # elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)    #     if(CMAKE_BUILD_TYPE MATCHES "Debug")    #         list(APPEND SM_LIB_LIBRARY ${CMAKE_CURRENT_LIST_DIR}/libs/win/x86/with_debug_info/libSM_DLL.lib)    #         list(APPEND SM_LIB_LIBRARY ${CMAKE_CURRENT_LIST_DIR}/libs/win/x86/ucrtbased.dll)    #         list(APPEND SM_LIB_LIBRARY ${CMAKE_CURRENT_LIST_DIR}/libs/win/x86/vcruntime140d.dll)    #     else()    #         list(APPEND SM_LIB_LIBRARY ${CMAKE_CURRENT_LIST_DIR}/libs/win/x86/libSM_DLL.lib)    #         list(APPEND SM_LIB_LIBRARY ${CMAKE_CURRENT_LIST_DIR}/libs/win/x86/ucrtbase.dll)    #         list(APPEND SM_LIB_LIBRARY ${CMAKE_CURRENT_LIST_DIR}/libs/win/x86/vcruntime140.dll)    #     endif()    # endif()#添加Linux版本elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")        list(APPEND ssh2_LIBRARY ${CMAKE_CURRENT_LIST_DIR}/lib/linux/libssh2.so)        list(APPEND ssh2_STATIC_LIBRARY ${CMAKE_CURRENT_LIST_DIR}/lib/linux/libssh2.a)endif()#设置查找到后的变量if(ssh2_INCLUDE_DIR AND ssh2_LIBRARY AND ssh2_STATIC_LIBRARY)     set(ssh2_FOUND TRUE)    set(ssh2_VERSION "1.11.1")else()    set(ssh2_FOUND FALSE)endif()message(STATUS "include : ssh2_INCLUDE_DIR")message(STATUS "Library : ssh2_LIBRARY")message(STATUS "Static Library : ssh2_STATIC_LIBRARY")message(STATUS "ssh2 Found : ${ssh2_FOUND}")message(STATUS "ssh2 Version : ${ssh2_VERSION}")message(STATUS "--------------------------------------------------")
 |