我将 WolfSSL 添加到 pico 项目中,作为
lib
目录中的库,并构建为静态库。导入 WolfSSL 源代码的最佳方式是什么?这只是从 GitHub 克隆或下载 WolfSSL 版本到目录中的情况吗?例如我见过的一个项目有这样的结构:
CMakeLists.txt
...
lib/wolfssl @ 12e2854/
但我不确定目录名称中的
12e2854
指的是什么。
使用 FetchContent 获取
WolfSSL
并使其在您的项目中可用。
cmake_minimum_required(VERSION 3.22.0)
project(myProject VERSION 1.0.0)
# Allow us to use FetchContent
include(FetchContent)
# Fetch the repository from GitHub
FetchContent_Declare(WolfSSL
GIT_REPOSITORY https://github.com/wolfSSL/wolfssl
GIT_TAG v5.7.0-stable
)
# Make the repository available to us
FetchContent_MakeAvailable(WolfSSL)
此外,您可能想使用
target_include_directories
为某些 WolfSSL 文件夹提供范围。
您可以决定要获取哪个标签,我选择可以在存储库中找到的最新稳定版。