diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index c065a210..4cc43767 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -22,7 +22,8 @@ file(TO_CMAKE_PATH "/" PATH_SEPARATOR) #设置版本号 add_definitions(-DVERSION=1,3,4,0) -find_package(Qt6 REQUIRED COMPONENTS Quick REQUIRED) +find_package(Qt6 REQUIRED COMPONENTS Quick) +qt_standard_project_setup() #遍历所有Cpp文件 file(GLOB_RECURSE CPP_FILES *.cpp *.h) @@ -101,4 +102,13 @@ target_link_libraries(example PRIVATE #安装 install(TARGETS example BUNDLE DESTINATION . - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) + +qt_generate_deploy_app_script( + TARGET example + OUTPUT_SCRIPT deploy_script + NO_UNSUPPORTED_PLATFORM_ERROR +) +install(SCRIPT ${deploy_script}) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9156feca..9e05fda9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -16,6 +16,7 @@ set(QML_PLUGIN_DIRECTORY ${CMAKE_PREFIX_PATH}/qml/FluentUI) add_definitions(-DVERSION=1,3,4,0) find_package(Qt6 REQUIRED COMPONENTS Core Quick Qml) +qt_standard_project_setup() #遍历所有Cpp文件 file(GLOB_RECURSE CPP_FILES *.cpp *.h) @@ -63,20 +64,7 @@ qt_add_qml_module(fluentuiplugin #链接库 target_link_libraries(fluentuiplugin PUBLIC - Qt::CorePrivate - Qt::QuickPrivate - Qt::QmlPrivate + Qt::Core + Qt::Quick + Qt::Qml ) - -#链接库 win32库 不然mingw会编译错误 -if(WIN32) - target_link_libraries(fluentuiplugin PRIVATE dwmapi user32) -endif() - -#如果是debug,则生成的库文件名后面拼接d -# 在MinGW和GCC/Clang中, 默认不会链接带`d`后缀的动态库 -if(MSVC) - set_target_properties(fluentuiplugin PROPERTIES DEBUG_POSTFIX "d") -endif(MSVC) - -