mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-24 08:35:08 +00:00
Enhance the output of --version with Git describe results. (#342)
This commit is contained in:
parent
f3cfdb2781
commit
2c11b0dc47
@ -209,3 +209,20 @@ target_sources(ccls PRIVATE
|
|||||||
src/messages/textDocument_signatureHelp.cc
|
src/messages/textDocument_signatureHelp.cc
|
||||||
src/messages/workspace.cc
|
src/messages/workspace.cc
|
||||||
)
|
)
|
||||||
|
|
||||||
|
### Obtain CCLS version information from Git
|
||||||
|
### This only happens when cmake is re-run!
|
||||||
|
|
||||||
|
if(NOT CCLS_VERSION)
|
||||||
|
execute_process(COMMAND git describe --tag --long HEAD
|
||||||
|
OUTPUT_VARIABLE CCLS_VERSION
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}")
|
||||||
|
|
||||||
|
if(NOT CCLS_VERSION)
|
||||||
|
set(CCLS_VERSION "<unknown>")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set_property(SOURCE src/main.cc APPEND PROPERTY
|
||||||
|
COMPILE_DEFINITIONS CCLS_VERSION=\"${CCLS_VERSION}\")
|
||||||
|
@ -72,7 +72,8 @@ int main(int argc, char **argv) {
|
|||||||
TraceMe();
|
TraceMe();
|
||||||
sys::PrintStackTraceOnErrorSignal(argv[0]);
|
sys::PrintStackTraceOnErrorSignal(argv[0]);
|
||||||
cl::SetVersionPrinter([](raw_ostream &OS) {
|
cl::SetVersionPrinter([](raw_ostream &OS) {
|
||||||
OS << clang::getClangToolFullVersion("ccls") << "\n";
|
OS << clang::getClangToolFullVersion("ccls version " CCLS_VERSION "\nclang")
|
||||||
|
<< "\n";
|
||||||
});
|
});
|
||||||
|
|
||||||
for (auto &I : TopLevelSubCommand->OptionsMap)
|
for (auto &I : TopLevelSubCommand->OptionsMap)
|
||||||
|
Loading…
Reference in New Issue
Block a user