diff --git a/CMakeLists.txt b/CMakeLists.txt
index 04bd85605..ff78f5ebc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -32,6 +32,7 @@ SET(LOCALEDIR ${CMAKE_INSTALL_PREFIX}/share/locale)
STRING(REPLACE "\";\"" "\ " PKG_STRING ${PKG_STRING})
OPTION(DISABLE_NCURSES "Disable Ncurses interface")
+OPTION(ENABLE_GTK "Enable GTK interface")
OPTION(DISABLE_NLS "Disable Native Language Support")
OPTION(DISABLE_GNUTLS "Disable SSLv3/TLS connection support")
OPTION(DISABLE_PLUGINS "Disable Plugins support")
diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt
index 1ccaa911c..9370c41d4 100644
--- a/src/gui/CMakeLists.txt
+++ b/src/gui/CMakeLists.txt
@@ -14,7 +14,9 @@
# along with this program. If not, see .
#
-SUBDIRS( curses )
+IF(NOT DISABLE_NCURSES)
+ SUBDIRS( curses )
+ENDIF(NOT DISABLE_NCURSES)
SET(LIB_GUI_COMMON_SRC gui-buffer.c gui-common.c gui-action.c gui-keyboard.c
gui-log.c gui-window.c gui-panel.c gui.h gui-buffer.h gui-color.h gui-keyboard.h
@@ -22,3 +24,7 @@ gui-panel.h gui-window.h)
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR})
ADD_LIBRARY(weechat_gui_common STATIC ${LIB_GUI_COMMON_SRC})
+
+IF(ENABLE_GTK)
+ ADD_SUBDIRECTORY( gtk )
+ENDIF(ENABLE_GTK)
diff --git a/src/gui/gtk/CMakeLists.txt b/src/gui/gtk/CMakeLists.txt
new file mode 100644
index 000000000..30e3b1d1b
--- /dev/null
+++ b/src/gui/gtk/CMakeLists.txt
@@ -0,0 +1,38 @@
+# Copyright (c) 2003-2007 FlashCode
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+
+SET(WEECHAT_GTK_SRC gui-gtk-chat.c gui-gtk-color.c gui-gtk-infobar.c
+gui-gtk-input.c gui-gtk-keyboard.c gui-gtk-main.c gui-gtk-nicklist.c
+gui-gtk-status.c gui-gtk-window.c gui-gtk-panel.c gui-gtk.h)
+
+SET(EXECUTABLE weechat-gtk)
+
+FIND_PACKAGE(PkgConfig)
+IF(PKG_CONFIG_FOUND)
+ pkg_check_modules(GTK2 gtk+-x11-2.0)
+ IF(GTK2_FOUND)
+ INCLUDE_DIRECTORIES( ${GTK2_INCLUDE_DIRS} )
+ LIST(APPEND EXTRA_LIBS ${GTK2_LIBRARIES})
+ # ELSE(GTK2_FOUND)
+ # MESSAGE(FATAL_ERROR "Missing dependency, aborting configuration phase")
+ ENDIF(GTK2_FOUND)
+ENDIF(PKG_CONFIG_FOUND)
+
+ADD_EXECUTABLE(${EXECUTABLE} ${WEECHAT_GTK_SRC})
+INCLUDE_DIRECTORIES(.. ../../common ../../irc ../../plugins)
+TARGET_LINK_LIBRARIES(${EXECUTABLE} ${STATIC_LIBS} ${EXTRA_LIBS})
+
+INSTALL(TARGETS ${EXECUTABLE} RUNTIME DESTINATION bin)
diff --git a/weechat/CMakeLists.txt b/weechat/CMakeLists.txt
index 04bd85605..ff78f5ebc 100644
--- a/weechat/CMakeLists.txt
+++ b/weechat/CMakeLists.txt
@@ -32,6 +32,7 @@ SET(LOCALEDIR ${CMAKE_INSTALL_PREFIX}/share/locale)
STRING(REPLACE "\";\"" "\ " PKG_STRING ${PKG_STRING})
OPTION(DISABLE_NCURSES "Disable Ncurses interface")
+OPTION(ENABLE_GTK "Enable GTK interface")
OPTION(DISABLE_NLS "Disable Native Language Support")
OPTION(DISABLE_GNUTLS "Disable SSLv3/TLS connection support")
OPTION(DISABLE_PLUGINS "Disable Plugins support")
diff --git a/weechat/src/gui/CMakeLists.txt b/weechat/src/gui/CMakeLists.txt
index 1ccaa911c..9370c41d4 100644
--- a/weechat/src/gui/CMakeLists.txt
+++ b/weechat/src/gui/CMakeLists.txt
@@ -14,7 +14,9 @@
# along with this program. If not, see .
#
-SUBDIRS( curses )
+IF(NOT DISABLE_NCURSES)
+ SUBDIRS( curses )
+ENDIF(NOT DISABLE_NCURSES)
SET(LIB_GUI_COMMON_SRC gui-buffer.c gui-common.c gui-action.c gui-keyboard.c
gui-log.c gui-window.c gui-panel.c gui.h gui-buffer.h gui-color.h gui-keyboard.h
@@ -22,3 +24,7 @@ gui-panel.h gui-window.h)
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR})
ADD_LIBRARY(weechat_gui_common STATIC ${LIB_GUI_COMMON_SRC})
+
+IF(ENABLE_GTK)
+ ADD_SUBDIRECTORY( gtk )
+ENDIF(ENABLE_GTK)
diff --git a/weechat/src/gui/gtk/CMakeLists.txt b/weechat/src/gui/gtk/CMakeLists.txt
new file mode 100644
index 000000000..30e3b1d1b
--- /dev/null
+++ b/weechat/src/gui/gtk/CMakeLists.txt
@@ -0,0 +1,38 @@
+# Copyright (c) 2003-2007 FlashCode
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+
+SET(WEECHAT_GTK_SRC gui-gtk-chat.c gui-gtk-color.c gui-gtk-infobar.c
+gui-gtk-input.c gui-gtk-keyboard.c gui-gtk-main.c gui-gtk-nicklist.c
+gui-gtk-status.c gui-gtk-window.c gui-gtk-panel.c gui-gtk.h)
+
+SET(EXECUTABLE weechat-gtk)
+
+FIND_PACKAGE(PkgConfig)
+IF(PKG_CONFIG_FOUND)
+ pkg_check_modules(GTK2 gtk+-x11-2.0)
+ IF(GTK2_FOUND)
+ INCLUDE_DIRECTORIES( ${GTK2_INCLUDE_DIRS} )
+ LIST(APPEND EXTRA_LIBS ${GTK2_LIBRARIES})
+ # ELSE(GTK2_FOUND)
+ # MESSAGE(FATAL_ERROR "Missing dependency, aborting configuration phase")
+ ENDIF(GTK2_FOUND)
+ENDIF(PKG_CONFIG_FOUND)
+
+ADD_EXECUTABLE(${EXECUTABLE} ${WEECHAT_GTK_SRC})
+INCLUDE_DIRECTORIES(.. ../../common ../../irc ../../plugins)
+TARGET_LINK_LIBRARIES(${EXECUTABLE} ${STATIC_LIBS} ${EXTRA_LIBS})
+
+INSTALL(TARGETS ${EXECUTABLE} RUNTIME DESTINATION bin)