1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- #国密加解密库
- 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 "---------------------------------")
|