AicsKnowledgeBase_client/AicsKnowledgeBase/CMakeLists.txt

68 lines
1.9 KiB
CMake

cmake_minimum_required(VERSION 3.16)
project(AicsKnowledgeBase LANGUAGES CXX)
set(CMAKE_AUTOMOC ON)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 20)
find_package(Qt6 COMPONENTS Gui Quick WebEngineQuick REQUIRED)
#遍历所有Cpp文件
file(GLOB_RECURSE CPP_FILES src/*.cpp src/*.h)
foreach (filepath ${CPP_FILES})
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" filename ${filepath})
list(APPEND sources_files ${filename})
endforeach (filepath)
#遍历所有qml文件
file(GLOB_RECURSE QML_PATHS qml/*.qml)
foreach (filepath ${QML_PATHS})
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" filename ${filepath})
list(APPEND qml_files ${filename})
endforeach (filepath)
#遍历所有资源文件
file(GLOB_RECURSE RES_PATHS res/*.png res/*.jpg res/*.svg res/*.ico res/*.ttf res/*.webp qmldir)
foreach (filepath ${RES_PATHS})
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" filename ${filepath})
list(APPEND resource_files ${filename})
endforeach (filepath)
qt_add_executable(AicsKnowledgeBase
${sources_files}
)
qt_add_qml_module(AicsKnowledgeBase
URI AicsKnowledgeBase
VERSION 1.0
QML_FILES ${qml_files}
RESOURCES ${resource_files}
)
set_target_properties(AicsKnowledgeBase PROPERTIES
WIN32_EXECUTABLE TRUE
)
target_compile_definitions(AicsKnowledgeBase
PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)
target_include_directories(AicsKnowledgeBase PRIVATE
../libcurl/include)
target_link_libraries(AicsKnowledgeBase PRIVATE
Qt6::Quick
Qt::WebEngineQuick
fluentuiplugin
FramelessHelper::Core
FramelessHelper::Quick
libcurl
)
file(GLOB MSQUIC_BIN_FILES ../libcurl/dll/*)
add_custom_command(TARGET AicsKnowledgeBase POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${MSQUIC_BIN_FILES} ${CMAKE_CURRENT_BINARY_DIR}
)