From 900945f37c9742ce8b093b510ef7b749196b9a0e Mon Sep 17 00:00:00 2001 From: Drew Fisher Date: Sat, 12 Nov 2011 19:36:33 -0800 Subject: [PATCH] Make qtview example optional. Signed-off-by: Drew Fisher --- examples/qtview/CMakeLists.txt | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/examples/qtview/CMakeLists.txt b/examples/qtview/CMakeLists.txt index 8e7a2f4..0bd704b 100644 --- a/examples/qtview/CMakeLists.txt +++ b/examples/qtview/CMakeLists.txt @@ -1,20 +1,25 @@ -find_package(Qt4 REQUIRED QtCore QtGui) -include(${QT_USE_FILE}) -include_directories(${QT_INCLUDES}) +find_package(Qt4) -set (QTVIEW_HEADERS mousepoller.h mouseviewer.h) -set (QTVIEW_SOURCES mousepoller.cpp mouseviewer.cpp main.cpp) +if(QT4_FOUND) + message(STATUS "Found Qt4, will build qtview example") + include(${QT_USE_FILE}) + include_directories(${QT_INCLUDES}) -QT4_WRAP_CPP(QTVIEW_MOC_OUTFILES ${QTVIEW_HEADERS} ) + set (QTVIEW_HEADERS mousepoller.h mouseviewer.h) + set (QTVIEW_SOURCES mousepoller.cpp mouseviewer.cpp main.cpp) -add_executable(qtview ${QTVIEW_SOURCES} ${QTVIEW_MOC_OUTFILES}) -if(WIN32) - target_link_libraries(qtview touchmouse ${QT_LIBRARIES} setupapi) -elseif(NOT APPLE) - target_link_libraries(qtview touchmouse ${QT_LIBRARIES} usb-1.0 pthread rt) -else() - target_link_libraries(qtview touchmouse ${QT_LIBRARIES}) -endif() + QT4_WRAP_CPP(QTVIEW_MOC_OUTFILES ${QTVIEW_HEADERS} ) + add_executable(qtview ${QTVIEW_SOURCES} ${QTVIEW_MOC_OUTFILES}) + if(WIN32) + target_link_libraries(qtview touchmouse ${QT_LIBRARIES} setupapi) + elseif(NOT APPLE) + target_link_libraries(qtview touchmouse ${QT_LIBRARIES} usb-1.0 pthread rt) + else() + target_link_libraries(qtview touchmouse ${QT_LIBRARIES}) + endif() +else() + message(STATUS "Didn't find Qt, will not build qtview example") +endif() -- 2.39.2