Skip to content

Commit

Permalink
feature: add third party lib
Browse files Browse the repository at this point in the history
  • Loading branch information
L-Super committed Aug 24, 2024
1 parent c34597b commit d69fdf8
Showing 1 changed file with 28 additions and 8 deletions.
36 changes: 28 additions & 8 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ qt_add_resources(QRC_FILES resources.qrc)

set(SRC_FILES MainWindow.cpp MainWindow.h MainWindow.ui)

set(APP_DESCRIPTION "An Efficient Multi-threaded Download Manager")
set(APP_COPYRIGHT "Copyright 2024-2077 The FlowD Ltd.")

if (WIN32)
if (MSVC)
# Set MSVC to use utf-8 encode for building
Expand All @@ -38,10 +41,10 @@ if (WIN32)
set(FILE_VERSION_STR "${PROJECT_VERSION}")
set(PRODUCT_VERSION ${PROJECT_VERSION_MAJOR},${PROJECT_VERSION_MINOR},${PROJECT_VERSION_PATCH},${PROJECT_VERSION_TWEAK}) # 产品版本
set(PRODUCT_VERSION_STR "${PROJECT_VERSION}")
set(COMPANY_NAME "Qt")
set(FILE_DESCRIPTION "Qt template application") # 文件说明
set(LEGAL_COPYRIGHT "Copyright 2024-2077 The L Company Ltd.")
set(PRODUCT_NAME "Qt template")
set(COMPANY_NAME "FlowD")
set(FILE_DESCRIPTION ${APP_DESCRIPTION}) # 文件说明
set(LEGAL_COPYRIGHT ${APP_COPYRIGHT})
set(PRODUCT_NAME "FlowD")

set(WIN_RES_PATH ${CMAKE_CURRENT_SOURCE_DIR}/resources/win)
configure_file(${WIN_RES_PATH}/app.rc.in ${WIN_RES_PATH}/app.rc @ONLY)
Expand Down Expand Up @@ -78,18 +81,35 @@ elseif (APPLE)
set_target_properties(${PROJECT_NAME} PROPERTIES
MACOSX_BUNDLE_BUNDLE_NAME "${PROJECT_NAME}"
MACOSX_BUNDLE_ICON_FILE "logo.icns"
MACOSX_BUNDLE_GUI_IDENTIFIER "com.template.example"
MACOSX_BUNDLE_INFO_STRING "This is a qt application"
MACOSX_BUNDLE_GUI_IDENTIFIER "com.flowd.flowd"
MACOSX_BUNDLE_INFO_STRING ${APP_DESCRIPTION}
MACOSX_BUNDLE_BUNDLE_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}"
MACOSX_BUNDLE_SHORT_VERSION_STRING "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}"
MACOSX_BUNDLE_COPYRIGHT "Copyright 2024-2077 The L Company Ltd."
MACOSX_BUNDLE_COPYRIGHT ${APP_COPYRIGHT}
MACOSX_BUNDLE_INFO_PLIST ${MAC_RES_PATH}/Info.plist.in)
endif ()

target_link_libraries(${PROJECT_NAME}
include(FetchContent)
FetchContent_Declare(
spdlog
URL https://github.com/gabime/spdlog/archive/refs/tags/v1.14.1.zip
)

FetchContent_Declare(json
URL https://github.com/nlohmann/json/releases/download/v3.11.3/json.tar.xz)

FetchContent_Declare(cpr GIT_REPOSITORY https://github.com/libcpr/cpr.git
GIT_TAG aa581c9d8060b2502707ad96a04f4829cc524fcb)

FetchContent_MakeAvailable(spdlog json cpr)

target_link_libraries(${PROJECT_NAME} PRIVATE
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Gui
Qt${QT_VERSION_MAJOR}::Widgets
spdlog::spdlog_header_only
nlohmann_json::nlohmann_json
cpr::cpr
)

if (WIN32)
Expand Down

0 comments on commit d69fdf8

Please sign in to comment.