From bd4e8213632aee9ed3302f676896c34ce3884644 Mon Sep 17 00:00:00 2001 From: Rauli Laine Date: Thu, 28 Nov 2024 10:32:34 +0200 Subject: [PATCH] Switch to CMake's FetchContent Instead of using `cget` for dependency management, use CMake's builtin `FetchContent` feature. --- CMakeLists.txt | 32 ++++++++++++++++++++++++++++++-- requirements.txt | 2 -- 2 files changed, 30 insertions(+), 4 deletions(-) delete mode 100644 requirements.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 12985a5..73379d3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,8 +8,27 @@ PROJECT( LANGUAGES CXX ) +INCLUDE(FetchContent) INCLUDE(GNUInstallDirs) +FETCHCONTENT_DECLARE( + PeeloResult + GIT_REPOSITORY + https://github.com/peelonet/peelo-result.git + GIT_TAG + v0.6.0 +) +FETCHCONTENT_DECLARE( + PeeloUnicode + GIT_REPOSITORY + https://github.com/peelonet/peelo-unicode.git + GIT_TAG + v2.0.0 +) + +FETCHCONTENT_MAKEAVAILABLE(PeeloResult) +FETCHCONTENT_MAKEAVAILABLE(PeeloUnicode) + ADD_LIBRARY(${PROJECT_NAME} INTERFACE) TARGET_INCLUDE_DIRECTORIES( @@ -19,6 +38,13 @@ TARGET_INCLUDE_DIRECTORIES( $ ) +TARGET_LINK_LIBRARIES( + ${PROJECT_NAME} + INTERFACE + PeeloResult + PeeloUnicode +) + TARGET_COMPILE_FEATURES( ${PROJECT_NAME} INTERFACE @@ -71,5 +97,7 @@ INSTALL( include ) -ENABLE_TESTING() -ADD_SUBDIRECTORY(test) +IF(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) + ENABLE_TESTING() + ADD_SUBDIRECTORY(test) +ENDIF() diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 8e7549a..0000000 --- a/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -peelonet/peelo-result@v0.5.0 -peelonet/peelo-unicode@v1.0.0