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) 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) 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) 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) 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) 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)