cmake_minimum_required(VERSION 3.16) project(AicsKnowledgeBase LANGUAGES CXX) set(CMAKE_AUTOMOC ON) set(CMAKE_CXX_STANDARD_REQUIRED ON) find_package(Qt6 COMPONENTS Quick 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 res/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 $<$,$>:QT_QML_DEBUG>) target_include_directories(AicsKnowledgeBase PRIVATE ../msquic/include) target_link_libraries(AicsKnowledgeBase PRIVATE Qt6::Quick fluentuiplugin FramelessHelper::Core FramelessHelper::Quick msquic.lib ) file(GLOB MSQUIC_BIN_FILES ../msquic/bin/*) add_custom_command(TARGET AicsKnowledgeBase POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ${MSQUIC_BIN_FILES} ${CMAKE_CURRENT_BINARY_DIR} )