3
0
mirror of https://github.com/triqs/dft_tools synced 2024-12-22 12:23:41 +01:00

[cmake] Add option BUILD_ALWAYS to function external_dependency for force build

This commit is contained in:
Nils Wentzell 2020-04-28 17:18:25 -04:00
parent 984a89e569
commit a14bf3975b
2 changed files with 7 additions and 2 deletions

5
deps/CMakeLists.txt vendored
View File

@ -6,6 +6,7 @@ include(external_dependency.cmake)
# [VERSION <version-number>]
# [GIT_REPO <url>]
# [GIT_TAG <tag>]
# [BUILD_ALWAYS]
# [EXCLUDE_FROM_ALL]
# )
#
@ -25,6 +26,9 @@ include(external_dependency.cmake)
#
# GIT_TAG - Use this keyword to specify the git-tag, branch or commit hash
#
# BUILD_ALWAYS - If set, this dependency will always be built from source
# and will never be searched in the system.
#
# EXCLUDE_FROM_ALL - If set, targets of the dependency cmake subproject
# will not be included in the ALL target of the project.
# In particular the dependency will not be installed.
@ -43,5 +47,6 @@ endif()
external_dependency(GTest
GIT_REPO https://github.com/google/googletest
GIT_TAG release-1.10.0
BUILD_ALWAYS
EXCLUDE_FROM_ALL
)

View File

@ -1,6 +1,6 @@
function(external_dependency)
cmake_parse_arguments(ARG "EXCLUDE_FROM_ALL" "VERSION;GIT_REPO;GIT_TAG" "" ${ARGN})
cmake_parse_arguments(ARG "EXCLUDE_FROM_ALL;BUILD_ALWAYS" "VERSION;GIT_REPO;GIT_TAG" "" ${ARGN})
# -- Was dependency already found?
get_property(${ARGV0}_FOUND GLOBAL PROPERTY ${ARGV0}_FOUND)
@ -10,7 +10,7 @@ function(external_dependency)
endif()
# -- Try to find package in system.
if(NOT Build_Deps STREQUAL "Always")
if(NOT ARG_BUILD_ALWAYS AND NOT Build_Deps STREQUAL "Always")
find_package(${ARGV0} ${${ARGV0}_VERSION} QUIET)
if(${ARGV0}_FOUND)
message(STATUS "Found dependency ${ARGV0} in system.")