1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- #国密加解密库
- message(STATUS "***** Find OpenSSL-1.1.1 Library *****")
- #寻找头文件
- find_path(OpenSSL-1.1.1_INCLUDE_DIR
- NAMES openssl/ssl.h
- PATHS ${CMAKE_CURRENT_LIST_DIR}/include
- NO_DEFAULT_PATH
- )
- #查找库文件,需要判断操作系统,位数
- if(CMAKE_SYSTEM_NAME MATCHES "Windows")
- # 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")
- if(CMAKE_BUILD_TYPE MATCHES "Debug")
- list(APPEND OpenSSL-1.1.1_LIBRARY ${CMAKE_CURRENT_LIST_DIR}/lib/linux/libssl.so)
- list(APPEND OpenSSL-1.1.1_LIBRARY ${CMAKE_CURRENT_LIST_DIR}/lib/linux/libcrypto.so)
- else()
- list(APPEND OpenSSL-1.1.1_LIBRARY ${CMAKE_CURRENT_LIST_DIR}/lib/linux/libssl.so)
- list(APPEND OpenSSL-1.1.1_LIBRARY ${CMAKE_CURRENT_LIST_DIR}/lib/linux/libcrypto.so)
- endif()
- endif()
- #设置查找到后的变量
- if(OpenSSL-1.1.1_INCLUDE_DIR AND OpenSSL-1.1.1_LIBRARY)
- set(OpenSSL-1.1.1_FOUND TRUE)
- set(OpenSSL-1.1.1_VERSION "1.1.1w")
- else()
- set(OpenSSL-1.1.1_FOUND FALSE)
- endif()
- message(STATUS "include : OpenSSL-1.1.1_INCLUDE_DIR")
- message(STATUS "Library : OpenSSL-1.1.1_LIB_LIBRARY")
- message(STATUS "---------------------------------")
|