假设我有以下代码:
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.h
、lib/pkgconfig/libcmark.pc
等)。
有没有办法禁止使用 FetchContent 从包中安装文件?
cmake ×1