From 0d33339a6db894e901c65777c6d348afd91e2e79 Mon Sep 17 00:00:00 2001 From: Alfi Maulana Date: Mon, 7 Oct 2024 12:12:52 +0700 Subject: [PATCH 1/6] build: add `FindCDeps.cmake` file --- cmake/FindCDeps.cmake | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 cmake/FindCDeps.cmake diff --git a/cmake/FindCDeps.cmake b/cmake/FindCDeps.cmake new file mode 100644 index 0000000..97ac31b --- /dev/null +++ b/cmake/FindCDeps.cmake @@ -0,0 +1,9 @@ +file( + DOWNLOAD https://raw.githubusercontent.com/threeal/CDeps.cmake/d8c37677d9717738dd930005518cf1082c09eb71/cmake/CDeps.cmake + ${CMAKE_BINARY_DIR}/cmake/CDeps.cmake + EXPECTED_MD5 ab7516ba32bd687525f5d13bb349bf96) +include(${CMAKE_BINARY_DIR}/cmake/CDeps.cmake) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args( + CDeps REQUIRED_VARS CDEPS_VERSION VERSION_VAR CDEPS_VERSION) From ec770b660f52a6b17410ceaeed75fe4211c768bb Mon Sep 17 00:00:00 2001 From: Alfi Maulana Date: Mon, 7 Oct 2024 12:38:32 +0700 Subject: [PATCH 2/6] build: utilize CDeps in `FindCatch2.cmake` Signed-off-by: Alfi Maulana --- cmake/FindCatch2.cmake | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/cmake/FindCatch2.cmake b/cmake/FindCatch2.cmake index 71ad5af..9362c5a 100644 --- a/cmake/FindCatch2.cmake +++ b/cmake/FindCatch2.cmake @@ -1,7 +1,9 @@ -include(CPM) -cpmaddpackage(gh:catchorg/Catch2@${Catch2_FIND_VERSION}) +find_package(CDeps 0.1.0 REQUIRED) -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Catch2 REQUIRED_VARS Catch2_ADDED) +cdeps_download_package(Catch2 github.com/catchorg/Catch2 v${Catch2_FIND_VERSION}) +cdeps_build_package(Catch2) +cdeps_install_package(Catch2) -list(PREPEND CMAKE_MODULE_PATH ${Catch2_SOURCE_DIR}/extras) +include(CMakeFindDependencyMacro) +find_dependency(Catch2 ${Catch2_FIND_VERSION} CONFIG + PATHS ${Catch2_INSTALL_DIR}/lib/cmake NO_DEFAULT_PATH) From e55abd6bcdf43827eeae4de95d6933ffabd1eb15 Mon Sep 17 00:00:00 2001 From: Alfi Maulana Date: Mon, 7 Oct 2024 12:46:12 +0700 Subject: [PATCH 3/6] build: utilize CDeps in `FindCheckWarning.cmake` Signed-off-by: Alfi Maulana --- cmake/FindCheckWarning.cmake | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/cmake/FindCheckWarning.cmake b/cmake/FindCheckWarning.cmake index be3108b..36ea640 100644 --- a/cmake/FindCheckWarning.cmake +++ b/cmake/FindCheckWarning.cmake @@ -1,5 +1,12 @@ -include(CPM) -cpmaddpackage(gh:threeal/CheckWarning.cmake@${CheckWarning_FIND_VERSION}) +find_package(CDeps 0.1.0 REQUIRED) -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(CheckWarning REQUIRED_VARS CheckWarning.cmake_ADDED) +cdeps_download_package( + CheckWarning github.com/threeal/CheckWarning.cmake + v${CheckWarning_FIND_VERSION}) + +cdeps_build_package(CheckWarning) +cdeps_install_package(CheckWarning) + +include(CMakeFindDependencyMacro) +find_dependency(CheckWarning ${CheckWarning_FIND_VERSION} CONFIG + PATHS ${CheckWarning_INSTALL_DIR}/lib/cmake NO_DEFAULT_PATH) From c4c803ded19d42b854a5a5b956043988ff31ac3c Mon Sep 17 00:00:00 2001 From: Alfi Maulana Date: Mon, 7 Oct 2024 12:53:44 +0700 Subject: [PATCH 4/6] build: utilize CDeps in `FindFixFormat.cmake` Signed-off-by: Alfi Maulana --- cmake/FindFixFormat.cmake | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/cmake/FindFixFormat.cmake b/cmake/FindFixFormat.cmake index ba5cb83..fa1a311 100644 --- a/cmake/FindFixFormat.cmake +++ b/cmake/FindFixFormat.cmake @@ -1,7 +1,12 @@ -include(CPM) -cpmaddpackage(gh:threeal/FixFormat.cmake@${FixFormat_FIND_VERSION}) +find_package(CDeps 0.1.0 REQUIRED) -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(FixFormat REQUIRED_VARS FixFormat.cmake_ADDED) +cdeps_download_package( + FixFormat github.com/threeal/FixFormat.cmake v${FixFormat_FIND_VERSION}) -list(PREPEND CMAKE_MODULE_PATH ${FixFormat_SOURCE_DIR}/cmake) +cdeps_build_package(FixFormat) +cdeps_install_package(FixFormat) + +# TODO: Hardcode the version because FixFormat.cmake has an inconsistent version. +include(CMakeFindDependencyMacro) +find_dependency(FixFormat 1.1.0 CONFIG + PATHS ${FixFormat_INSTALL_DIR}/lib/cmake NO_DEFAULT_PATH) From 02d77e1184eeb384d9b13a30a6ab9b8f756908f0 Mon Sep 17 00:00:00 2001 From: Alfi Maulana Date: Mon, 7 Oct 2024 13:04:14 +0700 Subject: [PATCH 5/6] build: utilize CDeps in `FindFMT.cmake` Signed-off-by: Alfi Maulana --- cmake/FindFMT.cmake | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/cmake/FindFMT.cmake b/cmake/FindFMT.cmake index 106c740..ea18b7f 100644 --- a/cmake/FindFMT.cmake +++ b/cmake/FindFMT.cmake @@ -1,5 +1,9 @@ -include(CPM) -cpmaddpackage("gh:fmtlib/fmt#${FMT_FIND_VERSION}") +find_package(CDeps 0.1.0 REQUIRED) -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(FMT REQUIRED_VARS fmt_ADDED) +cdeps_download_package(FMT github.com/fmtlib/fmt ${FMT_FIND_VERSION}) +cdeps_build_package(FMT) +cdeps_install_package(FMT) + +include(CMakeFindDependencyMacro) +find_dependency(FMT ${FMT_FIND_VERSION} CONFIG + PATHS ${FMT_INSTALL_DIR}/lib/cmake NO_DEFAULT_PATH) From 8d947d1b8a7e15827e059f5c39c1e2767b0db66e Mon Sep 17 00:00:00 2001 From: Alfi Maulana Date: Mon, 7 Oct 2024 13:08:40 +0700 Subject: [PATCH 6/6] chore: remove unused `CPM.cmake` module Signed-off-by: Alfi Maulana --- cmake/CPM.cmake | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 cmake/CPM.cmake diff --git a/cmake/CPM.cmake b/cmake/CPM.cmake deleted file mode 100644 index 6e7c5d7..0000000 --- a/cmake/CPM.cmake +++ /dev/null @@ -1,7 +0,0 @@ -file( - DOWNLOAD - https://github.com/cpm-cmake/CPM.cmake/releases/download/v0.40.2/CPM.cmake - ${CMAKE_BINARY_DIR}/_deps/CPM.cmake - EXPECTED_MD5 4d51aa9dab6104fad39c5b7a692d5e1c -) -include(${CMAKE_BINARY_DIR}/_deps/CPM.cmake)