Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
Root
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
为了安全,强烈建议开启2FA双因子认证:User Settings -> Account -> Enable two-factor authentication!!!
Show more breadcrumbs
cxwx
Root
Commits
8cf4731b
Commit
8cf4731b
authored
6 years ago
by
Axel Naumann
Browse files
Options
Downloads
Patches
Plain Diff
[CMake] Use CMake to generate etc/gitinfo.txt, RGitCommit.h.tmp.
parent
3a5d257d
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/CMakeLists.txt
+31
-14
31 additions, 14 deletions
core/CMakeLists.txt
with
31 additions
and
14 deletions
core/CMakeLists.txt
+
31
−
14
View file @
8cf4731b
...
@@ -71,21 +71,38 @@ add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/include/RGitCommit.h
...
@@ -71,21 +71,38 @@ add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/include/RGitCommit.h
COMMENT
""
COMMENT
""
DEPENDS
${
CMAKE_BINARY_DIR
}
/RGitCommit.h.tmp
DEPENDS
${
CMAKE_BINARY_DIR
}
/RGitCommit.h.tmp
WORKING_DIRECTORY
${
CMAKE_BINARY_DIR
}
)
WORKING_DIRECTORY
${
CMAKE_BINARY_DIR
}
)
if
(
WIN32
)
add_custom_command
(
OUTPUT
${
CMAKE_BINARY_DIR
}
/RGitCommit.h.tmp
execute_process
(
COMMAND
${
GIT_EXECUTABLE
}
--git-dir=
${
CMAKE_SOURCE_DIR
}
/.git describe --all
COMMAND
${
CMAKE_SOURCE_DIR
}
/build/win/gitinfo.bat
${
CMAKE_SOURCE_DIR
}
OUTPUT_VARIABLE GIT_DESCRIBE_ALL
COMMAND
${
CMAKE_SOURCE_DIR
}
/build/win/githeader.bat RGitCommit.h.tmp
RESULT_VARIABLE GIT_DESCRIBE_ERRCODE
COMMENT
"Recording the git revision now"
ERROR_QUIET
DEPENDS
${
dep_objects
}
move_artifacts
OUTPUT_STRIP_TRAILING_WHITESPACE
)
WORKING_DIRECTORY
${
CMAKE_BINARY_DIR
}
)
if
(
NOT GIT_DESCRIBE_ERRCODE
)
else
()
execute_process
(
COMMAND
${
GIT_EXECUTABLE
}
--git-dir=
${
CMAKE_SOURCE_DIR
}
/.git describe --always
add_custom_command
(
OUTPUT
${
CMAKE_BINARY_DIR
}
/RGitCommit.h.tmp
OUTPUT_VARIABLE GIT_DESCRIBE_ALWAYS
COMMAND
${
CMAKE_SOURCE_DIR
}
/build/unix/gitinfo.sh
${
CMAKE_SOURCE_DIR
}
ERROR_QUIET
COMMAND
${
CMAKE_SOURCE_DIR
}
/build/unix/githeader.sh RGitCommit.h.tmp
OUTPUT_STRIP_TRAILING_WHITESPACE
)
COMMENT
"Recording the git revision now"
string
(
TIMESTAMP GIT_TIMESTAMP
"%b %d %Y, %H:%M:%S"
UTC
)
DEPENDS
${
dep_objects
}
move_artifacts
WORKING_DIRECTORY
${
CMAKE_BINARY_DIR
}
)
endif
()
endif
()
message
(
"Recording the git revision now"
)
file
(
WRITE
${
CMAKE_BINARY_DIR
}
/etc/gitinfo.txt
"
${
GIT_DESCRIBE_ALL
}
${
GIT_DESCRIBE_ALWAYS
}
${
GIT_TIMESTAMP
}
"
)
file
(
WRITE
${
CMAKE_BINARY_DIR
}
/RGitCommit.h.tmp
"#ifndef ROOT_RGITCOMMIT_H
#define ROOT_RGITCOMMIT_H
#define ROOT_GIT_BRANCH
\"
${
GIT_DESCRIBE_ALL
}
\"
#define ROOT_GIT_COMMIT
\"
${
GIT_DESCRIBE_ALWAYS
}
\"
#endif
"
)
add_custom_target
(
gitcommit ALL DEPENDS
${
CMAKE_BINARY_DIR
}
/RGitCommit.h.tmp
)
add_custom_target
(
gitcommit ALL DEPENDS
${
CMAKE_BINARY_DIR
}
/RGitCommit.h.tmp
)
set_source_files_properties
(
${
CMAKE_BINARY_DIR
}
/RGitCommit.h.tmp PROPERTIES GENERATED TRUE
)
set_source_files_properties
(
${
CMAKE_BINARY_DIR
}
/RGitCommit.h.tmp PROPERTIES GENERATED TRUE
)
add_dependencies
(
gitcommit
${
dep_targets
}
)
add_dependencies
(
gitcommit
${
dep_targets
}
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment