Skip to content

Commit ee63839

Browse files
committed
fetch_content
1 parent c15cdd9 commit ee63839

File tree

5 files changed

+49
-4
lines changed

5 files changed

+49
-4
lines changed

.git_archival.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.

.git_archival.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node: $Format:%H$
2+
node-date: $Format:%cI$
3+
describe-name: $Format:%(describe:tags=true,match=?[0-9.]*)$

.pre-commit-config.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
ci:
3+
skip: [clang-tidy]
4+
5+
default_install_hook_types:
6+
- pre-commit
7+
- pre-merge-commit
8+
- pre-push
9+
- prepare-commit-msg
10+
- commit-msg
11+
- post-commit
12+
- post-checkout
13+
- post-merge
14+
- post-rewrite
15+
16+
fail_fast: false
17+
18+
repos:
19+
- repo: https://github.com/Kr4is/cmake-format-precommit
20+
rev: v0.6.14
21+
hooks:
22+
- id: cmake-format
23+
args: [--config=.cmake-format]

CMakeLists.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)
2+
3+
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git/")
4+
find_package(Git REQUIRED)
5+
execute_process(COMMAND "${GIT_EXECUTABLE}" describe --tags --match=?[0-9.]* WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" OUTPUT_VARIABLE DESCRIBE_NAME COMMAND_ERROR_IS_FATAL ANY)
6+
set(CPM_DEVELOPMENT "-development-version")
7+
else()
8+
file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/.git_archival.txt" DESCRIBE_NAME REGEX "^describe-name:.*")
9+
endif()
10+
11+
string(REGEX MATCH "([0-9\\.]+)" EXTRACTED_CPM_VERSION "${DESCRIBE_NAME}")
12+
13+
project(CPM.cmake VERSION "${EXTRACTED_CPM_VERSION}" DESCRIPTION "CMake's missing package manager. A small CMake script for setup-free, cross-platform, reproducible dependency management." HOMEPAGE_URL "https://github.com/cpm-cmake/CPM.cmake" LANGUAGES NONE)
14+
15+
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/CPM.cmake")
16+

cmake/CPM.cmake

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,13 @@ if(NOT COMMAND cpm_message)
4242
endfunction()
4343
endif()
4444

45-
set(CURRENT_CPM_VERSION 1.0.0-development-version)
45+
if(DEFINED EXTRACTED_CPM_VERSION)
46+
set(CURRENT_CPM_VERSION "${EXTRACTED_CPM_VERSION}${CPM_DEVELOPMENT}")
47+
else()
48+
set(CURRENT_CPM_VERSION 1.0.0-development-version)
49+
endif()
50+
51+
message(STATUS "${CURRENT_CPM_VERSION}")
4652

4753
get_filename_component(CPM_CURRENT_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}" REALPATH)
4854
if(CPM_DIRECTORY)

0 commit comments

Comments
 (0)