From 9a6a35511e877f36bb3a1e16c6e40ad731a53a3e Mon Sep 17 00:00:00 2001 From: petialetia Date: Tue, 5 Dec 2023 20:03:21 +0300 Subject: [PATCH 1/2] fmt installation is added in case package is not found --- CMakeLists.txt | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6f35378..cd18717 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,8 @@ cmake_minimum_required(VERSION 3.23) project(etude) +include(FetchContent) + # -------------------------------------------------------------------- set(CMAKE_CXX_STANDARD 20) @@ -13,7 +15,18 @@ add_compile_options(-Wall -Wextra -g -Og -fsanitize=undefined) # -------------------------------------------------------------------- -find_package(fmt REQUIRED) +find_package(fmt) + +if (NOT fmt_FOUND) + + FetchContent_Declare(fmt + GIT_REPOSITORY https://github.com/fmtlib/fmt.git + GIT_TAG master + ) + + FetchContent_MakeAvailable(fmt) + +endif (NOT fmt_FOUND) # find_package(Catch2 2 REQUIRED) From ea0eb54d0da02910f34670ac79a4462d367be77b Mon Sep 17 00:00:00 2001 From: petialetia Date: Tue, 5 Dec 2023 20:10:03 +0300 Subject: [PATCH 2/2] Warning is supressed --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cd18717..03e60d8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,7 @@ add_compile_options(-Wall -Wextra -g -Og -fsanitize=undefined) # -------------------------------------------------------------------- -find_package(fmt) +find_package(fmt QUIET) if (NOT fmt_FOUND)