Raspberry Pi Pico CMakeLists.txt 从 GitHub 添加库

问题描述 投票:0回答:1

我将 WolfSSL 添加到 pico 项目中,作为

lib
目录中的库,并构建为静态库。导入 WolfSSL 源代码的最佳方式是什么?这只是从 GitHub 克隆或下载 WolfSSL 版本到目录中的情况吗?例如我见过的一个项目有这样的结构:

CMakeLists.txt
...
lib/wolfssl @ 12e2854/

但我不确定目录名称中的

12e2854
指的是什么。

cmake raspberry-pi-pico
1个回答
0
投票

使用 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 文件夹提供范围。

您可以决定要获取哪个标签,我选择可以在存储库中找到的最新稳定版。

© www.soinside.com 2019 - 2024. All rights reserved.