--- /dev/null
+cmake_minimum_required(VERSION 2.6)
+include(FindPkgConfig)
+
+project(sigrok-qt2)
+
+find_package(PkgConfig)
+pkg_check_modules(PKGDEPS REQUIRED
+ libsigrokdecode>=0.1.0
+ libsigrok>=0.1.0
+)
+
+find_package(Qt4 REQUIRED)
+
+set(VERSION 0.1.0)
+
+set(sigrok-qt2_SOURCES
+ about.cpp
+ main.cpp
+ mainwindow.cpp
+ sigview.cpp
+)
+
+set(sigrok-qt2_HEADERS
+ about.h
+ mainwindow.h
+ sigview.h
+)
+
+set(sigrok-qt2_FORMS
+ about.ui
+ mainwindow.ui
+)
+
+set(sigrok-qt2_RESOURCES
+ sigrok-qt2.qrc
+)
+
+set(QT_USE_QTOPENGL TRUE)
+
+qt4_wrap_cpp(sigrok-qt2_HEADERS_MOC ${sigrok-qt2_HEADERS})
+qt4_wrap_ui(sigrok-qt2_FORMS_HEADERS ${sigrok-qt2_FORMS})
+qt4_add_resources(sigrok-qt2_RESOURCES_RCC ${sigrok-qt2_RESOURCES})
+
+include(${QT_USE_FILE})
+
+add_definitions(${QT_DEFINITIONS})
+add_definitions(-DAPP_VERSION="${VERSION}")
+
+include_directories(
+ ${include_directories}
+ ${PKGDEPS_INCLUDE_DIRS}
+)
+
+link_directories(
+ ${PKGDEPS_LIBRARY_DIRS}
+)
+
+add_executable(sigrok-qt2
+ ${sigrok-qt2_SOURCES}
+ ${sigrok-qt2_HEADERS_MOC}
+ ${sigrok-qt2_FORMS_HEADERS}
+ ${sigrok-qt2_RESOURCES_RCC}
+)
+
+target_link_libraries(sigrok-qt2
+ ${PKGDEPS_LIBRARIES}
+ ${QT_LIBRARIES}
+)
+++ /dev/null
-#-------------------------------------------------
-#
-# Project created by QtCreator 2012-05-10T21:19:20
-#
-#-------------------------------------------------
-
-QT += core gui opengl
-
-TARGET = sigrok-qt2
-TEMPLATE = app
-
-# The sigrok-qt version number. Define APP_VERSION macro for use in the code.
-VERSION = 0.1.0
-DEFINES += APP_VERSION=\\\"$$VERSION\\\"
-
-SOURCES += main.cpp\
- mainwindow.cpp \
- about.cpp \
- sigview.cpp
-
-HEADERS += mainwindow.h \
- about.h \
- sigview.h
-
-FORMS += mainwindow.ui \
- about.ui
-
-RESOURCES += sigrok-qt2.qrc
-
-# libsigrok and libsigrokdecode
-# TODO: Check for the minimum versions of libsigrok/libsigrokdecode we need.
-win32 {
- # On Windows/MinGW we need to use '--libs --static'.
- # We also need to strip some stray '\n' characters here.
- QMAKE_CXXFLAGS += $$system(pkg-config --cflags libsigrokdecode \
- libsigrok | sed s/\n//g)
- LIBS += $$system(pkg-config --libs --static libsigrokdecode \
- libsigrok | sed s/\n//g)
-} else {
- QMAKE_CXXFLAGS += $$system(pkg-config --cflags libsigrokdecode)
- QMAKE_CXXFLAGS += $$system(pkg-config --cflags libsigrok)
- LIBS += $$system(pkg-config --libs libsigrokdecode)
- LIBS += $$system(pkg-config --libs libsigrok)
-}