--- /dev/null
+cmake_minimum_required(VERSION 2.8.9)
+PROJECT(qtlldb)
+
+set(CMAKE_VERBOSE_MAKEFILE on)
+
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+find_package(Qt5Widgets)
+find_package(Qt5 CONFIG REQUIRED Widgets Gui)
+
+execute_process(COMMAND llvm-config-3.4 --cflags OUTPUT_VARIABLE LLVM_CFLAGS OUTPUT_STRIP_TRAILING_WHITESPACE)
+execute_process(COMMAND llvm-config-3.4 --ldflags OUTPUT_VARIABLE LLVM_LDFLAGS OUTPUT_STRIP_TRAILING_WHITESPACE)
+execute_process(COMMAND llvm-config-3.4 --libs OUTPUT_VARIABLE LLVM_LIBS OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+separate_arguments(LLVM_CFLAGS)
+add_compile_options(${LLVM_CFLAGS})
+add_compile_options(-std=c++11 -Wall)
+
+separate_arguments(LLVM_LDFLAGS)
+separate_arguments(LLVM_LIBS)
+
+set(CMAKE_CXX_COMPILER "clang++")
+
+SET(qtlldb_SOURCES src/Binary.cxx src/main.cxx src/gui/Mainwindow.cxx)
+SET(qtlldb_HEADERS src/Binary.hxx src/include.hxx src/Section.hxx src/gui/Mainwindow.h++)
+
+ADD_EXECUTABLE(qtlldb ${qtlldb_SOURCES} ${qtlldb_HEADERS_MOC})
+
+
+set(CMAKE_LD_FLAGS "${LLVM_LDFLAGS}")
+set(CMAKE_LIBS "${LLVM_LIBS}")
+
+ADD_DEFINITIONS(${QT_DEFINITIONS})
+
+qt5_use_modules(qtlldb Widgets)
+INCLUDE_DIRECTORIES("src")
+
+
+TARGET_LINK_LIBRARIES(qtlldb ${QT_LIBRARIES} ${LLVM_LDFLAGS} ${LLVM_LIBS})
+++ /dev/null
-#!/usr/bin/make -f
-
-CXX = clang++
-LD = clang++
-
-CXXFLAGS += $(shell llvm-config-3.4 --cflags) $(shell pkg-config QtGui --cflags) -Isrc -std=c++0x
-LDFLAGS += $(shell llvm-config-3.4 --ldflags)
-LIBS += $(shell llvm-config-3.4 --libs) $(shell pkg-config QtGui --libs)
-
-objects = $(patsubst %.cxx,%.o,$(shell find src -name \*.cxx)) $(patsubst %.h++,%_moc.o,$(shell find src -name \*.h++))
-
-qtlldb: $(objects)
- $(LD) -o qtlldb $(LDFLAGS) $^ $(LIBS)
-
-.cxx.o:
- $(CXX) -MM -o $*.make $(CXXFLAGS) $<
- $(CXX) -o $@ -c $(CXXFLAGS) $<
-
-.cpp.o:
- $(CXX) -MM -o $*.make $(CXXFLAGS) $<
- $(CXX) -o $@ -c $(CXXFLAGS) $<
-
-clean:
- rm $(objects) qtlldb
-
-%_moc.cpp: %.h++
- moc $< -o $@
-
-include **/*.make
-
-.SUFFIXES: .cxx .o