File tree Expand file tree Collapse file tree 4 files changed +13
-6
lines changed Expand file tree Collapse file tree 4 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ set(META_VERSION_REVISION "${GIT_REV}")
5757set (META_VERSION "${META_VERSION_MAJOR} .${META_VERSION_MINOR} .${META_VERSION_PATCH} " )
5858set (META_NAME_VERSION "${META_PROJECT_NAME} v${META_VERSION} (${META_VERSION_REVISION} )" )
5959set (META_CMAKE_INIT_SHA "${GIT_REV} " )
60+ set (META_CMAKE_INIT_BRANCH "cmake-3.20" )
6061
6162string (MAKE_C_IDENTIFIER ${META_PROJECT_NAME} META_PROJECT_ID)
6263string (TOUPPER ${META_PROJECT_ID} META_PROJECT_ID)
@@ -100,7 +101,7 @@ file(WRITE "${PROJECT_BINARY_DIR}/VERSION" "${META_NAME_VERSION}")
100101#
101102
102103# Add cmake-init template check cmake targets
103- add_check_template_target(${META_CMAKE_INIT_SHA} )
104+ add_check_template_target(${META_CMAKE_INIT_SHA} ${META_CMAKE_INIT_BRANCH} )
104105
105106# Configure health check tools
106107enable_cppcheck(ON )
Original file line number Diff line number Diff line change @@ -210,7 +210,7 @@ This module is usable when the following is integrated into the `CMakeLists.txt`
210210
211211``` cmake
212212# Add cmake-init template check cmake targets
213- add_check_template_target(<CMAKE_INIT_SHA>)
213+ add_check_template_target(<CMAKE_INIT_SHA> <CMAKE_INIT_BRANCH> )
214214```
215215
216216Here, the ` <CMAKE_INIT_SHA> ` contains the git hash of the used cmake-init template.
@@ -221,9 +221,10 @@ The hash is usually configured using
221221``` cmake
222222# Meta information about the project
223223set(META_CMAKE_INIT_SHA "<CMAKE_INIT_SHA>")
224+ set(META_CMAKE_INIT_BRANCH "<CMAKE_INIT_BRANCH>")
224225
225226# Add cmake-init template check cmake targets
226- add_check_template_target(<CMAKE_INIT_SHA>)
227+ add_check_template_target(<CMAKE_INIT_SHA> <CMAKE_INIT_BRANCH> )
227228```
228229
229230Correctly configures, this module adds a cmake build target named ` check-template ` that compares the passed ` <CMAKE_INIT_SHA> ` with the current master commit hash of this repository and provides a link for a diff view.
Original file line number Diff line number Diff line change 33# Get cmake-init latest commit SHA on master
44#
55
6+ if (NOT APPLIED_CMAKE_INIT_BRANCH)
7+ set (APPLIED_CMAKE_INIT_BRANCH "master" )
8+ endif ()
9+
610file (DOWNLOAD
7- "https://api.github.com/repos/cginternals/cmake-init/commits/master "
11+ "https://api.github.com/repos/cginternals/cmake-init/commits/${APPLIED_CMAKE_INIT_BRANCH} "
812 "${PROJECT_BINARY_DIR} /cmake-init.github.data"
913)
1014file (READ
@@ -45,5 +49,5 @@ endif()
4549if (${APPLIED_CMAKE_INIT_SHA} STREQUAL ${CMAKE_INIT_SHA} )
4650 message (STATUS "cmake-init template is up-to-date (${CMAKE_INIT_SHA} )" )
4751else ()
48- message (STATUS "cmake-init template needs an update https://github.com/cginternals/cmake-init/compare/${APPLIED_CMAKE_INIT_SHA} ...master " )
52+ message (STATUS "cmake-init template needs an update https://github.com/cginternals/cmake-init/compare/${APPLIED_CMAKE_INIT_SHA} ...${APPLIED_CMAKE_INIT_BRANCH} " )
4953endif ()
Original file line number Diff line number Diff line change @@ -85,13 +85,14 @@ function(enable_clang_tidy status)
8585endfunction ()
8686
8787# Configure cmake target to check for cmake-init template
88- function (add_check_template_target current_template_sha)
88+ function (add_check_template_target current_template_sha current_template_branch )
8989 add_custom_target (
9090 check-template
9191 COMMAND ${CMAKE_COMMAND}
9292 -DPROJECT_SOURCE_DIR=${PROJECT_SOURCE_DIR}
9393 -DPROJECT_BINARY_DIR =${PROJECT_BINARY_DIR}
9494 -DAPPLIED_CMAKE_INIT_SHA=${current_template_sha}
95+ -DAPPLIED_CMAKE_INIT_BRANCH=${current_template_branch}
9596 -P ${PROJECT_SOURCE_DIR} /cmake/CheckTemplate.cmake
9697 WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
9798 )
You can’t perform that action at this time.
0 commit comments