FetchContent
zip, tar などを Download して展開する、もしくは git clone などする。
include(FetchContent)
set(CMAKE_POLICY_VERSION_MINIMUM 3.5)
# for
# CMake Error at build/_deps/xxx-src/CMakeLists.txt:1 (cmake_minimum_required):
# Compatibility with CMake < 3.5 has been removed from CMake.
set(CMAKE_POLICY_VERSION_MINIMUM 3.10)
# for
# CMake Deprecation Warning at build/_deps/xxx-src/CMakeLists.txt:1 (cmake_minimum_required):
# Compatibility with CMake < 3.10 will be removed from a future version of CMake.
tip
find_packge して、無かったら fetch_content
する?
Compatibility with CMake < 3.5 has been removed from CMake
cmake 4.0 で cmake<3.5
がエラーになる。
FetchContent する project の表記が古い場合には以下のようにして回避できる。
FetchContent_Declare(
plog URL https://github.com/SergiusTheBest/plog/archive/refs/tags/1.1.10.zip)
set(CMAKE_POLICY_VERSION_MINIMUM 3.5)
FetchContent_MakeAvailable(plog)