- Move setting _U_ into config.h, because
authorjmayer <jmayer@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 2 Feb 2012 12:04:22 +0000 (12:04 +0000)
committerjmayer <jmayer@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 2 Feb 2012 12:04:22 +0000 (12:04 +0000)
  a) C++ has a standardized way of marking parameters as unused
  b) cmakes autoquoting magic failed when the compiler wasn't gcc
     but moc instead.
- qtshark: Don't try to compile the c source files inside ui/qt/
- qtshark: Only run moc on the files that need it.
- qtshark: It's too early to try any of the new qtshark files
  as clean.
- Make Qt detection actually work
- Add C++ to the list of languages for this project

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@40807 f5534014-38df-0310-8fa8-9805f1628bb7

CMakeLists.txt
cmakeconfig.h.in
ui/qt/CMakeLists.txt

index a0e770f24ce4031aa5b6963e585cb3741f474caa..118fab5b22b2b7f1cd684cf1e0cd36eb00032193 100644 (file)
@@ -21,7 +21,7 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #
 
-project(Wireshark C)
+project(Wireshark C CXX)
 
 cmake_minimum_required(VERSION 2.6)
 set(CMAKE_BACKWARDS_COMPATIBILITY 2.6)
@@ -186,9 +186,9 @@ else()
 endif()
 
 if(CMAKE_COMPILER_IS_GNUCC)
-       add_definitions( -D_U_=__attribute__\(\(unused\)\) )
+       set (C_UNUSED "__attribute__((unused))" )
 else()
-       add_definitions( -D_U_=\"\" )
+       set (C_UNUSED "" )
 endif()
 
 set(WIRESHARK_LD_FLAGS
@@ -325,7 +325,7 @@ set(PROGLIST text2pcap mergecap capinfos editcap dumpcap)
 
 #Let's loop the package list
 foreach(PACKAGE ${PACKAGELIST})
-       if(${PACKAGE} EQUAL "QT")
+       if(${PACKAGE} STREQUAL "QT")
                set(PACKAGE_NAME "Qt4")
        else()
                set(PACKAGE_NAME ${PACKAGE})
@@ -383,6 +383,13 @@ endif()
 if(HAVE_LIBZLIB)
        set(HAVE_LIBZ 1)
 endif()
+# QT_LIBRARIES and QT_INCLUDES are not set above. They require extra magic:
+if(QT_FOUND)
+       include(${QT_USE_FILE})
+       include_directories(${QT_INCLUDE_DIR})
+       message(STATUS "QT includes: ${QT_INCLUDE_DIR}")
+       message(STATUS "QT libs: ${QT_LIBRARIES}")
+endif()
 
 include(ConfigureChecks.cmake)
 
index 2a4e1ab6446daccf6404d16cf543890b407820f5..8578ef05be8f641e83b9eb59e0850f4b1587665f 100644 (file)
    `char[]'. */
 /* Note: not use in the code */
 #cmakedefine YYTEXT_POINTER
+
+/* _U_ isn't needed for C++, simply don't name the variable.
+   Also, running moc with -D_U_... breaks cmake's auto escaping magic. */
+#ifndef __cplusplus
+# define _U_ ${C_UNUSED}
+#endif
+
index 55da90451a1aea74bc7a1f9fedea4e04a0da27c6..c7cc2cc7673e2dbd03e397e39e2a689f8278109e 100644 (file)
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #
 
-
-set(QTSHARK_C_SRC
-       ../../airpcap_loader.c
-       ../../alert_box.c
-       ../../capture-pcap-util.c
-       ../../capture.c
-       ../../capture_ifinfo.c
-       ../../capture_info.c
-       ../../capture_opts.c
-       ../../capture_sync.c
-       ../../capture_ui_utils.c
-       ../../cfile.c
-       ../../clopts_common.c
-       ../../color_filters.c
-       ../../disabled_protos.c
-       ../../file.c
-       ../../fileset.c
-       ../../filters.c
-       ../../frame_data_sequence.c
-       ../../g711.c
-       ../../merge.c
-       ../../packet-range.c
-       ../../print.c
-       ../../proto_hier_stats.c
-       ../../ps.c
-       ../../recent.c
-       ../../summary.c
-       ../../sync_pipe_write.c
-       ../../tap-megaco-common.c
-       ../../tap-rtp-common.c
-       ../../tempfile.c
-       ../../timestats.c
-       ../../u3.c
-       ../../util.c
-       ../../version_info.c
-)
-
 # All .h files which inherit from QObject aka which use the Q_OBJECT macro
 # need to go here.
 set(QTSHARK_H_SRC
@@ -79,13 +42,15 @@ set(QTSHARK_H_SRC
        monospace_font.h
        packet_list.h
        packet_list_model.h
-       packet_list_record.h
        progress_dialog.h
        proto_tree.h
-       qt_ui_utils.h
        recent_file_status.h
        simple_dialog_qt.h
        wireshark_application.h
+
+       # No Q_OBJECT:
+       # packet_list_record.h
+       # qt_ui_utils.h
 )
 
 set(QTSHARK_CPP_SRC
@@ -118,7 +83,6 @@ set(QTSHARK_CPP_SRC
 )
 
 set(QTSHARK_SRC
-       ${QTSHARK_C_SRC}
        ${QTSHARK_CPP_SRC}
 )
 
@@ -131,7 +95,8 @@ QT4_WRAP_UI(QTSHARK_UI_SRC ${QTSHARK_UI})
 QT4_WRAP_CPP(QTSHARK_MOC_SRC ${QTSHARK_H_SRC})
 
 set(CLEAN_FILES
-       ${QTSHARK_SRC}
+       # It's too early to care about clean files
+       # ${QTSHARK_SRC}
 )
 
 if (WERROR)