From a0cfbe74c4209cb1317dbc02cd1472b81547e0a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Thu, 20 Jul 2023 10:19:40 +0800 Subject: [PATCH] CMake: print message before fetching yyjson --- CMakeLists.txt | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 542040f06..7b9890db7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,16 +37,21 @@ endif() include(CheckIncludeFile) include(FetchContent) -FetchContent_Declare( - yyjson - GIT_REPOSITORY https://github.com/ibireme/yyjson - GIT_TAG 0.7.0 -) -FetchContent_GetProperties(yyjson) -if(NOT yyjson_POPULATED) - FetchContent_Populate(yyjson) - add_subdirectory(${yyjson_SOURCE_DIR} ${yyjson_BINARY_DIR} EXCLUDE_FROM_ALL) -endif() +function(ff_fetch_dep package repo tag) + FetchContent_Declare( + "${package}" + GIT_REPOSITORY "${repo}" + GIT_TAG "${tag}" + ) + FetchContent_GetProperties("${package}") + if(NOT ${package}_POPULATED) + message("-- Fetching dependency ${package}@${tag} from ${repo}") + FetchContent_Populate(${package}) + add_subdirectory(${${package}_SOURCE_DIR} ${${package}_BINARY_DIR} EXCLUDE_FROM_ALL) + endif() +endfunction() + +ff_fetch_dep(yyjson "https://github.com/ibireme/yyjson" "0.7.0") ##################### # Configure options #