Skip to content

Allow fetching from a specific git tag. #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,9 @@ The following cache variables may be set to influence the library detection:
``TEST_DRIVE_SUBPROJECT``
Directory to find the test-drive subproject, relative to the project root

``TEST_DRIVE_GIT_TAG``
The tag to use if fetching from git.

#]]

set(_lib "test-drive")
Expand Down Expand Up @@ -453,12 +456,16 @@ foreach(method ${${_pkg}_FIND_METHOD})
endif()

if("${method}" STREQUAL "fetch")
message(STATUS "Retrieving ${_lib} from ${_url}")
if(NOT DEFINED "${_pkg}_GIT_TAG")
set("_${_pkg}_GIT_TAG")
set("${_pkg}_GIT_TAG" "HEAD")
endif()
message(STATUS "Retrieving ${_lib} from ${_url} with tag ${${_pkg}_GIT_TAG}")
include(FetchContent)
FetchContent_Declare(
"${_lib}"
GIT_REPOSITORY "${_url}"
GIT_TAG "HEAD"
GIT_TAG "${${_pkg}_GIT_TAG}"
)
FetchContent_MakeAvailable("${_lib}")

Expand All @@ -483,6 +490,10 @@ else()
set("${_pkg}_FOUND" FALSE)
endif()

if(DEFINED "_${_pkg}_GIT_TAG")
unset("${_pkg}_GIT_TAG")
unset("_${_pkg}_GIT_TAG")
endif()
if(DEFINED "_${_pkg}_SUBPROJECT")
unset("${_pkg}_SUBPROJECT")
unset("_${_pkg}_SUBPROJECT")
Expand Down