gpt4 book ai didi

c++ - 如何让 CMake 下载外部包并使用它?

转载 作者:搜寻专家 更新时间:2023-10-31 02:13:16 40 4
gpt4 key购买 nike

<分区>

CMakeLists.txt:

cmake_minimum_required(VERSION 3.3)
project(CMakeTest)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
find_package(event-cmake REQUIRED)

file(GLOB SOURCES "*.cpp" )

add_executable(test ${SOURCES})

cmake/Findevent-cmake.cmake:

ExternalProject_Add(event-cmake
GIT_REPOSITORY https://github.com/libevent/libevent.git
UPDATE_COMMAND ""
INSTALL_COMMAND ""
)

我知道这里的 CMakeLists 没有机会包含已解析的包,但我什至无法让 CMake 下载外部仓库。它出错了:

CMake Error at cmake/Findevent-cmake.cmake:3 (ExternalProject_Add):
Unknown CMake command "ExternalProject_Add".
Call Stack (most recent call first):
CMakeLists.txt:4 (find_package)

有没有办法让 cmake 下载项目并链接到它?

40 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com