Skip to content

Commit

Permalink
docs: add examples for the git clone and git checkout
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Nov 15, 2023
1 parent 538baf8 commit 554cdf9
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions src/Git.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,40 @@ Input variables:
- ``SHALLOW_SINCE``: Create a shallow clone with a history after the specified time. date should be in format of `git log --date=raw`.
- ``BRANCH``: Only clone the given branch
- ``FORCE_CLONE``: Force the clone even if the directory exists
Simple example:
.. code:: cmake
git_clone(
REPOSITORY_PATH
"./vcpkg"
REMOTE_URL
"https://github.com/microsoft/vcpkg.git"
)
Example for a shallow clone and checking out of a specific revision:
.. code:: cmake
git_clone(
REPOSITORY_PATH
"$ENV{HOME}/vcpkg"
REMOTE_URL
"https://github.com/microsoft/vcpkg.git"
SHALLOW_SINCE
"1686087993 -0700"
BRANCH
"master"
)
git_checkout(
REPOSITORY_PATH
"$ENV{HOME}/vcpkg"
REVISION
ecd22cc3acc8ee3c406e566db1e19ece1f17f409
)
]]
function(git_clone)
set(oneValueArgs
Expand Down Expand Up @@ -132,6 +166,23 @@ Input variables:
- ``REPOSITORY_PATH``: The path to the repository
- ``REVISION``: The revision to checkout
.. code:: cmake
git_checkout(
REPOSITORY_PATH
"$ENV{HOME}/vcpkg"
REVISION
ecd22cc3acc8ee3c406e566db1e19ece1f17f409
)
.. code:: cmake
git_checkout(
REPOSITORY_PATH
"./some_repo"
REVISION
v1.0.0
)
]]
function(git_checkout)
set(oneValueArgs REPOSITORY_PATH REVISION)
Expand Down

0 comments on commit 554cdf9

Please sign in to comment.