mirror of
https://github.com/cpm-cmake/CPM.cmake.git
synced 2025-11-17 06:37:43 -05:00
Fetch content (#593)
* Add git_archival mechanism * fetch_content * Delete .pre-commit-config.yaml * Update CPM.cmake * cmake-format
This commit is contained in:
3
.git_archival.txt
Normal file
3
.git_archival.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
node: $Format:%H$
|
||||
node-date: $Format:%cI$
|
||||
describe-name: $Format:%(describe:tags=true,match=?[0-9.]*)$
|
||||
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.git_archival.txt export-subst
|
||||
28
CMakeLists.txt
Normal file
28
CMakeLists.txt
Normal file
@@ -0,0 +1,28 @@
|
||||
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)
|
||||
|
||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git/")
|
||||
find_package(Git REQUIRED)
|
||||
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
|
||||
)
|
||||
set(CPM_DEVELOPMENT "-development-version")
|
||||
else()
|
||||
file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/.git_archival.txt" DESCRIBE_NAME
|
||||
REGEX "^describe-name:.*"
|
||||
)
|
||||
endif()
|
||||
|
||||
string(REGEX MATCH "([0-9\\.]+)" EXTRACTED_CPM_VERSION "${DESCRIBE_NAME}")
|
||||
|
||||
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
|
||||
)
|
||||
|
||||
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/CPM.cmake")
|
||||
@@ -42,7 +42,11 @@ if(NOT COMMAND cpm_message)
|
||||
endfunction()
|
||||
endif()
|
||||
|
||||
set(CURRENT_CPM_VERSION 1.0.0-development-version)
|
||||
if(DEFINED EXTRACTED_CPM_VERSION)
|
||||
set(CURRENT_CPM_VERSION "${EXTRACTED_CPM_VERSION}${CPM_DEVELOPMENT}")
|
||||
else()
|
||||
set(CURRENT_CPM_VERSION 1.0.0-development-version)
|
||||
endif()
|
||||
|
||||
get_filename_component(CPM_CURRENT_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}" REALPATH)
|
||||
if(CPM_DIRECTORY)
|
||||
|
||||
Reference in New Issue
Block a user