diff --git a/CMakeLists.txt b/CMakeLists.txt index de42efc7..07b70b67 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,18 +12,13 @@ endif() project(adobe_source_libraries CXX) -# download CPM.cmake -file( - DOWNLOAD - https://github.com/cpm-cmake/CPM.cmake/releases/download/v0.40.8/CPM.cmake - ${CMAKE_CURRENT_BINARY_DIR}/cmake/CPM.cmake - EXPECTED_HASH SHA256=78ba32abdf798bc616bab7c73aac32a17bbd7b06ad9e26a6add69de8f3ae4791 -) -include(${CMAKE_CURRENT_BINARY_DIR}/cmake/CPM.cmake) +################################################################################ -# Enable CPM caching to avoid re-downloading dependencies +# Enable CPM caching to avoid re-downloading dependencies. Must be before CPM.cmake include. set(CPM_SOURCE_CACHE ${CMAKE_SOURCE_DIR}/.cpm-cache CACHE PATH "Directory to cache CPM packages" FORCE) +include(cmake/CPM.cmake) + ################################################################################ # Dependencies @@ -91,9 +86,7 @@ if(BUILD_DOCS) if(DOXYGEN_FOUND) # Download doxygen-awesome-css theme via CPM CPMAddPackage( - NAME doxygen-awesome-css - GITHUB_REPOSITORY jothepro/doxygen-awesome-css - GIT_TAG v2.3.4 + URI gh:jothepro/doxygen-awesome-css@2.3.4 DOWNLOAD_ONLY YES ) set(AWESOME_CSS_DIR ${doxygen-awesome-css_SOURCE_DIR}) diff --git a/cmake/CPM.cmake b/cmake/CPM.cmake new file mode 100644 index 00000000..84748734 --- /dev/null +++ b/cmake/CPM.cmake @@ -0,0 +1,24 @@ +# SPDX-License-Identifier: MIT +# +# SPDX-FileCopyrightText: Copyright (c) 2019-2023 Lars Melchior and contributors + +set(CPM_DOWNLOAD_VERSION 0.42.0) +set(CPM_HASH_SUM "2020b4fc42dba44817983e06342e682ecfc3d2f484a581f11cc5731fbe4dce8a") + +if(CPM_SOURCE_CACHE) + set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake") +elseif(DEFINED ENV{CPM_SOURCE_CACHE}) + set(CPM_DOWNLOAD_LOCATION "$ENV{CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake") +else() + set(CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake") +endif() + +# Expand relative path. This is important if the provided path contains a tilde (~) +get_filename_component(CPM_DOWNLOAD_LOCATION ${CPM_DOWNLOAD_LOCATION} ABSOLUTE) + +file(DOWNLOAD + https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake + ${CPM_DOWNLOAD_LOCATION} EXPECTED_HASH SHA256=${CPM_HASH_SUM} +) + +include(${CPM_DOWNLOAD_LOCATION}) diff --git a/readme.md b/readme.md index 08b74d50..229fdd64 100644 --- a/readme.md +++ b/readme.md @@ -1,13 +1,13 @@ # Adobe Source Libraries -[![CI][ci-badge]][ci-link] +[![Build and Tests][ci-badge][ci-link] [![Documentation][docs-badge]][docs-link] [![License][license-badge]][license-link] ASL provides peer-reviewed and portable C++ source libraries. The libraries are intended to be widely useful, leveraging and extending both the C++ Standard Library and the Boost Libraries. -[ci-badge]: https://github.com/stlab/adobe_source_libraries/workflows/CI/badge.svg -[ci-link]: https://github.com/stlab/adobe_source_libraries/actions/workflows/ci.yml +[ci-badge]: https://github.com/stlab/adobe_source_libraries/actions/workflows/adobe_source_libraries.yml/badge.svg +[ci-link]: https://github.com/stlab/adobe_source_libraries/actions/workflows/adobe_source_libraries.yml [docs-badge]: https://img.shields.io/badge/docs-github%20pages-blue [docs-link]: https://stlab.github.io/adobe_source_libraries/ [license-badge]: https://img.shields.io/badge/license-BSL%201.0-blue.svg