From 5407bf8b1e00d4dee6fe701692370ba3bf03ae81 Mon Sep 17 00:00:00 2001 From: zcy <290198252@qq.com> Date: Tue, 6 Apr 2021 13:18:24 +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 --- extserial/src/qextserialport.cmake | 34 +++++++++++++--------------- extserial/src/qextserialport_win.cpp | 2 ++ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/extserial/src/qextserialport.cmake b/extserial/src/qextserialport.cmake index ee48831..5e68369 100644 --- a/extserial/src/qextserialport.cmake +++ b/extserial/src/qextserialport.cmake @@ -16,37 +16,35 @@ list(APPEND EXTSERIAL_SOURCES ${CMAKE_CURRENT_LIST_DIR}/qextserialenumerator.cpp ) IF (CMAKE_SYSTEM_NAME MATCHES "Linux") - list(APPEND EXTSERIAL_SOURCES ${CMAKE_CURRENT_LIST_DIR}/qextserialport_unix.cpp) - list(APPEND EXTSERIAL_SOURCES ${CMAKE_CURRENT_LIST_DIR}/qextserialenumerator_linux.cpp) + message("CMAKE_SYSTEM_NAME is ${CMAKE_SYSTEM_NAME}") + list(APPEND NO_MOC_SOURCES ${CMAKE_CURRENT_LIST_DIR}/qextserialport_unix.cpp) + list(APPEND NO_MOC_SOURCES ${CMAKE_CURRENT_LIST_DIR}/qextserialenumerator_linux.cpp) ELSEIF (CMAKE_SYSTEM_NAME MATCHES "Windows") - list(APPEND EXTSERIAL_SOURCES ${CMAKE_CURRENT_LIST_DIR}/qextserialport_win.cpp) - list(APPEND EXTSERIAL_SOURCES ${CMAKE_CURRENT_LIST_DIR}/qextserialenumerator_win.cpp) - + message("CMAKE_SYSTEM_NAME is ${CMAKE_SYSTEM_NAME}") + list(APPEND NO_MOC_SOURCES ${CMAKE_CURRENT_LIST_DIR}/qextserialport_win.cpp) + list(APPEND NO_MOC_SOURCES ${CMAKE_CURRENT_LIST_DIR}/qextserialenumerator_win.cpp) link_libraries(setupapi advapi32 user32) + ELSEIF (CMAKE_SYSTEM_NAME MATCHES "FreeBSD") +message("CMAKE_SYSTEM_NAME is ${FreeBSD}") ENDIF() -QT5_WRAP_CPP(EXTSERIAL_MOC_SOURCE ${EXTSERIAL_SOURCES} ) # moc预编译代码 -QT5_WRAP_CPP(EXTSERIAL_MOC_HEADER ${EXTSERIAL_HEADERS} ) # moc预编译代码 +QT5_WRAP_CPP(EXTSERIAL_MOC ${EXTSERIAL_SOURCES} ) # moc预编译代码 +QT5_WRAP_CPP(EXTSERIAL_MOCHEADER ${EXTSERIAL_HEADERS} ) # moc预编译代码 -list(APPEND MOC ${EXTSERIAL_MOC_SOURCE}) -list(APPEND SOURCES ${EXTSERIAL_SOURCES}) - - -FOREACH(list ${EXTSERIAL_MOC_SOURCE}) +FOREACH(list ${EXTSERIAL_MOCHEADER}) get_filename_component(BIN_PATH ${list} "DIRECTORY" ) - message("EXTSERIAL_MOC_SOURCE file" ${list}) + message("EXTSERIAL_MOCHEADER file" ${list} ${BIN_PATH}) + include_directories(${BIN_PATH}) ENDFOREACH(list) -FOREACH(list ${EXTSERIAL_MOC_HEADER}) - message("EXTSERIAL_MOC_HEADER file " ${list}) -ENDFOREACH(list) +# list(APPEND HEADERS ${EXTSERIAL_HEADERS}) +# list(APPEND SOURCES ${EXTSERIAL_SOURCES}) -message("EXTSERIAL_MOC_SOURCE file " ${BIN_PATH}) -include_directories(${BIN_PATH}) +list(APPEND NO_MOC_SOURCES ${EXTSERIAL_SOURCES}) include_directories(${CMAKE_CURRENT_LIST_DIR}) diff --git a/extserial/src/qextserialport_win.cpp b/extserial/src/qextserialport_win.cpp index 1d25e0e..165dca8 100644 --- a/extserial/src/qextserialport_win.cpp +++ b/extserial/src/qextserialport_win.cpp @@ -31,6 +31,7 @@ #include "qextserialport.h" #include "qextserialport_p.h" + #include #include #include @@ -403,3 +404,4 @@ void QextSerialPortPrivate::updatePortSettings() SetCommTimeouts(handle, &commTimeouts); settingsDirtyFlags = 0; } +