Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
64144ec9
Commit
64144ec9
authored
Jan 15, 2020
by
Patrick José Pereira
Committed by
Daniel Agar
Jan 15, 2020
Browse files
cmake: Add Git module
Signed-off-by:
Patrick José Pereira
<
patrickelectric@gmail.com
>
parent
dfb0af91
Changes
1
Hide whitespace changes
Inline
Side-by-side
cmake/Git.cmake
0 → 100644
View file @
64144ec9
find_package
(
Git
)
if
(
NOT GIT_FOUND OR NOT EXISTS
"
${
PROJECT_SOURCE_DIR
}
/.git"
)
return
()
endif
()
# Update submodules as needed
option
(
GIT_SUBMODULE
"Check submodules during build"
ON
)
if
(
NOT GIT_SUBMODULE
)
return
()
endif
()
message
(
STATUS
"Submodule update"
)
execute_process
(
COMMAND
${
GIT_EXECUTABLE
}
submodule update --init --recursive
WORKING_DIRECTORY
"
${
CMAKE_CURRENT_SOURCE_DIR
}
"
RESULT_VARIABLE GIT_SUBMODULE_RESULT
)
if
(
NOT GIT_SUBMODULE_RESULT EQUAL
"0"
)
message
(
FATAL_ERROR
"git submodule update --init failed with
${
GIT_SUBMODULE_RESULT
}
, please checkout submodules"
)
endif
()
# Fetch the necessary git variables
execute_process
(
COMMAND
${
GIT_EXECUTABLE
}
describe --always --tags
WORKING_DIRECTORY
${
CMAKE_CURRENT_SOURCE_DIR
}
OUTPUT_VARIABLE GIT_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment