diff --git a/CMakeLists.txt b/CMakeLists.txt
index 08d3cf68bc8a8a80d42496776cfe75dcdea84464..a40daebc8114a0b60b0c51dcd3d3b5183f8ea575 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,17 +1,33 @@
 cmake_minimum_required(VERSION 3.1)
 
-project(nheko CXX)
+project(nheko C CXX)
 
 option(BUILD_TESTS "Build all tests" OFF)
+option(APPVEYOR_BUILD "Build on appveyor" OFF)
 
 #
 # LMDB
 #
-find_path (LMDB_INCLUDE_DIR NAMES lmdb.h PATHS "$ENV{LMDB_DIR}/include")
-find_library (LMDB_LIBRARY NAMES lmdb PATHS "$ENV{LMDB_DIR}/lib" )
+if(APPVEYOR_BUILD)
+    set(LMDB_VERSION "LMDB_0.9.21")
+    set(NTDLIB "C:/WINDDK/7600.16385.1/lib/win7/amd64/ntdll.lib")
 
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(LMDB DEFAULT_MSG LMDB_INCLUDE_DIR LMDB_LIBRARY)
+    execute_process(
+        COMMAND git clone --depth=1 --branch ${LMDB_VERSION} https://github.com/LMDB/lmdb)
+
+    set(LMDB_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/lmdb/libraries/liblmdb)
+
+    add_library(lmdb
+        ${CMAKE_SOURCE_DIR}/lmdb/libraries/liblmdb/lmdb.h
+        ${CMAKE_SOURCE_DIR}/lmdb/libraries/liblmdb/mdb.c
+        ${CMAKE_SOURCE_DIR}/lmdb/libraries/liblmdb/midl.h
+        ${CMAKE_SOURCE_DIR}/lmdb/libraries/liblmdb/midl.c)
+else()
+    find_path (LMDB_INCLUDE_DIR NAMES lmdb.h PATHS "$ENV{LMDB_DIR}/include")
+    find_library (LMDB_LIBRARY NAMES lmdb PATHS "$ENV{LMDB_DIR}/lib" )
+    include(FindPackageHandleStandardArgs)
+    find_package_handle_standard_args(LMDB DEFAULT_MSG LMDB_INCLUDE_DIR LMDB_LIBRARY)
+endif()
 
 if (NOT EXISTS "${CMAKE_SOURCE_DIR}/libs/lmdbxx/.git" )
     message(WARNING "The git submodules are not available.")
@@ -298,7 +314,12 @@ else()
     #
     # Build the executable.
     #
+if(APPVEYOR_BUILD)
+    set (NHEKO_LIBS matrix_events Qt5::Widgets Qt5::Network lmdb)
+else()
     set (NHEKO_LIBS matrix_events Qt5::Widgets Qt5::Network ${LMDB_LIBRARY})
+endif()
+
     set (NHEKO_DEPS ${OS_BUNDLE} ${SRC_FILES} ${UI_HEADERS} ${MOC_HEADERS} ${QRC} ${LANG_QRC} ${QM_SRC})
 
     if(APPLE)
@@ -306,7 +327,7 @@ else()
         target_link_libraries (nheko ${NHEKO_LIBS} Qt5::MacExtras)
     elseif(WIN32)
         add_executable (nheko ${ICON_FILE} ${NHEKO_DEPS})
-        target_link_libraries (nheko ${NHEKO_LIBS} Qt5::WinMain)
+        target_link_libraries (nheko ${NTDLIB} ${NHEKO_LIBS} Qt5::WinMain)
     else()
         add_executable (nheko ${NHEKO_DEPS})
         target_link_libraries (nheko ${NHEKO_LIBS})
diff --git a/appveyor.yml b/appveyor.yml
index 32e025c4cdb3a380ab74dfa7eec96ab1b0430060..b56250979702c5e77a13741e8ba0bb48813769d1 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -19,9 +19,8 @@ install:
     - cinst nsis --version 3.0 -y -installArgs /D=C:\nsis
 
 build_script:
-    - cmake -G "Visual Studio 14 2015 Win64" -H. -Bbuild
+    - cmake -G "Visual Studio 14 2015 Win64" -H. -Bbuild -DAPPVEYOR_BUILD=ON
     - cmake --build build --config Release
-    - ls -lh build
 
 after_build:
     - mkdir NhekoRelease
diff --git a/src/RoomList.cc b/src/RoomList.cc
index 9dc7e1c24649d05047ff4b86c7aa37592398c270..0383be6e916a3a0a0465ebaa29482cdd575d5235 100644
--- a/src/RoomList.cc
+++ b/src/RoomList.cc
@@ -147,7 +147,8 @@ RoomList::setInitialRooms(const QMap<QString, QSharedPointer<RoomSettings>> &set
                   new RoomInfoListItem(settings[room_id], state, room_id, scrollArea_);
                 connect(
                   room_item, &RoomInfoListItem::clicked, this, &RoomList::highlightSelectedRoom);
-                connect(room_item, &RoomInfoListItem::leaveRoom, this, &RoomList::openLeaveRoomDialog);
+                connect(
+                  room_item, &RoomInfoListItem::leaveRoom, this, &RoomList::openLeaveRoomDialog);
 
                 rooms_.insert(room_id, QSharedPointer<RoomInfoListItem>(room_item));
 
@@ -168,9 +169,9 @@ void
 RoomList::openLeaveRoomDialog(const QString &room_id)
 {
         leaveRoomDialog_ = new LeaveRoomDialog(this);
-        connect(leaveRoomDialog_,
-                &LeaveRoomDialog::closing, this,
-                [=](bool leaving) { closeLeaveRoomDialog(leaving, room_id); });
+        connect(leaveRoomDialog_, &LeaveRoomDialog::closing, this, [=](bool leaving) {
+                closeLeaveRoomDialog(leaving, room_id);
+        });
 
         leaveRoomModal = new OverlayModal(MainWindow::instance(), leaveRoomDialog_);
         leaveRoomModal->setDuration(0);