firemail
标题:
CMake引入 Qt Netrork
[打印本页]
作者:
Qter
时间:
2023-9-3 18:01
标题:
CMake引入 Qt Netrork
本帖最后由 Qter 于 2023-9-3 18:19 编辑
Common项目下的文件
CMakeLists.txt
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Gui Widgets Network REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Gui Widgets Network REQUIRED)
target_link_libraries(Common
PUBLIC
Qt${QT_VERSION_MAJOR}::Gui
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Widgets
Qt${QT_VERSION_MAJOR}::Network
PRIVATE
)
上面操作后,还没有自动把Qt5Networkd.dll 复制到out目录
# Copy the config directory to output folder
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_CURRENT_BINARY_DIR}/config
[ DISCUZ_CODE_0 ]lt;TARGET_FILE_DIR:${PROJECT_NAME}>/config
# Deploy the Qt Application
COMMAND ${DEPLOYQT_EXECUTABLE}
--no-svg
--no-translations
--no-compiler-runtime
[ DISCUZ_CODE_0 ]lt;TARGET_FILE:${PROJECT_NAME}>
复制代码
这样程序中有依赖的库会自动复制过去。
欢迎光临 firemail (http://firemail.wang:8088/)
Powered by Discuz! X3