3
0
mirror of https://github.com/triqs/dft_tools synced 2024-11-18 12:03:50 +01:00

[cmake] Use GIT_TAG instead of TAG for external_dependency function

This commit is contained in:
Nils Wentzell 2020-04-28 16:25:28 -04:00
parent cce7b5cd2f
commit d9f8e1e0bf
2 changed files with 6 additions and 6 deletions

6
deps/CMakeLists.txt vendored
View File

@ -5,7 +5,7 @@ include(external_dependency.cmake)
# external_dependency(name
# [VERSION <version-number>]
# [GIT_REPO <url>]
# [TAG <tag>]
# [GIT_TAG <tag>]
# [EXCLUDE_FROM_ALL]
# )
#
@ -23,7 +23,7 @@ include(external_dependency.cmake)
#
# Addtional options:
#
# TAG - Use this keyword to specify the git tag or branch
# GIT_TAG - Use this keyword to specify the git-tag, branch or commit hash
#
# EXCLUDE_FROM_ALL - If set, targets of the dependency cmake subproject
# will not be included in the ALL target of the project.
@ -42,6 +42,6 @@ endif()
# -- GTest --
external_dependency(GTest
GIT_REPO https://github.com/google/googletest
TAG release-1.10.0
GIT_TAG release-1.10.0
EXCLUDE_FROM_ALL
)

View File

@ -1,6 +1,6 @@
function(external_dependency)
cmake_parse_arguments(ARG "EXCLUDE_FROM_ALL" "VERSION;GIT_REPO;TAG" "" ${ARGN})
cmake_parse_arguments(ARG "EXCLUDE_FROM_ALL" "VERSION;GIT_REPO;GIT_TAG" "" ${ARGN})
# -- Was dependency already found?
get_property(${ARGV0}_FOUND GLOBAL PROPERTY ${ARGV0}_FOUND)
@ -32,8 +32,8 @@ function(external_dependency)
set(bin_dir ${CMAKE_CURRENT_BINARY_DIR}/${ARGV0})
set(src_dir ${bin_dir}_src)
if(NOT IS_DIRECTORY ${src_dir})
if(ARG_TAG)
set(clone_opts --branch ${ARG_TAG} -c advice.detachedHead=false)
if(ARG_GIT_TAG)
set(clone_opts --branch ${ARG_GIT_TAG} -c advice.detachedHead=false)
endif()
execute_process(COMMAND git clone ${ARG_GIT_REPO} --depth 1 ${clone_opts} ${src_dir})
endif()