小编Ale*_*haw的帖子

禁用 FetchContent 安装

假设我有以下代码:

include(FetchContent)
FetchContent_Declare(cmark
  GIT_REPOSITORY https://github.com/commonmark/cmark.git
  GIT_TAG        0.29.0
)
FetchContent_MakeAvailable(cmark)

target_link_libraries(hello_world cmark::cmark_static)
install(TARGETS hello_world DESTINATION bin)
Run Code Online (Sandbox Code Playgroud)

这工作正常,但每当我运行时make install,它也会安装所有 cmark 文件(如include/cmark_version.hlib/pkgconfig/libcmark.pc等)。

有没有办法禁止使用 FetchContent 从包中安装文件?

cmake

11
推荐指数
1
解决办法
5487
查看次数

标签 统计

cmake ×1