From 3fa6fe6b6a595900b41ee958389f952ef8d440ef Mon Sep 17 00:00:00 2001 From: 18650180552 Date: Tue, 6 Apr 2021 13:18:39 +0800 Subject: [PATCH] =?UTF-8?q?cmake=E6=B7=BB=E5=8A=A0NO=5FMOC=E6=9D=A5?= =?UTF-8?q?=E5=BA=94=E5=AF=B9=E7=9B=B4=E6=8E=A5=E7=B2=97=E6=9A=B4include?= =?UTF-8?q?=20moc=E7=94=9F=E6=88=90=E7=9A=84=E6=BA=90=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- protoDebuger/CMakeLists.txt | 35 +++++++++++++++++++++++------------ protoDebuger/main.cpp | 2 -- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/protoDebuger/CMakeLists.txt b/protoDebuger/CMakeLists.txt index c2f4473..f17c8a1 100644 --- a/protoDebuger/CMakeLists.txt +++ b/protoDebuger/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.5) - -include_directories(third/lua/include) -link_directories(third/lua/lib) +message("CMAKE VERSION " ${VERSION}) +include_directories(third/include) +link_directories(third/lib) link_libraries(lua) project(protoDebuger LANGUAGES CXX) @@ -17,16 +17,15 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) find_package(Qt5 COMPONENTS Core Quick Widgets REQUIRED) -include(D:\\project\\c++qt\\qsswraper\\CMakeLists.txt) - set(HEADERS # 待预编译的cpp头文件 - dialog.h ) set(SOURCES # 待预编译的cpp代码 - dialog.cpp main.cpp ) +set(NO_MOC_SOURCES + +) set(RESOURCES qml.qrc @@ -37,23 +36,35 @@ set(QMLS ) set (UIS - "dialog.ui" - ${QsswraperUI}) + ${QsswraperUI} + ) + +include(D:\\project\\qt\\qsswraper\\CMakeLists.txt) +include(D:\\project\\qt\\qsswraper\\extserial\\src\\qextserialport.cmake) QT5_WRAP_CPP(MOC ${SOURCES} ) # moc预编译代码 QT5_WRAP_CPP(MOCHEADER ${HEADERS} ) # moc预编译代码 QT5_ADD_RESOURCES(RCC ${RESOURCES}) # rcc生成资源cpp QT5_WRAP_UI(UIC ${UIS}) # uic生成ui_x.h -message("MOC " ${MOC} ${MOCHEADER}) -message("UIC " ${UIC}) -message("RCC " ${RCC}) +FOREACH(list ${SOURCES}) + message("SOURCES file " ${list}) +ENDFOREACH(list) + +FOREACH(list ${MOCHEADER}) + message("MOCHEADER file" ${list}) +ENDFOREACH(list) + +FOREACH(list ${NO_MOC_SOURCES}) + message("NO_MOC_SOURCES file" ${list}) +ENDFOREACH(list) add_executable(protoDebuger #最后需要参与链接生成的是 ${SOURCES} #1. 原先的cpp代码, ${MOC} #2. 预编译后的cpp ${RCC} #3. 资源cpp代码 ${UIC} + ${NO_MOC_SOURCES} ) target_compile_definitions(protoDebuger diff --git a/protoDebuger/main.cpp b/protoDebuger/main.cpp index c766ce1..109fb27 100644 --- a/protoDebuger/main.cpp +++ b/protoDebuger/main.cpp @@ -17,8 +17,6 @@ int main(int argc, char *argv[]) QCoreApplication::exit(-1); }, Qt::QueuedConnection); engine.load(url); - Dialog a; - a.show(); return app.exec(); }