Skip to content

Utilize CDeps.cmake #209

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions cmake/CPM.cmake

This file was deleted.

9 changes: 9 additions & 0 deletions cmake/FindCDeps.cmake
Original file line number Diff line number Diff line change
@@ -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)
12 changes: 7 additions & 5 deletions cmake/FindCatch2.cmake
Original file line number Diff line number Diff line change
@@ -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)
15 changes: 11 additions & 4 deletions cmake/FindCheckWarning.cmake
Original file line number Diff line number Diff line change
@@ -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)
12 changes: 8 additions & 4 deletions cmake/FindFMT.cmake
Original file line number Diff line number Diff line change
@@ -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)
15 changes: 10 additions & 5 deletions cmake/FindFixFormat.cmake
Original file line number Diff line number Diff line change
@@ -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)
Loading