From 34cf304f55c3440d1503b7ecf37da57413bf6106 Mon Sep 17 00:00:00 2001 From: muzili <2586850402@qq.com> Date: Thu, 5 Dec 2024 12:13:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=BF=9C=E7=A8=8B=E7=BC=96?= =?UTF-8?q?=E8=AF=91=E6=97=B6=E7=89=88=E6=9C=AC=E5=8F=B7=E4=BC=A0=E9=80=92?= =?UTF-8?q?=E5=88=B0cmake=E5=AE=8F=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 7 +++++++ GitHubDesktop2Chinese.cpp | 13 +++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1832fbc..35caa6c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,6 +13,13 @@ endif() #不要放在 if(MSVC) 中 add_compile_options(/utf-8) +if(DEFINED FILE_VERSION) +add_definitions(-DFILEVERSION="${FILE_VERSION}") +#add_definitions(-DFILEVERSION="v1.0.2") +else() +add_definitions(-DFILEVERSION="0.0.0-Dev.0") +endif() + project ("GitHubDesktop2Chinese") include(FetchContent) diff --git a/GitHubDesktop2Chinese.cpp b/GitHubDesktop2Chinese.cpp index 0a84ae6..f075390 100644 --- a/GitHubDesktop2Chinese.cpp +++ b/GitHubDesktop2Chinese.cpp @@ -25,12 +25,6 @@ #define NO_REPLACE 0 #endif // _DEBUG -#ifndef FILE_VERSION -#define FILE_VERSION "v0.0.0-Dev.0" -#endif // !FILE_VERSION - - - std::Version FileVer{0,0,0}; @@ -148,7 +142,7 @@ int main(int argc, char* argv[]) CLI11_PARSE(app, argc, argv); } - FileVer = std::Version(FILE_VERSION); + FileVer = std::Version(FILEVERSION); // 开发者声明 spdlog::info("开发者:CNGEGE > 2024/04/13"); @@ -156,7 +150,7 @@ int main(int argc, char* argv[]) spdlog::info("版本: {}", FileVer.toString(true)); } else { - spdlog::warn("程序版本解析失败... at {}", FILE_VERSION); + spdlog::warn("程序版本解析失败... at {}", FILEVERSION); } if (GetKeyState(VK_SHIFT) & 0x8000 || _debug_goto_devoptions) { @@ -208,6 +202,9 @@ int main(int argc, char* argv[]) std::string downlink = infojson["assets"][0]["browser_download_url"].get(); spdlog::info("点击链接下载: {}", downlink); } + else { + spdlog::info("当前版本已经是最新版.."); + } } PAUSE; }