summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt53
-rw-r--r--cmake/FindAspell.cmake49
-rw-r--r--cmake/FindGettext.cmake54
-rw-r--r--cmake/FindGnuTLS.cmake70
-rw-r--r--cmake/FindIconv.cmake74
-rw-r--r--cmake/FindLua.cmake82
-rw-r--r--cmake/FindPerl.cmake83
-rw-r--r--cmake/FindPython.cmake80
-rw-r--r--cmake/FindRuby.cmake78
-rw-r--r--config.h.cmake29
-rw-r--r--doc/CMakeLists.txt167
-rw-r--r--po/CMakeLists.txt77
-rw-r--r--po/srcfiles.cmake82
-rw-r--r--src/CMakeLists.txt95
-rw-r--r--src/common/CMakeLists.txt33
-rw-r--r--src/common/util.c8
-rw-r--r--src/gui/CMakeLists.txt25
-rw-r--r--src/gui/curses/CMakeLists.txt42
-rw-r--r--src/irc/CMakeLists.txt26
-rw-r--r--src/plugins/CMakeLists.txt45
-rw-r--r--src/plugins/aspell/CMakeLists.txt26
-rw-r--r--src/plugins/charset/CMakeLists.txt30
-rw-r--r--src/plugins/scripts/CMakeLists.txt50
-rw-r--r--src/plugins/scripts/lua/CMakeLists.txt30
-rw-r--r--src/plugins/scripts/perl/CMakeLists.txt38
-rw-r--r--src/plugins/scripts/python/CMakeLists.txt28
-rw-r--r--src/plugins/scripts/ruby/CMakeLists.txt27
-rw-r--r--weechat/CMakeLists.txt53
-rw-r--r--weechat/cmake/FindAspell.cmake49
-rw-r--r--weechat/cmake/FindGettext.cmake54
-rw-r--r--weechat/cmake/FindGnuTLS.cmake70
-rw-r--r--weechat/cmake/FindIconv.cmake74
-rw-r--r--weechat/cmake/FindLua.cmake82
-rw-r--r--weechat/cmake/FindPerl.cmake83
-rw-r--r--weechat/cmake/FindPython.cmake80
-rw-r--r--weechat/cmake/FindRuby.cmake78
-rw-r--r--weechat/config.h.cmake29
-rw-r--r--weechat/doc/CMakeLists.txt167
-rw-r--r--weechat/po/CMakeLists.txt77
-rw-r--r--weechat/po/srcfiles.cmake82
-rw-r--r--weechat/src/CMakeLists.txt95
-rw-r--r--weechat/src/common/CMakeLists.txt33
-rw-r--r--weechat/src/common/util.c8
-rw-r--r--weechat/src/gui/CMakeLists.txt25
-rw-r--r--weechat/src/gui/curses/CMakeLists.txt42
-rw-r--r--weechat/src/irc/CMakeLists.txt26
-rw-r--r--weechat/src/plugins/CMakeLists.txt45
-rw-r--r--weechat/src/plugins/aspell/CMakeLists.txt26
-rw-r--r--weechat/src/plugins/charset/CMakeLists.txt30
-rw-r--r--weechat/src/plugins/scripts/CMakeLists.txt50
-rw-r--r--weechat/src/plugins/scripts/lua/CMakeLists.txt30
-rw-r--r--weechat/src/plugins/scripts/perl/CMakeLists.txt38
-rw-r--r--weechat/src/plugins/scripts/python/CMakeLists.txt28
-rw-r--r--weechat/src/plugins/scripts/ruby/CMakeLists.txt27
54 files changed, 2962 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 000000000..6a8d92c3b
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,53 @@
+# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org>
+#
+# 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 2 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, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+PROJECT(weechat)
+
+SET(CMAKE_VERBOSE_MAKEFILE OFF)
+SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
+SET(CMAKE_SKIP_RPATH ON)
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -W")
+IF(PREFIX)
+ SET(CMAKE_INSTALL_PREFIX ${PREFIX} CACHE PATH "Install path prefix" FORCE)
+ENDIF(PREFIX)
+
+SET(VERSION 0.2.5-cvs)
+SET(PKG_STRING "${PROJECT_NAME} ${VERSION}")
+SET(LIBDIR ${CMAKE_INSTALL_PREFIX}/lib/weechat)
+SET(SHAREDIR ${CMAKE_INSTALL_PREFIX}/share/weechat)
+SET(LOCALEDIR ${CMAKE_INSTALL_PREFIX}/share/locale)
+STRING(REPLACE "\";\"" "\ " PKG_STRING ${PKG_STRING})
+
+OPTION(DISABLE_NCURSES "Disable Ncurses interface")
+OPTION(DISABLE_NLS "Disable Native Language Support")
+OPTION(DISABLE_GNUTLS "Disable SSLv3/TLS connection support")
+OPTION(DISABLE_PLUGINS "Disable Plugins support")
+OPTION(DISABLE_PERL "Disable Perl scripting language")
+OPTION(DISABLE_PYTHON "Disable Python scripting language")
+OPTION(DISABLE_RUBY "Disable Ruby scripting language")
+OPTION(DISABLE_LUA "Disable Lua scripting language")
+OPTION(DISABLE_ASPELL "Disable Aspell plugin")
+OPTION(DISABLE_CHARSET "Disable Charset plugin")
+OPTION(DISABLE_DOC "Disable Doc")
+
+ADD_SUBDIRECTORY( po )
+ADD_SUBDIRECTORY( src )
+IF(NOT DISABLE_DOC)
+ ADD_SUBDIRECTORY( doc )
+ENDIF(NOT DISABLE_DOC)
+
+CONFIGURE_FILE(config.h.cmake config.h @ONLY)
diff --git a/cmake/FindAspell.cmake b/cmake/FindAspell.cmake
new file mode 100644
index 000000000..575519768
--- /dev/null
+++ b/cmake/FindAspell.cmake
@@ -0,0 +1,49 @@
+# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org>
+#
+# 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 2 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, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+# - Find Aspell
+# This module finds if libaspell is installed and determines where
+# the include files and libraries are.
+#
+# This code sets the following variables:
+#
+# ASPELL_INCLUDE_PATH = path to where aspell.h can be found
+# ASPELL_LIBRARY = path to where libaspell.so* can be found
+
+IF (ASPELL_FOUND)
+ # Already in cache, be silent
+ SET(ASPELL_FIND_QUIETLY TRUE)
+ENDIF (ASPELL_FOUND)
+
+FIND_PATH(ASPELL_INCLUDE_PATH
+ NAMES aspell.h
+ PATHS /usr/include /usr/local/include /usr/pkg/include
+)
+
+FIND_LIBRARY(ASPELL_LIBRARY
+ NAMES aspell aspell-15
+ PATHS /lib /usr/lib /usr/local/lib /usr/pkg/lib
+)
+
+IF (ASPELL_INCLUDE_PATH AND ASPELL_LIBRARY)
+ SET(ASPELL_FOUND TRUE)
+ENDIF (ASPELL_INCLUDE_PATH AND ASPELL_LIBRARY)
+
+MARK_AS_ADVANCED(
+ ASPELL_INCLUDE_PATH
+ ASPELL_LIBRARY
+ )
diff --git a/cmake/FindGettext.cmake b/cmake/FindGettext.cmake
new file mode 100644
index 000000000..6cc6170ce
--- /dev/null
+++ b/cmake/FindGettext.cmake
@@ -0,0 +1,54 @@
+# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org>
+#
+# 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 2 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, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+# - Find Gettext
+# This module finds if gettext is installed and determines where
+# the include files and libraries are.
+#
+# This code sets the following variables:
+#
+# GETTEXT_FOUND = is gettext usable on system?
+
+IF(GETTEXT_FOUND)
+ # Already in cache, be silent
+ SET(GETTEXT_FIND_QUIETLY TRUE)
+ENDIF(GETTEXT_FOUND)
+
+INCLUDE(CheckIncludeFiles)
+INCLUDE(CheckLibraryExists)
+INCLUDE(CheckFunctionExists)
+
+CHECK_INCLUDE_FILES(libintl.h HAVE_LIBINTL_H)
+
+IF(HAVE_LIBINTL_H)
+ CHECK_FUNCTION_EXISTS(dgettext LIBC_HAS_DGETTEXT)
+ IF(LIBC_HAS_DGETTEXT)
+ SET(GETTEXT_FOUND TRUE)
+ ELSE(LIBC_HAS_DGETTEXT)
+ FIND_LIBRARY(LIBINTL_LIBRARY NAMES intl libintl
+ PATHS
+ /usr/lib
+ /usr/local/lib
+ )
+ IF(LIBINTL_LIBRARY)
+ CHECK_LIBRARY_EXISTS(${LIBINTL_LIBRARY} "dgettext" "" LIBINTL_HAS_DGETTEXT)
+ IF(LIBINTL_HAS_DGETTEXT)
+ SET(GETTEXT_FOUND TRUE)
+ ENDIF(LIBINTL_HAS_DGETTEXT)
+ ENDIF(LIBINTL_LIBRARY)
+ ENDIF(LIBC_HAS_DGETTEXT)
+ENDIF(HAVE_LIBINTL_H)
diff --git a/cmake/FindGnuTLS.cmake b/cmake/FindGnuTLS.cmake
new file mode 100644
index 000000000..6c19a6e5c
--- /dev/null
+++ b/cmake/FindGnuTLS.cmake
@@ -0,0 +1,70 @@
+# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org>
+#
+# 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 2 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, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+# - Find GnuTLS
+# This module finds if libgnutls is installed and determines where
+# the include files and libraries are.
+#
+# This code sets the following variables:
+#
+# GNUTLS_INCLUDE_PATH = path to where <gnutls/gnutls.h> can be found
+# GNUTLS_LIBRARY = path to where libgnutls.so* can be found
+# GNUTLS_CFLAGS = cflags to use to compile
+# GNUTLS_LDFLAGS = ldflags to use to compile
+
+IF(GNUTLS_INCLUDE_PATH AND GNUTLS_LIBRARY)
+ # Already in cache, be silent
+ set(GNUTLS_FIND_QUIETLY TRUE)
+ENDIF(GNUTLS_INCLUDE_PATH AND GNUTLS_LIBRARY)
+
+FIND_PROGRAM(GNUTLS_CONFIG_EXECUTABLE NAMES libgnutls-config)
+
+EXECUTE_PROCESS(COMMAND ${GNUTLS_CONFIG_EXECUTABLE} --prefix
+ OUTPUT_VARIABLE GNUTLS_PREFIX
+)
+
+EXECUTE_PROCESS(COMMAND ${GNUTLS_CONFIG_EXECUTABLE} --cflags
+ OUTPUT_VARIABLE GNUTLS_CFLAGS
+)
+
+EXECUTE_PROCESS(COMMAND ${GNUTLS_CONFIG_EXECUTABLE} --libs
+ OUTPUT_VARIABLE GNUTLS_LDFLAGS
+)
+
+SET(GNUTLS_POSSIBLE_INCLUDE_PATH "${GNUTLS_PREFIX}/include")
+SET(GNUTLS_POSSIBLE_LIB_DIR "${GNUTLS_PREFIX}/lib")
+
+FIND_PATH(GNUTLS_INCLUDE_PATH
+ NAMES gnutls/gnutls.h
+ PATHS GNUTLS_POSSIBLE_INCLUDE_PATH
+)
+
+FIND_LIBRARY(GNUTLS_LIBRARY
+ NAMES gnutls
+ PATHS GNUTLS_POSSIBLE_LIB_DIR
+)
+
+IF (GNUTLS_INCLUDE_PATH AND GNUTLS_LIBRARY)
+ SET(GNUTLS_FOUND TRUE)
+ENDIF (GNUTLS_INCLUDE_PATH AND GNUTLS_LIBRARY)
+
+MARK_AS_ADVANCED(
+ GNUTLS_INCLUDE_PATH
+ GNUTLS_LIBRARY
+ GNUTLS_CFLAGS
+ GNUTLS_LDFLAGS
+)
diff --git a/cmake/FindIconv.cmake b/cmake/FindIconv.cmake
new file mode 100644
index 000000000..5efbec59d
--- /dev/null
+++ b/cmake/FindIconv.cmake
@@ -0,0 +1,74 @@
+# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org>
+#
+# 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 2 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, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+# - Find Iconv
+# This module finds if libiconv is installed and determines where
+# the include files and libraries are.
+#
+# This code sets the following variables:
+#
+# ICONV_INCLUDE_PATH = path to where <iconv.h> can be found
+# ICONV_LIBRARY = path to where libiconv.so* can be found (on non glibc based systems)
+#
+# ICONV_FOUND = is iconv usable on system?
+
+IF(ICONV_FOUND)
+ # Already in cache, be silent
+ set(ICONV_FIND_QUIETLY TRUE)
+ENDIF(ICONV_FOUND)
+
+FIND_PATH(ICONV_INCLUDE_PATH
+ NAMES iconv.h
+ PATHS /usr/include /usr/local/include /usr/pkg/include
+)
+
+FIND_LIBRARY(ICONV_LIBRARY
+ NAMES iconv
+ PATHS /lib /usr/lib /usr/local/lib /usr/pkg/lib
+)
+
+IF(ICONV_INCLUDE_PATH)
+ IF(ICONV_LIBRARY)
+ STRING(REGEX REPLACE "/[^/]*$" "" ICONV_LIB_PATH "${ICONV_LIBRARY}")
+ CHECK_LIBRARY_EXISTS(iconv libiconv_open ${ICONV_LIB_PATH} ICONV_FOUND)
+ IF(NOT ICONV_FOUND)
+ CHECK_LIBRARY_EXISTS(iconv iconv_open ${ICONV_LIB_PATH} ICONV_FOUND)
+ ENDIF(NOT ICONV_FOUND)
+ ELSE(ICONV_LIBRARY)
+ CHECK_FUNCTION_EXISTS(iconv_open ICONV_FOUND)
+ ENDIF(ICONV_LIBRARY)
+ENDIF(ICONV_INCLUDE_PATH)
+
+include(CheckCSourceCompiles)
+SET(CMAKE_REQUIRED_FLAGS -Werror)
+check_c_source_compiles("
+ #include <iconv.h>
+ int main(){
+ iconv_t conv = 0;
+ const char* in = 0;
+ size_t ilen = 0;
+ char* out = 0;
+ size_t olen = 0;
+ iconv(conv, &in, &ilen, &out, &olen);
+ return 0;
+ }
+" ICONV_2ARG_IS_CONST)
+MARK_AS_ADVANCED(
+ ICONV_INCLUDE_PATH
+ ICONV_LIBRARY
+ ICONV_FOUND
+)
diff --git a/cmake/FindLua.cmake b/cmake/FindLua.cmake
new file mode 100644
index 000000000..7670be9bc
--- /dev/null
+++ b/cmake/FindLua.cmake
@@ -0,0 +1,82 @@
+# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org>
+#
+# 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 2 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, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+# - Find Lua
+# This module finds if liblua is installed and determines where
+# the include files and libraries are.
+#
+# This code sets the following variables:
+#
+# LUA_INCLUDE_PATH = path to where <lua.h> can be found
+# LUA_LIBRARY = path to where liblua.so* (and liblualib.so* for lua <can be found (on non glibc based systems)
+#
+# LUA_FOUND = is liblua usable on system?
+
+IF(LUA_FOUND)
+ # Already in cache, be silent
+ SET(LUA_FIND_QUIETLY TRUE)
+ENDIF(LUA_FOUND)
+
+FIND_PATH(
+ LUA51_INCLUDE_PATH lua.h
+ PATHS /usr/include /usr/local/include /usr/pkg/include
+ PATH_SUFFIXES lua51 lua5.1 lua-5.1
+)
+
+FIND_LIBRARY(
+ LUA51_LIBRARY NAMES lua51 lua5.1 lua-5.1
+ PATHS /lib /usr/lib /usr/local/lib /usr/pkg/lib
+)
+
+IF(LUA51_INCLUDE_PATH AND LUA51_LIBRARY)
+ SET(LUA_INCLUDE_PATH "${LUA51_INCLUDE_PATH}")
+ SET(LUA_LIBRARY "${LUA51_LIBRARY}")
+ SET(LUA_VERSION "5.1")
+ SET(LUA_FOUND TRUE)
+ELSE(LUA51_INCLUDE_PATH AND LUA51_LIBRARY)
+ FIND_PATH(
+ LUA50_INCLUDE_PATH lua.h
+ PATHS /usr/include /usr/local/include /usr/pkg/include
+ PATH_SUFFIXES lua50 lua5.0 lua-5.0 lua
+ )
+
+ FIND_LIBRARY(
+ LUA50_LIBRARY NAMES lua50 lua5.0 lua-5.0 lua
+ PATHS /lib /usr/lib /usr/local/lib /usr/pkg/lib
+ )
+
+ FIND_LIBRARY(
+ LUALIB50_LIBRARY NAMES lualib50 lualib5.0 lualib-5.0 lualib
+ PATHS /lib /usr/lib /usr/local/lib /usr/pkg/lib
+ )
+
+ IF(LUA50_INCLUDE_PATH AND LUA50_LIBRARY AND LUALIB50_LIBRARY)
+ SET(LUA_INCLUDE_PATH "${LUA50_INCLUDE_PATH}")
+ SET(LUA_LIBRARY "${LUA50_LIBRARY}")
+ SET(LUALIB_LIBRARY "${LUALIB50_LIBRARY}")
+ SET(LUA_VERSION "5.0")
+ SET(LUA_FOUND TRUE)
+ ENDIF(LUA50_INCLUDE_PATH AND LUA50_LIBRARY AND LUALIB50_LIBRARY)
+ENDIF(LUA51_INCLUDE_PATH AND LUA51_LIBRARY)
+
+
+MARK_AS_ADVANCED(
+ LUA_INCLUDE_PATH
+ LUA_LIBRARY
+ LUALIB_LIBRARY
+# LUA_VERSION
+)
diff --git a/cmake/FindPerl.cmake b/cmake/FindPerl.cmake
new file mode 100644
index 000000000..fe45770d4
--- /dev/null
+++ b/cmake/FindPerl.cmake
@@ -0,0 +1,83 @@
+# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org>
+#
+# 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 2 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, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+# - Find Perl libraries
+# This module finds if Perl is installed and determines where the include files
+# and libraries are. It also determines what the name of the library is. This
+# code sets the following variables:
+#
+# PERL_EXECUTABLE = full path to the perl binary
+# PERL_INCLUDE_PATH = path to where perl.h can be found
+# PERL_LIBRARY = path to where libperl.so* can be found
+# PERL_CFLAGS = perl compiler options for compiling
+# PERL_LFLAGS = perl compiler options for linking
+
+IF(PERL_FOUND)
+ # Already in cache, be silent
+ SET(PERL_FIND_QUIETLY TRUE)
+ENDIF(PERL_FOUND)
+
+FIND_PROGRAM(PERL_EXECUTABLE
+ NAMES perl perl5
+ PATHS /usr/bin /usr/local/bin /usr/pkg/bin
+ )
+
+IF(PERL_EXECUTABLE)
+
+ EXECUTE_PROCESS(
+ COMMAND ${PERL_EXECUTABLE} -MConfig -e "print \"\$Config{archlibexp}/CORE\""
+ OUTPUT_VARIABLE PERL_INTERNAL_DIR
+ )
+
+ EXECUTE_PROCESS(
+ COMMAND ${PERL_EXECUTABLE} -MExtUtils::Embed -e ccopts
+ OUTPUT_VARIABLE PERL_CFLAGS
+ )
+
+ EXECUTE_PROCESS(
+ COMMAND ${PERL_EXECUTABLE} -MExtUtils::Embed -e ldopts
+ OUTPUT_VARIABLE PERL_LFLAGS
+ )
+
+ # remove the new lines from the output by replacing them with empty strings
+ STRING(REPLACE "\n" "" PERL_INTERNAL_DIR "${PERL_INTERNAL_DIR}")
+ STRING(REPLACE "\n" "" PERL_CFLAGS "${PERL_CFLAGS}")
+ STRING(REPLACE "\n" "" PERL_LFLAGS "${PERL_LFLAGS}")
+
+ FIND_PATH(PERL_INCLUDE_PATH
+ NAMES perl.h
+ PATHS ${PERL_INTERNAL_DIR}
+ )
+
+ FIND_LIBRARY(PERL_LIBRARY
+ NAMES perl
+ PATHS /usr/lib /usr/local/lib /usr/pkg/lib ${PERL_INTERNAL_DIR}
+ )
+
+ IF(PERL_LIBRARY AND PERL_INCLUDE_PATH)
+ SET(PERL_FOUND TRUE)
+ ENDIF(PERL_LIBRARY AND PERL_INCLUDE_PATH)
+
+ MARK_AS_ADVANCED(
+ PERL_EXECUTABLE
+ PERL_INCLUDE_PATH
+ PERL_LIBRARY
+ PERL_CFLAGS
+ PERL_LFLAGS
+ )
+ENDIF(PERL_EXECUTABLE)
+
diff --git a/cmake/FindPython.cmake b/cmake/FindPython.cmake
new file mode 100644
index 000000000..73fc98ee3
--- /dev/null
+++ b/cmake/FindPython.cmake
@@ -0,0 +1,80 @@
+# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org>
+#
+# 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 2 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, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+# - Find Python
+# This module finds if Python is installed and determines where the include files
+# and libraries are. It also determines what the name of the library is. This
+# code sets the following variables:
+#
+# PYTHON_EXECUTABLE = full path to the python binary
+# PYTHON_INCLUDE_PATH = path to where python.h can be found
+# PYTHON_LIBRARY = path to where libpython.so* can be found
+# PYTHON_LFLAGS = python compiler options for linking
+
+IF(PYTHON_FOUND)
+ # Already in cache, be silent
+ SET(PYTHON_FIND_QUIETLY TRUE)
+ENDIF(PYTHON_FOUND)
+
+FIND_PROGRAM(PYTHON_EXECUTABLE
+ NAMES python python2.5 python2.4 python2.3 python2.2
+ PATHS /usr/bin /usr/local/bin /usr/pkg/bin
+ )
+
+IF(PYTHON_EXECUTABLE)
+ EXECUTE_PROCESS(
+ COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import *; print get_config_var('CONFINCLUDEPY')"
+ OUTPUT_VARIABLE PYTHON_INC_DIR
+ )
+
+ EXECUTE_PROCESS(
+ COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import *; print get_config_var('LIBPL')"
+ OUTPUT_VARIABLE PYTHON_POSSIBLE_LIB_PATH
+ )
+
+ EXECUTE_PROCESS(
+ COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import *; print get_config_var('LINKFORSHARED')"
+ OUTPUT_VARIABLE PYTHON_LFLAGS
+ )
+
+ # remove the new lines from the output by replacing them with empty strings
+ STRING(REPLACE "\n" "" PYTHON_INC_DIR "${PYTHON_INC_DIR}")
+ STRING(REPLACE "\n" "" PYTHON_POSSIBLE_LIB_PATH "${PYTHON_POSSIBLE_LIB_PATH}")
+ STRING(REPLACE "\n" "" PYTHON_LFLAGS "${PYTHON_LFLAGS}")
+
+ FIND_PATH(PYTHON_INCLUDE_PATH
+ NAMES Python.h
+ PATHS ${PYTHON_INC_DIR}
+ )
+
+ FIND_LIBRARY(PYTHON_LIBRARY
+ NAMES python python2.5 python2.4 python2.3 python2.2
+ PATHS ${PYTHON_POSSIBLE_LIB_PATH}
+ )
+
+ IF(PYTHON_LIBRARY AND PYTHON_INCLUDE_PATH)
+ SET(PYTHON_FOUND TRUE)
+ ENDIF(PYTHON_LIBRARY AND PYTHON_INCLUDE_PATH)
+
+ MARK_AS_ADVANCED(
+ PYTHON_EXECUTABLE
+ PYTHON_INCLUDE_PATH
+ PYTHON_LIBRARY
+ PYTHON_LFLAGS
+ )
+
+ENDIF(PYTHON_EXECUTABLE)
diff --git a/cmake/FindRuby.cmake b/cmake/FindRuby.cmake
new file mode 100644
index 000000000..ab55682e0
--- /dev/null
+++ b/cmake/FindRuby.cmake
@@ -0,0 +1,78 @@
+# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org>
+#
+# 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 2 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, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+# - Find Ruby
+# This module finds if Ruby is installed and determines where the include files
+# and libraries are. It also determines what the name of the library is. This
+# code sets the following variables:
+#
+# RUBY_EXECUTABLE = full path to the ruby binary
+# RUBY_INCLUDE_PATH = path to where ruby.h can be found
+# RUBY_LIBRARY = path to where libruby.so* can be found
+
+IF(RUBY_FOUND)
+ # Already in cache, be silent
+ SET(RUBY_FIND_QUIETLY TRUE)
+ENDIF(RUBY_FOUND)
+
+FIND_PROGRAM(RUBY_EXECUTABLE
+ NAMES ruby ruby1.9 ruby19 ruby1.8 ruby18 ruby1.6 ruby16
+ PATHS /usr/bin /usr/local/bin /usr/pkg/bin
+ )
+
+IF(RUBY_EXECUTABLE)
+ EXECUTE_PROCESS(
+ COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "puts Config::CONFIG['archdir']"
+ OUTPUT_VARIABLE RUBY_ARCH_DIR
+ )
+
+ EXECUTE_PROCESS(
+ COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "puts Config::CONFIG['libdir']"
+ OUTPUT_VARIABLE RUBY_POSSIBLE_LIB_PATH
+ )
+
+ EXECUTE_PROCESS(
+ COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "puts Config::CONFIG['rubylibdir']"
+ OUTPUT_VARIABLE RUBY_RUBY_LIB_PATH
+ )
+
+ # remove the new lines from the output by replacing them with empty strings
+ STRING(REPLACE "\n" "" RUBY_ARCH_DIR "${RUBY_ARCH_DIR}")
+ STRING(REPLACE "\n" "" RUBY_POSSIBLE_LIB_PATH "${RUBY_POSSIBLE_LIB_PATH}")
+ STRING(REPLACE "\n" "" RUBY_RUBY_LIB_PATH "${RUBY_RUBY_LIB_PATH}")
+
+ FIND_PATH(RUBY_INCLUDE_PATH
+ NAMES ruby.h
+ PATHS ${RUBY_ARCH_DIR}
+ )
+
+ FIND_LIBRARY(RUBY_LIBRARY
+ NAMES ruby ruby1.6 ruby16 ruby1.8 ruby18 ruby1.9 ruby19
+ PATHS ${RUBY_POSSIBLE_LIB_PATH} ${RUBY_RUBY_LIB_PATH}
+ )
+
+ IF(RUBY_LIBRARY AND RUBY_INCLUDE_PATH)
+ SET(RUBY_FOUND TRUE)
+ ENDIF(RUBY_LIBRARY AND RUBY_INCLUDE_PATH)
+
+ MARK_AS_ADVANCED(
+ RUBY_EXECUTABLE
+ RUBY_LIBRARY
+ RUBY_INCLUDE_PATH
+ )
+
+ENDIF(RUBY_EXECUTABLE)
diff --git a/config.h.cmake b/config.h.cmake
new file mode 100644
index 000000000..37100ce04
--- /dev/null
+++ b/config.h.cmake
@@ -0,0 +1,29 @@
+#cmakedefine HAVE_ARPA_INET_H
+#cmakedefine HAVE_LIBINTL_H
+#cmakedefine HAVE_LIMITS_H
+#cmakedefine HAVE_LOCALE_H
+#cmakedefine HAVE_NETDB_H
+#cmakedefine HAVE_NETINET_IN_H
+#cmakedefine HAVE_STDLIB_H
+#cmakedefine HAVE_STRING_H
+#cmakedefine HAVE_SYS_SOCKET_H
+#cmakedefine HAVE_SYS_TIME_H
+#cmakedefine HAVE_SYS_TYPES_H
+#cmakedefine HAVE_UNISTD_H
+#cmakedefine HAVE_PWD_H
+#cmakedefine HAVE_ERRNO_H
+#cmakedefine HAVE_REGEX_H
+#cmakedefine HAVE_WCHAR_H
+#cmakedefine HAVE_SYS_FILE_H
+#cmakedefine HAVE_FLOCK
+#cmakedefine HAVE_LANGINFO_CODESET
+#cmakedefine HAVE_STRNDUP
+#cmakedefine ICONV_2ARG_IS_CONST 1
+#define PACKAGE_VERSION "@VERSION@"
+#define PACKAGE "@PROJECT_NAME@"
+#define PACKAGE_NAME "@PROJECT_NAME@"
+#define PACKAGE_STRING "@PKG_STRING@"
+#define WEECHAT_LIBDIR "@LIBDIR@"
+#define WEECHAT_SHAREDIR "@SHAREDIR@"
+#define LOCALEDIR "@LOCALEDIR@"
+#define _GNU_SOURCE 1
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
new file mode 100644
index 000000000..f01ffe866
--- /dev/null
+++ b/doc/CMakeLists.txt
@@ -0,0 +1,167 @@
+# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org>
+#
+# 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 2 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, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+SET(DOC_LANGS
+ cs
+ de
+ en
+ fr
+ pl
+ ru
+ sco
+ )
+
+FIND_PROGRAM(
+ COPY cp
+ PATHS /bin /usr/bin /usr/local/bin /usr/pkg/bin
+)
+
+FIND_PROGRAM(
+ XSLTPROC xsltproc
+ PATHS /bin /usr/bin /usr/local/bin /usr/pkg/bin
+)
+
+FIND_PROGRAM(
+ DBLATEX dblatex
+ PATHS /bin /usr/bin /usr/local/bin /usr/pkg/bin
+ )
+
+FIND_FILE(DOC_XSL_PREFIX chunk.xsl PATHS
+ /usr/share/xml/docbook/stylesheet/nwalsh/
+ /usr/share/xml/docbook/xsl-stylesheets-1.69/
+ PATH_SUFFIXES html
+ DOC "Path to nwalsh xsl stylesheet"
+ )
+STRING(REPLACE "/html/chunk.xsl" "" DOC_XSL_PREFIX "${DOC_XSL_PREFIX}")
+
+IF(XSLTPROC AND DOC_XSL_PREFIX AND COPY)
+ SET(BUILD_HTML TRUE)
+ENDIF(XSLTPROC AND DOC_XSL_PREFIX AND COPY)
+
+IF(DBLATEX AND COPY)
+ SET(BUILD_PDF TRUE)
+ENDIF(DBLATEX AND COPY)
+
+IF(BUILD_HTML)
+ CONFIGURE_FILE(
+ ${CMAKE_CURRENT_SOURCE_DIR}/weechat-html.xsl.in
+ ${CMAKE_CURRENT_BINARY_DIR}/weechat-html.xsl
+ @ONLY
+ )
+
+ CONFIGURE_FILE(
+ ${CMAKE_CURRENT_SOURCE_DIR}/weechat-html-one.xsl.in
+ ${CMAKE_CURRENT_BINARY_DIR}/weechat-html-one.xsl
+ @ONLY
+ )
+ENDIF(BUILD_HTML)
+
+
+IF(BUILD_HTML OR BUILD_PDF)
+ EXECUTE_PROCESS(
+ COMMAND date "+%F %T"
+ OUTPUT_VARIABLE DOC_DATE
+ )
+ STRING(REPLACE "\n" "" DOC_DATE "${DOC_DATE}")
+
+ CONFIGURE_FILE(
+ ${CMAKE_CURRENT_SOURCE_DIR}/date.xml.in
+ ${CMAKE_CURRENT_BINARY_DIR}/date.xml
+ @ONLY
+ )
+
+ FOREACH(dlang ${DOC_LANGS})
+ IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/weechat.${dlang}.xml)
+
+ IF(BUILD_HTML)
+ FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/${dlang})
+ FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/${dlang}-build)
+ FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html-one/${dlang})
+
+ ADD_CUSTOM_COMMAND(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/html/${dlang}/index.html ${CMAKE_CURRENT_BINARY_DIR}/html-one/${dlang}/weechat.${dlang}.html
+ COMMAND ${COPY} ARGS "${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/weechat.${dlang}.xml" "${CMAKE_CURRENT_BINARY_DIR}/html/${dlang}-build"
+ COMMAND ${COPY} ARGS "${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/config.xml" "${CMAKE_CURRENT_BINARY_DIR}/html/${dlang}-build"
+ COMMAND ${COPY} ARGS "${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/irc_commands.xml" "${CMAKE_CURRENT_BINARY_DIR}/html/${dlang}-build"
+ COMMAND ${COPY} ARGS "${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/key_functions.xml" "${CMAKE_CURRENT_BINARY_DIR}/html/${dlang}-build"
+ COMMAND ${COPY} ARGS "${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/weechat_commands.xml" "${CMAKE_CURRENT_BINARY_DIR}/html/${dlang}-build"
+ COMMAND ${COPY} ARGS "${CMAKE_CURRENT_BINARY_DIR}/date.xml" "${CMAKE_CURRENT_BINARY_DIR}/html/${dlang}-build"
+ COMMAND ${COPY} ARGS "${CMAKE_CURRENT_SOURCE_DIR}/weechat-doc.css" "${CMAKE_CURRENT_BINARY_DIR}/html/${dlang}"
+ COMMAND ${COPY} ARGS "${CMAKE_CURRENT_SOURCE_DIR}/weechat-doc.css" "${CMAKE_CURRENT_BINARY_DIR}/html-one/${dlang}"
+ COMMAND ${XSLTPROC} ARGS -o ${CMAKE_CURRENT_BINARY_DIR}/html/${dlang}/ ${CMAKE_CURRENT_BINARY_DIR}/weechat-html.xsl ${CMAKE_CURRENT_BINARY_DIR}/html/${dlang}-build/weechat.${dlang}.xml
+ COMMAND ${XSLTPROC} ARGS -o ${CMAKE_CURRENT_BINARY_DIR}/html-one/${dlang}/weechat.${dlang}.html ${CMAKE_CURRENT_BINARY_DIR}/weechat-html-one.xsl ${CMAKE_CURRENT_BINARY_DIR}/html/${dlang}-build/weechat.${dlang}.xml
+ DEPENDS
+ ${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/weechat.${dlang}.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/config.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/irc_commands.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/key_functions.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/weechat_commands.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/date.xml.in
+ ${CMAKE_CURRENT_SOURCE_DIR}/weechat-html-one.xsl.in
+ ${CMAKE_CURRENT_SOURCE_DIR}/weechat-html.xsl.in
+ ${CMAKE_CURRENT_SOURCE_DIR}/date.xml.in
+ ${CMAKE_CURRENT_SOURCE_DIR}/weechat-doc.css
+ COMMENT "Building html doc (${dlang})"
+ )
+ ADD_CUSTOM_TARGET(doc-html-${dlang} ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/html/${dlang}/index.html)
+ ADD_CUSTOM_TARGET(doc-html-one-${dlang} ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/html-one/${dlang}/weechat.${dlang}.html)
+ INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/${dlang} DESTINATION share/doc/${PROJECT_NAME}/html)
+
+ ENDIF(BUILD_HTML)
+
+ IF(BUILD_PDF)
+ FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/pdf/${dlang})
+ FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/pdf/${dlang}-build)
+
+ ADD_CUSTOM_COMMAND(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/pdf/${dlang}/weechat.${dlang}.pdf
+ COMMAND ${COPY} ARGS "${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/weechat.${dlang}.xml" "${CMAKE_CURRENT_BINARY_DIR}/pdf/${dlang}-build"
+ COMMAND ${COPY} ARGS "${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/config.xml" "${CMAKE_CURRENT_BINARY_DIR}/pdf/${dlang}-build"
+ COMMAND ${COPY} ARGS "${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/irc_commands.xml" "${CMAKE_CURRENT_BINARY_DIR}/pdf/${dlang}-build"
+ COMMAND ${COPY} ARGS "${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/key_functions.xml" "${CMAKE_CURRENT_BINARY_DIR}/pdf/${dlang}-build"
+ COMMAND ${COPY} ARGS "${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/weechat_commands.xml" "${CMAKE_CURRENT_BINARY_DIR}/pdf/${dlang}-build"
+ COMMAND ${COPY} ARGS "${CMAKE_CURRENT_BINARY_DIR}/date.xml" "${CMAKE_CURRENT_BINARY_DIR}/pdf/${dlang}-build"
+ COMMAND ${DBLATEX} ARGS -c ${CMAKE_CURRENT_SOURCE_DIR}/dblatex.conf -o ${CMAKE_CURRENT_BINARY_DIR}/pdf/${dlang}/weechat.${dlang}.pdf ${CMAKE_CURRENT_BINARY_DIR}/pdf/${dlang}-build/weechat.${dlang}.xml
+ DEPENDS
+ ${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/weechat.${dlang}.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/config.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/irc_commands.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/key_functions.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/weechat_commands.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/date.xml.in
+ ${CMAKE_CURRENT_SOURCE_DIR}/weechat-html-one.xsl.in
+ ${CMAKE_CURRENT_SOURCE_DIR}/date.xml.in
+ COMMENT "Building pdf doc (${dlang})"
+ )
+ ADD_CUSTOM_TARGET(doc-pdf-${dlang} ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/pdf/${dlang}/weechat.${dlang}.pdf)
+ INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/pdf/${dlang}/weechat.${dlang}.pdf DESTINATION share/doc/${PROJECT_NAME})
+
+ ENDIF(BUILD_PDF)
+
+ ENDIF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/weechat.${dlang}.xml)
+
+ ENDFOREACH(dlang ${DOC_LANGS})
+
+ENDIF(BUILD_HTML OR BUILD_PDF)
+
+FOREACH(dlang ${DOC_LANGS})
+ IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/weechat_quickstart.${dlang}.txt)
+ INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/weechat_quickstart.${dlang}.txt DESTINATION share/doc/${PROJECT_NAME})
+ ENDIF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/weechat_quickstart.${dlang}.txt)
+ENDFOREACH(dlang ${DOC_LANGS})
+
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/weechat-curses.1 DESTINATION share/man/man1)
diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt
new file mode 100644
index 000000000..19629a0f5
--- /dev/null
+++ b/po/CMakeLists.txt
@@ -0,0 +1,77 @@
+# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org>
+#
+# 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 2 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, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+SET(PO_FILES
+ fr.po
+ es.po
+ cs.po
+ hu.po
+ de.po
+ ru.po
+ )
+
+SET(COPYRIGHT_HOLDER "WeeChat Team")
+SET(BUGS_ADDRESS "flashcode@flashtux.org")
+SET(POT_FILE ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pot)
+
+INCLUDE(srcfiles.cmake)
+
+# Looking for xgettext, msgmerge and msgfmt
+FIND_PROGRAM(XGETTEXT_EXECUTABLE xgettext)
+FIND_PROGRAM(MSGMERGE_EXECUTABLE msgmerge)
+FIND_PROGRAM(MSGFMT_EXECUTABLE msgfmt)
+
+IF(XGETTEXT_EXECUTABLE AND MSGMERGE_EXECUTABLE AND MSGFMT_EXECUTABLE)
+
+ # Create PO template file weechat.pot
+ SET(SRC_FILES)
+ SET(POT_DEPENDS)
+
+ FOREACH(srcfile ${WEECHAT_SOURCES})
+ SET(SRC_FILES ${SRC_FILES} ${srcfile})
+ SET(POT_DEPENDS ${POT_DEPENDS} ${CMAKE_SOURCE_DIR}/${srcfile})
+ ENDFOREACH(srcfile ${WEECHAT_SOURCES})
+
+ ADD_CUSTOM_COMMAND(
+ OUTPUT ${POT_FILE}
+ COMMAND ${XGETTEXT_EXECUTABLE}
+ ARGS -o ${POT_FILE} --keyword='_' --keyword='N_' --directory=${CMAKE_SOURCE_DIR} --omit-header --msgid-bugs-address=${BUGS_ADDRESS} --copyright-holder=${COPYRIGHT_HOLDER} ${SRC_FILES}
+ DEPENDS ${POT_DEPENDS}
+ COMMENT "Generating PO template file"
+ )
+
+ # Update .po files and compile them to binary .gmo files
+
+ SET(GMO_FILES)
+ FOREACH(pofile ${PO_FILES})
+ GET_FILENAME_COMPONENT(polang ${pofile} NAME_WE)
+
+ SET(gmofile ${CMAKE_CURRENT_BINARY_DIR}/${polang}.gmo)
+ ADD_CUSTOM_COMMAND(
+ OUTPUT ${gmofile}
+ COMMAND ${MSGMERGE_EXECUTABLE} ARGS --quiet -s -o ${CMAKE_CURRENT_BINARY_DIR}/${pofile} ${CMAKE_CURRENT_SOURCE_DIR}/${pofile} ${POT_FILE}
+ COMMAND ${MSGFMT_EXECUTABLE} ARGS -o ${gmofile} ${CMAKE_CURRENT_BINARY_DIR}/${pofile}
+ DEPENDS ${POT_FILE} ${CMAKE_CURRENT_SOURCE_DIR}/${pofile}
+ COMMENT "Compiling locales (${polang})"
+ )
+
+ INSTALL(FILES ${gmofile} DESTINATION share/locale/${polang}/LC_MESSAGES RENAME ${PROJECT_NAME}.mo)
+ SET(GMO_FILES ${GMO_FILES} ${gmofile})
+ ENDFOREACH(pofile ${PO_FILES})
+ ADD_CUSTOM_TARGET(translations ALL DEPENDS ${GMO_FILES})
+
+ENDIF(XGETTEXT_EXECUTABLE AND MSGMERGE_EXECUTABLE AND MSGFMT_EXECUTABLE)
diff --git a/po/srcfiles.cmake b/po/srcfiles.cmake
new file mode 100644
index 000000000..8c368f10d
--- /dev/null
+++ b/po/srcfiles.cmake
@@ -0,0 +1,82 @@
+SET(WEECHAT_SOURCES
+src/irc/irc-mode.c
+src/irc/irc-nick.c
+src/irc/irc-server.c
+src/irc/irc-channel.c
+src/irc/irc-commands.c
+src/irc/irc-display.c
+src/irc/irc-send.c
+src/irc/irc-recv.c
+src/irc/irc-dcc.c
+src/irc/irc-ignore.c
+src/irc/irc.h
+src/plugins/plugins.c
+src/plugins/plugins.h
+src/plugins/plugins-config.c
+src/plugins/plugins-config.h
+src/plugins/plugins-interface.c
+src/plugins/weechat-plugin.h
+src/gui/curses/gui-curses-chat.c
+src/gui/curses/gui-curses-color.c
+src/gui/curses/gui-curses-infobar.c
+src/gui/curses/gui-curses-input.c
+src/gui/curses/gui-curses-keyboard.c
+src/gui/curses/gui-curses-main.c
+src/gui/curses/gui-curses-nicklist.c
+src/gui/curses/gui-curses-panel.c
+src/gui/curses/gui-curses-status.c
+src/gui/curses/gui-curses-window.c
+src/gui/curses/gui-curses.h
+src/gui/gtk/gui-gtk-chat.c
+src/gui/gtk/gui-gtk-color.c
+src/gui/gtk/gui-gtk-infobar.c
+src/gui/gtk/gui-gtk-input.c
+src/gui/gtk/gui-gtk-keyboard.c
+src/gui/gtk/gui-gtk-main.c
+src/gui/gtk/gui-gtk-nicklist.c
+src/gui/gtk/gui-gtk-panel.c
+src/gui/gtk/gui-gtk-status.c
+src/gui/gtk/gui-gtk-window.c
+src/gui/gtk/gui-gtk.h
+src/gui/gui-action.c
+src/gui/gui-buffer.c
+src/gui/gui-common.c
+src/gui/gui-keyboard.c
+src/gui/gui-log.c
+src/gui/gui-panel.c
+src/gui/gui-window.c
+src/gui/gui.h
+src/gui/gui-buffer.h
+src/gui/gui-color.h
+src/gui/gui-keyboard.h
+src/gui/gui-panel.h
+src/gui/gui-window.h
+src/common/alias.c
+src/common/alias.h
+src/common/backtrace.c
+src/common/backtrace.h
+src/common/command.c
+src/common/command.h
+src/common/completion.c
+src/common/completion.h
+src/common/fifo.c
+src/common/fifo.h
+src/common/history.c
+src/common/history.h
+src/common/hotlist.c
+src/common/hotlist.h
+src/common/log.c
+src/common/log.h
+src/common/session.c
+src/common/session.h
+src/common/utf8.c
+src/common/utf8.h
+src/common/util.c
+src/common/util.h
+src/common/weechat.c
+src/common/weechat.h
+src/common/weeconfig.c
+src/common/weeconfig.h
+src/common/weelist.c
+src/common/weelist.h
+)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 000000000..2694d55d1
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,95 @@
+# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org>
+#
+# 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 2 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, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+ADD_DEFINITIONS(-DHAVE_CONFIG_H)
+
+INCLUDE(CheckIncludeFiles)
+INCLUDE(CheckFunctionExists)
+
+CHECK_INCLUDE_FILES("arpa/inet.h" HAVE_ARPA_INET_H)
+CHECK_INCLUDE_FILES("libintl.h" HAVE_LIBINTL_H)
+CHECK_INCLUDE_FILES("limits.h" HAVE_LIMITS_H)
+CHECK_INCLUDE_FILES("locale.h" HAVE_LOCALE_H)
+CHECK_INCLUDE_FILES("netdb.h" HAVE_NETDB_H)
+CHECK_INCLUDE_FILES("netinet/in.h" HAVE_NETINET_IN_H)
+CHECK_INCLUDE_FILES("stdlib.h" HAVE_STDLIB_H)
+CHECK_INCLUDE_FILES("string.h" HAVE_STRING_H)
+CHECK_INCLUDE_FILES("sys/socket.h" HAVE_SYS_SOCKET_H)
+CHECK_INCLUDE_FILES("sys/time.h" HAVE_SYS_TIME_H)
+CHECK_INCLUDE_FILES("sys/types.h" HAVE_SYS_TYPES_H)
+CHECK_INCLUDE_FILES("unistd.h" HAVE_UNISTD_H)
+CHECK_INCLUDE_FILES("pwd.h" HAVE_PWD_H)
+CHECK_INCLUDE_FILES("errno.h" HAVE_ERRNO_H)
+CHECK_INCLUDE_FILES("wchar.h" HAVE_WCHAR_H)
+CHECK_INCLUDE_FILES("langinfo.h" HAVE_LANGINFO_CODESET)
+
+CHECK_FUNCTION_EXISTS(gethostbyname HAVE_GETHOSTBYNAME)
+CHECK_FUNCTION_EXISTS(gethostname HAVE_GETHOSTNAME)
+CHECK_FUNCTION_EXISTS(getsockname HAVE_GETSOCKNAME)
+CHECK_FUNCTION_EXISTS(gettimeofday HAVE_GETTIMEOFDAY)
+CHECK_FUNCTION_EXISTS(inet_ntoa HAVE_INET_NTOA)
+CHECK_FUNCTION_EXISTS(memset HAVE_MEMSET)
+CHECK_FUNCTION_EXISTS(mkdir HAVE_MKDIR)
+CHECK_FUNCTION_EXISTS(select HAVE_SELECT)
+CHECK_FUNCTION_EXISTS(setlocale HAVE_SETLOCALE)
+CHECK_FUNCTION_EXISTS(socket HAVE_SOCKET)
+CHECK_FUNCTION_EXISTS(strcasecmp HAVE_STRCASECMP)
+CHECK_FUNCTION_EXISTS(strchr HAVE_STRCHR)
+CHECK_FUNCTION_EXISTS(strdup HAVE_STRDUP)
+CHECK_FUNCTION_EXISTS(strndup HAVE_STRNDUP)
+CHECK_FUNCTION_EXISTS(strncasecmp HAVE_STRNCASECMP)
+CHECK_FUNCTION_EXISTS(strpbrk HAVE_STRPBRK)
+CHECK_FUNCTION_EXISTS(strrchr HAVE_STRRCHR)
+CHECK_FUNCTION_EXISTS(strstr HAVE_STRSTR)
+
+
+#needs to be splitted in subdirectories
+# FIXME: weechat_gui_common MUST be the first lib in the list
+SET(STATIC_LIBS weechat_gui_common)
+
+# Check for Gettext
+IF(NOT DISABLE_NLS)
+ FIND_PACKAGE(Gettext)
+ IF(GETTEXT_FOUND)
+ ADD_DEFINITIONS(-DENABLE_NLS)
+ ENDIF(GETTEXT_FOUND)
+ENDIF(NOT DISABLE_NLS)
+
+# Check for GnuTLS
+IF(NOT DISABLE_GNUTLS)
+ FIND_PACKAGE(GnuTLS)
+
+ IF(GNUTLS_FOUND)
+ STRING(REGEX REPLACE "/[^/]*$" "" GNUTLS_LIBRARY_PATH "${GNUTLS_LIBRARY}")
+ ADD_DEFINITIONS(-DHAVE_GNUTLS)
+ INCLUDE_DIRECTORIES(${GNUTLS_INCLUDE_PATH})
+ SET(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -L${GNUTLS_LIBRARY_PATH}")
+ LIST(APPEND EXTRA_LIBS gnutls)
+ ENDIF(GNUTLS_FOUND)
+ENDIF(NOT DISABLE_GNUTLS)
+
+IF(NOT DISABLE_PLUGINS)
+ ADD_DEFINITIONS(-DPLUGINS)
+ LIST(APPEND STATIC_LIBS weechat_plugins)
+ ADD_SUBDIRECTORY( plugins )
+ENDIF(NOT DISABLE_PLUGINS)
+
+ADD_SUBDIRECTORY( common )
+List(APPEND STATIC_LIBS weechat_main)
+ADD_SUBDIRECTORY( irc )
+LIST(APPEND STATIC_LIBS weechat_irc)
+ADD_SUBDIRECTORY( gui )
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt
new file mode 100644
index 000000000..158374946
--- /dev/null
+++ b/src/common/CMakeLists.txt
@@ -0,0 +1,33 @@
+# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org>
+#
+# 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 2 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, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+SET(LIB_MAIN_SRC weechat.c weechat.h alias.c alias.h backtrace.c backtrace.h
+command.c command.h completion.c completion.h weelist.c weelist.h weeconfig.c
+weeconfig.h history.c history.h hotlist.c hotlist.h log.c log.h fifo.c fifo.h
+session.c session.h utf8.c utf8.h util.c util.h)
+
+# Check for flock support
+INCLUDE(CheckSymbolExists)
+CHECK_INCLUDE_FILES("sys/file.h" HAVE_SYS_FILE_H)
+CHECK_SYMBOL_EXISTS(flock "sys/file.h" HAVE_FLOCK)
+
+IF(ICONV_FOUND)
+ ADD_DEFINITIONS( -DHAVE_ICONV )
+ENDIF(ICONV_FOUND)
+
+INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR})
+ADD_LIBRARY(weechat_main STATIC ${LIB_MAIN_SRC})
diff --git a/src/common/util.c b/src/common/util.c
index b7c6907da..f6434700c 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -33,6 +33,14 @@
#include <iconv.h>
#endif
+#ifndef ICONV_CONST
+ #ifdef ICONV_2ARG_IS_CONST
+ #define ICONV_CONST const
+ #else
+ #define ICONV_CONST
+ #endif
+#endif
+
#include "weechat.h"
#include "utf8.h"
#include "weeconfig.h"
diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt
new file mode 100644
index 000000000..7835db2b4
--- /dev/null
+++ b/src/gui/CMakeLists.txt
@@ -0,0 +1,25 @@
+# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org>
+#
+# 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 2 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, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+SUBDIRS( curses )
+
+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
+gui-panel.h gui-window.h)
+
+INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR})
+ADD_LIBRARY(weechat_gui_common STATIC ${LIB_GUI_COMMON_SRC})
diff --git a/src/gui/curses/CMakeLists.txt b/src/gui/curses/CMakeLists.txt
new file mode 100644
index 000000000..6bfdf0bcd
--- /dev/null
+++ b/src/gui/curses/CMakeLists.txt
@@ -0,0 +1,42 @@
+# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org>
+#
+# 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 2 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, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+SET(WEECHAT_CURSES_SRC gui-curses-chat.c gui-curses-color.c gui-curses-infobar.c
+gui-curses-input.c gui-curses-keyboard.c gui-curses-main.c gui-curses-nicklist.c
+gui-curses-status.c gui-curses-window.c gui-curses-panel.c gui-curses.h)
+
+SET(EXECUTABLE weechat-curses)
+
+INCLUDE(CheckLibraryExists)
+# Check for ncurses and/or ncursesw
+CHECK_INCLUDE_FILES(ncursesw/ncurses.h NCURSESW_HEADERS)
+CHECK_LIBRARY_EXISTS(ncursesw initscr "" NCURSESW_FOUND)
+
+IF(NCURSESW_FOUND)
+ ADD_DEFINITIONS(-DHAVE_NCURSESW_CURSES_H)
+ LIST(APPEND EXTRA_LIBS ncursesw)
+ELSE(NCURSESW_FOUND)
+ CHECK_INCLUDE_FILES(ncurses.h NCURSES_HEADERS)
+ CHECK_LIBRARY_EXISTS(ncurses initscr "" NCURSES_FOUND)
+ LIST(APPEND EXTRA_LIBS ncurses)
+ENDIF(NCURSESW_FOUND)
+
+ADD_EXECUTABLE(${EXECUTABLE} ${WEECHAT_CURSES_SRC})
+INCLUDE_DIRECTORIES(.. ../../common ../../irc ../../plugins)
+TARGET_LINK_LIBRARIES(${EXECUTABLE} ${STATIC_LIBS} ${EXTRA_LIBS})
+
+INSTALL(TARGETS ${EXECUTABLE} RUNTIME DESTINATION bin)
diff --git a/src/irc/CMakeLists.txt b/src/irc/CMakeLists.txt
new file mode 100644
index 000000000..68d19060a
--- /dev/null
+++ b/src/irc/CMakeLists.txt
@@ -0,0 +1,26 @@
+# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org>
+#
+# 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 2 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, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+SET(LIB_IRC_SRC irc.h irc-commands.c irc-send.c irc-recv.c irc-server.c
+irc-channel.c irc-nick.c irc-mode.c irc-dcc.c irc-ignore.c irc-display.c)
+
+CHECK_INCLUDE_FILES("regex.h" HAVE_REGEX_H)
+CHECK_FUNCTION_EXISTS(regexec HAVE_REGEXEC)
+CHECK_FUNCTION_EXISTS(uname HAVE_UNAME)
+
+INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR})
+ADD_LIBRARY(weechat_irc STATIC ${LIB_IRC_SRC})
diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt
new file mode 100644
index 000000000..ec8d057a0
--- /dev/null
+++ b/src/plugins/CMakeLists.txt
@@ -0,0 +1,45 @@
+# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org>
+#
+# 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 2 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, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+SET(LIB_PLUGINS_SRC weechat-plugin.h plugins.h plugins.c plugins-interface.c
+plugins-config.h plugins-config.c)
+
+INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR})
+ADD_LIBRARY(weechat_plugins STATIC ${LIB_PLUGINS_SRC})
+
+INCLUDE(CheckIncludeFiles)
+INCLUDE(CheckFunctionExists)
+INCLUDE(CheckLibraryExists)
+
+IF(NOT DISABLE_ASPELL)
+ # Check for aspell libraries
+ FIND_PACKAGE(Aspell)
+ IF(ASPELL_FOUND)
+ ADD_SUBDIRECTORY( aspell )
+ ENDIF(ASPELL_FOUND)
+ENDIF(NOT DISABLE_ASPELL)
+
+IF (NOT DISABLE_CHARSET)
+ # Check for iconv support.
+ FIND_PACKAGE(Iconv)
+ IF(ICONV_FOUND)
+ ADD_DEFINITIONS( -DHAVE_ICONV )
+ ADD_SUBDIRECTORY( charset )
+ ENDIF(ICONV_FOUND)
+ENDIF(NOT DISABLE_CHARSET)
+
+ADD_SUBDIRECTORY( scripts )
diff --git a/src/plugins/aspell/CMakeLists.txt b/src/plugins/aspell/CMakeLists.txt
new file mode 100644
index 000000000..d38e75606
--- /dev/null
+++ b/src/plugins/aspell/CMakeLists.txt
@@ -0,0 +1,26 @@
+# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org>
+#
+# 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 2 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, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+ADD_LIBRARY(aspell MODULE weechat-aspell.h weechat-aspell.c)
+SET_TARGET_PROPERTIES(aspell PROPERTIES PREFIX "")
+
+IF(ASPELL_FOUND)
+ INCLUDE_DIRECTORIES(${ASPELL_INCLUDE_PATH})
+ TARGET_LINK_LIBRARIES(aspell ${ASPELL_LIBRARY})
+ENDIF(ASPELL_FOUND)
+
+INSTALL(TARGETS aspell LIBRARY DESTINATION lib/${PROJECT_NAME}/plugins)
diff --git a/src/plugins/charset/CMakeLists.txt b/src/plugins/charset/CMakeLists.txt
new file mode 100644
index 000000000..5068ea68a
--- /dev/null
+++ b/src/plugins/charset/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org>
+#
+# 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 2 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, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+ADD_LIBRARY(charset MODULE weechat-charset.h weechat-charset.c)
+SET_TARGET_PROPERTIES(charset PROPERTIES PREFIX "")
+
+IF(ICONV_FOUND)
+ INCLUDE_DIRECTORIES(${ICONV_INCLUDE_PATH})
+ IF(ICONV_LIBRARY)
+ TARGET_LINK_LIBRARIES(charset ${ICONV_LIBRARY})
+ ELSE(ICONV_LIBRARY)
+ TARGET_LINK_LIBRARIES(charset)
+ ENDIF(ICONV_LIBRARY)
+ENDIF(ICONV_FOUND)
+
+INSTALL(TARGETS charset LIBRARY DESTINATION lib/${PROJECT_NAME}/plugins)
diff --git a/src/plugins/scripts/CMakeLists.txt b/src/plugins/scripts/CMakeLists.txt
new file mode 100644
index 000000000..4831b6ffe
--- /dev/null
+++ b/src/plugins/scripts/CMakeLists.txt
@@ -0,0 +1,50 @@
+# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org>
+#
+# 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 2 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, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+SET(LIB_SCRIPTS_SRC weechat-script.c weechat-script.h)
+
+ADD_DEFINITIONS(${CMAKE_SHARED_LIBRARY_C_FLAGS})
+INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR})
+ADD_LIBRARY(weechat_scripts STATIC ${LIB_SCRIPTS_SRC})
+
+IF(NOT DISABLE_RUBY)
+ FIND_PACKAGE(Ruby)
+ IF(RUBY_FOUND)
+ ADD_SUBDIRECTORY( ruby )
+ ENDIF(RUBY_FOUND)
+ENDIF(NOT DISABLE_RUBY)
+
+IF(NOT DISABLE_LUA)
+ FIND_PACKAGE(Lua)
+ IF(LUA_FOUND)
+ ADD_SUBDIRECTORY( lua )
+ ENDIF(LUA_FOUND)
+ENDIF(NOT DISABLE_LUA)
+
+IF(NOT DISABLE_PYTHON)
+ FIND_PACKAGE(Python)
+ IF(PYTHON_FOUND)
+ ADD_SUBDIRECTORY( python )
+ ENDIF(PYTHON_FOUND)
+ENDIF(NOT DISABLE_PYTHON)
+
+IF(NOT DISABLE_PERL)
+ FIND_PACKAGE(Perl)
+ IF(PERL_FOUND)
+ ADD_SUBDIRECTORY( perl )
+ ENDIF(PERL_FOUND)
+ENDIF(NOT DISABLE_PERL)
diff --git a/src/plugins/scripts/lua/CMakeLists.txt b/src/plugins/scripts/lua/CMakeLists.txt
new file mode 100644
index 000000000..255de8cdc
--- /dev/null
+++ b/src/plugins/scripts/lua/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org>
+#
+# 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 2 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, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+ADD_LIBRARY(lua MODULE weechat-lua.c)
+SET_TARGET_PROPERTIES(lua PROPERTIES PREFIX "")
+
+IF(LUA_FOUND)
+ INCLUDE_DIRECTORIES(${LUA_INCLUDE_PATH} )
+ IF(LUA_LIBRARY AND LUALIB_LIBRARY)
+ TARGET_LINK_LIBRARIES(lua ${LUA_LIBRARY} ${LUALIB_LIBRARY} weechat_scripts)
+ ELSE(LUA_LIBRARY AND LUALIB_LIBRARY)
+ TARGET_LINK_LIBRARIES(lua ${LUA_LIBRARY} weechat_scripts)
+ ENDIF(LUA_LIBRARY AND LUALIB_LIBRARY)
+ENDIF(LUA_FOUND)
+
+INSTALL(TARGETS lua LIBRARY DESTINATION lib/${PROJECT_NAME}/plugins)
diff --git a/src/plugins/scripts/perl/CMakeLists.txt b/src/plugins/scripts/perl/CMakeLists.txt
new file mode 100644
index 000000000..9b5ed98ea
--- /dev/null
+++ b/src/plugins/scripts/perl/CMakeLists.txt
@@ -0,0 +1,38 @@
+# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org>
+#
+# 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 2 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, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+ADD_LIBRARY(perl MODULE weechat-perl.c)
+
+SET_TARGET_PROPERTIES(perl PROPERTIES PREFIX "")
+
+IF(PERL_FOUND)
+ ADD_DEFINITIONS(${PERL_CFLAGS})
+ INCLUDE_DIRECTORIES(${PERL_INCLUDE_PATH})
+ # ugly hack to force linking against Dynaloader.a
+ STRING(REGEX MATCH "/[^ $]*/DynaLoader.a" PERL_DYNALOADER ${PERL_LFLAGS})
+ IF(PERL_DYNALOADER)
+ STRING(REPLACE "${PERL_DYNALOADER}" "" PERL_LFLAGS "${PERL_LFLAGS}")
+ SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${PERL_LFLAGS}")
+ EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy ${PERL_DYNALOADER} ${CMAKE_CURRENT_BINARY_DIR}/libDynaLoader.a)
+ TARGET_LINK_LIBRARIES(perl ${PERL_LIBRARY} weechat_scripts ${CMAKE_CURRENT_BINARY_DIR}/libDynaLoader.a)
+ ELSE(PERL_DYNALOADER)
+ SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${PERL_LFLAGS}")
+ TARGET_LINK_LIBRARIES(perl ${PERL_LIBRARY} weechat_scripts)
+ ENDIF(PERL_DYNALOADER)
+ENDIF(PERL_FOUND)
+
+INSTALL(TARGETS perl LIBRARY DESTINATION lib/${PROJECT_NAME}/plugins)
diff --git a/src/plugins/scripts/python/CMakeLists.txt b/src/plugins/scripts/python/CMakeLists.txt
new file mode 100644
index 000000000..cf7e05533
--- /dev/null
+++ b/src/plugins/scripts/python/CMakeLists.txt
@@ -0,0 +1,28 @@
+# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org>
+#
+# 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 2 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, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+ADD_LIBRARY(python MODULE weechat-python.c)
+
+SET_TARGET_PROPERTIES(python PROPERTIES PREFIX "")
+
+IF(PYTHON_FOUND)
+ INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH})
+ SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${PYTHON_LFLAGS}")
+ TARGET_LINK_LIBRARIES(python ${PYTHON_LIBRARY} weechat_scripts)
+ENDIF(PYTHON_FOUND)
+
+INSTALL(TARGETS python LIBRARY DESTINATION lib/weechat/plugins)
diff --git a/src/plugins/scripts/ruby/CMakeLists.txt b/src/plugins/scripts/ruby/CMakeLists.txt
new file mode 100644
index 000000000..51ea89959
--- /dev/null
+++ b/src/plugins/scripts/ruby/CMakeLists.txt
@@ -0,0 +1,27 @@
+# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org>
+#
+# 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 2 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, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+ADD_LIBRARY(ruby MODULE weechat-ruby.c)
+
+SET_TARGET_PROPERTIES(ruby PROPERTIES PREFIX "")
+
+IF(RUBY_FOUND)
+ INCLUDE_DIRECTORIES(${RUBY_INCLUDE_PATH})
+ TARGET_LINK_LIBRARIES(ruby ${RUBY_LIBRARY} weechat_scripts)
+ENDIF(RUBY_FOUND)
+
+INSTALL(TARGETS ruby LIBRARY DESTINATION lib/${PROJECT_NAME}/plugins)
diff --git a/weechat/CMakeLists.txt b/weechat/CMakeLists.txt
new file mode 100644
index 000000000..6a8d92c3b
--- /dev/null
+++ b/weechat/CMakeLists.txt
@@ -0,0 +1,53 @@
+# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org>
+#
+# 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 2 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, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+PROJECT(weechat)
+
+SET(CMAKE_VERBOSE_MAKEFILE OFF)
+SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
+SET(CMAKE_SKIP_RPATH ON)
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -W")
+IF(PREFIX)
+ SET(CMAKE_INSTALL_PREFIX ${PREFIX} CACHE PATH "Install path prefix" FORCE)
+ENDIF(PREFIX)
+
+SET(VERSION 0.2.5-cvs)
+SET(PKG_STRING "${PROJECT_NAME} ${VERSION}")
+SET(LIBDIR ${CMAKE_INSTALL_PREFIX}/lib/weechat)
+SET(SHAREDIR ${CMAKE_INSTALL_PREFIX}/share/weechat)
+SET(LOCALEDIR ${CMAKE_INSTALL_PREFIX}/share/locale)
+STRING(REPLACE "\";\"" "\ " PKG_STRING ${PKG_STRING})
+
+OPTION(DISABLE_NCURSES "Disable Ncurses interface")
+OPTION(DISABLE_NLS "Disable Native Language Support")
+OPTION(DISABLE_GNUTLS "Disable SSLv3/TLS connection support")
+OPTION(DISABLE_PLUGINS "Disable Plugins support")
+OPTION(DISABLE_PERL "Disable Perl scripting language")
+OPTION(DISABLE_PYTHON "Disable Python scripting language")
+OPTION(DISABLE_RUBY "Disable Ruby scripting language")
+OPTION(DISABLE_LUA "Disable Lua scripting language")
+OPTION(DISABLE_ASPELL "Disable Aspell plugin")
+OPTION(DISABLE_CHARSET "Disable Charset plugin")
+OPTION(DISABLE_DOC "Disable Doc")
+
+ADD_SUBDIRECTORY( po )
+ADD_SUBDIRECTORY( src )
+IF(NOT DISABLE_DOC)
+ ADD_SUBDIRECTORY( doc )
+ENDIF(NOT DISABLE_DOC)
+
+CONFIGURE_FILE(config.h.cmake config.h @ONLY)
diff --git a/weechat/cmake/FindAspell.cmake b/weechat/cmake/FindAspell.cmake
new file mode 100644
index 000000000..575519768
--- /dev/null
+++ b/weechat/cmake/FindAspell.cmake
@@ -0,0 +1,49 @@
+# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org>
+#
+# 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 2 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, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+# - Find Aspell
+# This module finds if libaspell is installed and determines where
+# the include files and libraries are.
+#
+# This code sets the following variables:
+#
+# ASPELL_INCLUDE_PATH = path to where aspell.h can be found
+# ASPELL_LIBRARY = path to where libaspell.so* can be found
+
+IF (ASPELL_FOUND)
+ # Already in cache, be silent
+ SET(ASPELL_FIND_QUIETLY TRUE)
+ENDIF (ASPELL_FOUND)
+
+FIND_PATH(ASPELL_INCLUDE_PATH
+ NAMES aspell.h
+ PATHS /usr/include /usr/local/include /usr/pkg/include
+)
+
+FIND_LIBRARY(ASPELL_LIBRARY
+ NAMES aspell aspell-15
+ PATHS /lib /usr/lib /usr/local/lib /usr/pkg/lib
+)
+
+IF (ASPELL_INCLUDE_PATH AND ASPELL_LIBRARY)
+ SET(ASPELL_FOUND TRUE)
+ENDIF (ASPELL_INCLUDE_PATH AND ASPELL_LIBRARY)
+
+MARK_AS_ADVANCED(
+ ASPELL_INCLUDE_PATH
+ ASPELL_LIBRARY
+ )
diff --git a/weechat/cmake/FindGettext.cmake b/weechat/cmake/FindGettext.cmake
new file mode 100644
index 000000000..6cc6170ce
--- /dev/null
+++ b/weechat/cmake/FindGettext.cmake
@@ -0,0 +1,54 @@
+# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org>
+#
+# 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 2 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, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+# - Find Gettext
+# This module finds if gettext is installed and determines where
+# the include files and libraries are.
+#
+# This code sets the following variables:
+#
+# GETTEXT_FOUND = is gettext usable on system?
+
+IF(GETTEXT_FOUND)
+ # Already in cache, be silent
+ SET(GETTEXT_FIND_QUIETLY TRUE)
+ENDIF(GETTEXT_FOUND)
+
+INCLUDE(CheckIncludeFiles)
+INCLUDE(CheckLibraryExists)
+INCLUDE(CheckFunctionExists)
+
+CHECK_INCLUDE_FILES(libintl.h HAVE_LIBINTL_H)
+
+IF(HAVE_LIBINTL_H)
+ CHECK_FUNCTION_EXISTS(dgettext LIBC_HAS_DGETTEXT)
+ IF(LIBC_HAS_DGETTEXT)
+ SET(GETTEXT_FOUND TRUE)
+ ELSE(LIBC_HAS_DGETTEXT)
+ FIND_LIBRARY(LIBINTL_LIBRARY NAMES intl libintl
+ PATHS
+ /usr/lib
+ /usr/local/lib
+ )
+ IF(LIBINTL_LIBRARY)
+ CHECK_LIBRARY_EXISTS(${LIBINTL_LIBRARY} "dgettext" "" LIBINTL_HAS_DGETTEXT)
+ IF(LIBINTL_HAS_DGETTEXT)
+ SET(GETTEXT_FOUND TRUE)
+ ENDIF(LIBINTL_HAS_DGETTEXT)
+ ENDIF(LIBINTL_LIBRARY)
+ ENDIF(LIBC_HAS_DGETTEXT)
+ENDIF(HAVE_LIBINTL_H)
diff --git a/weechat/cmake/FindGnuTLS.cmake b/weechat/cmake/FindGnuTLS.cmake
new file mode 100644
index 000000000..6c19a6e5c
--- /dev/null
+++ b/weechat/cmake/FindGnuTLS.cmake
@@ -0,0 +1,70 @@
+# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org>
+#
+# 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 2 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, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+# - Find GnuTLS
+# This module finds if libgnutls is installed and determines where
+# the include files and libraries are.
+#
+# This code sets the following variables:
+#
+# GNUTLS_INCLUDE_PATH = path to where <gnutls/gnutls.h> can be found
+# GNUTLS_LIBRARY = path to where libgnutls.so* can be found
+# GNUTLS_CFLAGS = cflags to use to compile
+# GNUTLS_LDFLAGS = ldflags to use to compile
+
+IF(GNUTLS_INCLUDE_PATH AND GNUTLS_LIBRARY)
+ # Already in cache, be silent
+ set(GNUTLS_FIND_QUIETLY TRUE)
+ENDIF(GNUTLS_INCLUDE_PATH AND GNUTLS_LIBRARY)
+
+FIND_PROGRAM(GNUTLS_CONFIG_EXECUTABLE NAMES libgnutls-config)
+
+EXECUTE_PROCESS(COMMAND ${GNUTLS_CONFIG_EXECUTABLE} --prefix
+ OUTPUT_VARIABLE GNUTLS_PREFIX
+)
+
+EXECUTE_PROCESS(COMMAND ${GNUTLS_CONFIG_EXECUTABLE} --cflags
+ OUTPUT_VARIABLE GNUTLS_CFLAGS
+)
+
+EXECUTE_PROCESS(COMMAND ${GNUTLS_CONFIG_EXECUTABLE} --libs
+ OUTPUT_VARIABLE GNUTLS_LDFLAGS
+)
+
+SET(GNUTLS_POSSIBLE_INCLUDE_PATH "${GNUTLS_PREFIX}/include")
+SET(GNUTLS_POSSIBLE_LIB_DIR "${GNUTLS_PREFIX}/lib")
+
+FIND_PATH(GNUTLS_INCLUDE_PATH
+ NAMES gnutls/gnutls.h
+ PATHS GNUTLS_POSSIBLE_INCLUDE_PATH
+)
+
+FIND_LIBRARY(GNUTLS_LIBRARY
+ NAMES gnutls
+ PATHS GNUTLS_POSSIBLE_LIB_DIR
+)
+
+IF (GNUTLS_INCLUDE_PATH AND GNUTLS_LIBRARY)
+ SET(GNUTLS_FOUND TRUE)
+ENDIF (GNUTLS_INCLUDE_PATH AND GNUTLS_LIBRARY)
+
+MARK_AS_ADVANCED(
+ GNUTLS_INCLUDE_PATH
+ GNUTLS_LIBRARY
+ GNUTLS_CFLAGS
+ GNUTLS_LDFLAGS
+)
diff --git a/weechat/cmake/FindIconv.cmake b/weechat/cmake/FindIconv.cmake
new file mode 100644
index 000000000..5efbec59d
--- /dev/null
+++ b/weechat/cmake/FindIconv.cmake
@@ -0,0 +1,74 @@
+# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org>
+#
+# 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 2 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, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+# - Find Iconv
+# This module finds if libiconv is installed and determines where
+# the include files and libraries are.
+#
+# This code sets the following variables:
+#
+# ICONV_INCLUDE_PATH = path to where <iconv.h> can be found
+# ICONV_LIBRARY = path to where libiconv.so* can be found (on non glibc based systems)
+#
+# ICONV_FOUND = is iconv usable on system?
+
+IF(ICONV_FOUND)
+ # Already in cache, be silent
+ set(ICONV_FIND_QUIETLY TRUE)
+ENDIF(ICONV_FOUND)
+
+FIND_PATH(ICONV_INCLUDE_PATH
+ NAMES iconv.h
+ PATHS /usr/include /usr/local/include /usr/pkg/include
+)
+
+FIND_LIBRARY(ICONV_LIBRARY
+ NAMES iconv
+ PATHS /lib /usr/lib /usr/local/lib /usr/pkg/lib
+)
+
+IF(ICONV_INCLUDE_PATH)
+ IF(ICONV_LIBRARY)
+ STRING(REGEX REPLACE "/[^/]*$" "" ICONV_LIB_PATH "${ICONV_LIBRARY}")
+ CHECK_LIBRARY_EXISTS(iconv libiconv_open ${ICONV_LIB_PATH} ICONV_FOUND)
+ IF(NOT ICONV_FOUND)
+ CHECK_LIBRARY_EXISTS(iconv iconv_open ${ICONV_LIB_PATH} ICONV_FOUND)
+ ENDIF(NOT ICONV_FOUND)
+ ELSE(ICONV_LIBRARY)
+ CHECK_FUNCTION_EXISTS(iconv_open ICONV_FOUND)
+ ENDIF(ICONV_LIBRARY)
+ENDIF(ICONV_INCLUDE_PATH)
+
+include(CheckCSourceCompiles)
+SET(CMAKE_REQUIRED_FLAGS -Werror)
+check_c_source_compiles("
+ #include <iconv.h>
+ int main(){
+ iconv_t conv = 0;
+ const char* in = 0;
+ size_t ilen = 0;
+ char* out = 0;
+ size_t olen = 0;
+ iconv(conv, &in, &ilen, &out, &olen);
+ return 0;
+ }
+" ICONV_2ARG_IS_CONST)
+MARK_AS_ADVANCED(
+ ICONV_INCLUDE_PATH
+ ICONV_LIBRARY
+ ICONV_FOUND
+)
diff --git a/weechat/cmake/FindLua.cmake b/weechat/cmake/FindLua.cmake
new file mode 100644
index 000000000..7670be9bc
--- /dev/null
+++ b/weechat/cmake/FindLua.cmake
@@ -0,0 +1,82 @@
+# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org>
+#
+# 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 2 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, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+# - Find Lua
+# This module finds if liblua is installed and determines where
+# the include files and libraries are.
+#
+# This code sets the following variables:
+#
+# LUA_INCLUDE_PATH = path to where <lua.h> can be found
+# LUA_LIBRARY = path to where liblua.so* (and liblualib.so* for lua <can be found (on non glibc based systems)
+#
+# LUA_FOUND = is liblua usable on system?
+
+IF(LUA_FOUND)
+ # Already in cache, be silent
+ SET(LUA_FIND_QUIETLY TRUE)
+ENDIF(LUA_FOUND)
+
+FIND_PATH(
+ LUA51_INCLUDE_PATH lua.h
+ PATHS /usr/include /usr/local/include /usr/pkg/include
+ PATH_SUFFIXES lua51 lua5.1 lua-5.1
+)
+
+FIND_LIBRARY(
+ LUA51_LIBRARY NAMES lua51 lua5.1 lua-5.1
+ PATHS /lib /usr/lib /usr/local/lib /usr/pkg/lib
+)
+
+IF(LUA51_INCLUDE_PATH AND LUA51_LIBRARY)
+ SET(LUA_INCLUDE_PATH "${LUA51_INCLUDE_PATH}")
+ SET(LUA_LIBRARY "${LUA51_LIBRARY}")
+ SET(LUA_VERSION "5.1")
+ SET(LUA_FOUND TRUE)
+ELSE(LUA51_INCLUDE_PATH AND LUA51_LIBRARY)
+ FIND_PATH(
+ LUA50_INCLUDE_PATH lua.h
+ PATHS /usr/include /usr/local/include /usr/pkg/include
+ PATH_SUFFIXES lua50 lua5.0 lua-5.0 lua
+ )
+
+ FIND_LIBRARY(
+ LUA50_LIBRARY NAMES lua50 lua5.0 lua-5.0 lua
+ PATHS /lib /usr/lib /usr/local/lib /usr/pkg/lib
+ )
+
+ FIND_LIBRARY(
+ LUALIB50_LIBRARY NAMES lualib50 lualib5.0 lualib-5.0 lualib
+ PATHS /lib /usr/lib /usr/local/lib /usr/pkg/lib
+ )
+
+ IF(LUA50_INCLUDE_PATH AND LUA50_LIBRARY AND LUALIB50_LIBRARY)
+ SET(LUA_INCLUDE_PATH "${LUA50_INCLUDE_PATH}")
+ SET(LUA_LIBRARY "${LUA50_LIBRARY}")
+ SET(LUALIB_LIBRARY "${LUALIB50_LIBRARY}")
+ SET(LUA_VERSION "5.0")
+ SET(LUA_FOUND TRUE)
+ ENDIF(LUA50_INCLUDE_PATH AND LUA50_LIBRARY AND LUALIB50_LIBRARY)
+ENDIF(LUA51_INCLUDE_PATH AND LUA51_LIBRARY)
+
+
+MARK_AS_ADVANCED(
+ LUA_INCLUDE_PATH
+ LUA_LIBRARY
+ LUALIB_LIBRARY
+# LUA_VERSION
+)
diff --git a/weechat/cmake/FindPerl.cmake b/weechat/cmake/FindPerl.cmake
new file mode 100644
index 000000000..fe45770d4
--- /dev/null
+++ b/weechat/cmake/FindPerl.cmake
@@ -0,0 +1,83 @@
+# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org>
+#
+# 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 2 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, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+# - Find Perl libraries
+# This module finds if Perl is installed and determines where the include files
+# and libraries are. It also determines what the name of the library is. This
+# code sets the following variables:
+#
+# PERL_EXECUTABLE = full path to the perl binary
+# PERL_INCLUDE_PATH = path to where perl.h can be found
+# PERL_LIBRARY = path to where libperl.so* can be found
+# PERL_CFLAGS = perl compiler options for compiling
+# PERL_LFLAGS = perl compiler options for linking
+
+IF(PERL_FOUND)
+ # Already in cache, be silent
+ SET(PERL_FIND_QUIETLY TRUE)
+ENDIF(PERL_FOUND)
+
+FIND_PROGRAM(PERL_EXECUTABLE
+ NAMES perl perl5
+ PATHS /usr/bin /usr/local/bin /usr/pkg/bin
+ )
+
+IF(PERL_EXECUTABLE)
+
+ EXECUTE_PROCESS(
+ COMMAND ${PERL_EXECUTABLE} -MConfig -e "print \"\$Config{archlibexp}/CORE\""
+ OUTPUT_VARIABLE PERL_INTERNAL_DIR
+ )
+
+ EXECUTE_PROCESS(
+ COMMAND ${PERL_EXECUTABLE} -MExtUtils::Embed -e ccopts
+ OUTPUT_VARIABLE PERL_CFLAGS
+ )
+
+ EXECUTE_PROCESS(
+ COMMAND ${PERL_EXECUTABLE} -MExtUtils::Embed -e ldopts
+ OUTPUT_VARIABLE PERL_LFLAGS
+ )
+
+ # remove the new lines from the output by replacing them with empty strings
+ STRING(REPLACE "\n" "" PERL_INTERNAL_DIR "${PERL_INTERNAL_DIR}")
+ STRING(REPLACE "\n" "" PERL_CFLAGS "${PERL_CFLAGS}")
+ STRING(REPLACE "\n" "" PERL_LFLAGS "${PERL_LFLAGS}")
+
+ FIND_PATH(PERL_INCLUDE_PATH
+ NAMES perl.h
+ PATHS ${PERL_INTERNAL_DIR}
+ )
+
+ FIND_LIBRARY(PERL_LIBRARY
+ NAMES perl
+ PATHS /usr/lib /usr/local/lib /usr/pkg/lib ${PERL_INTERNAL_DIR}
+ )
+
+ IF(PERL_LIBRARY AND PERL_INCLUDE_PATH)
+ SET(PERL_FOUND TRUE)
+ ENDIF(PERL_LIBRARY AND PERL_INCLUDE_PATH)
+
+ MARK_AS_ADVANCED(
+ PERL_EXECUTABLE
+ PERL_INCLUDE_PATH
+ PERL_LIBRARY
+ PERL_CFLAGS
+ PERL_LFLAGS
+ )
+ENDIF(PERL_EXECUTABLE)
+
diff --git a/weechat/cmake/FindPython.cmake b/weechat/cmake/FindPython.cmake
new file mode 100644
index 000000000..73fc98ee3
--- /dev/null
+++ b/weechat/cmake/FindPython.cmake
@@ -0,0 +1,80 @@
+# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org>
+#
+# 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 2 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, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+# - Find Python
+# This module finds if Python is installed and determines where the include files
+# and libraries are. It also determines what the name of the library is. This
+# code sets the following variables:
+#
+# PYTHON_EXECUTABLE = full path to the python binary
+# PYTHON_INCLUDE_PATH = path to where python.h can be found
+# PYTHON_LIBRARY = path to where libpython.so* can be found
+# PYTHON_LFLAGS = python compiler options for linking
+
+IF(PYTHON_FOUND)
+ # Already in cache, be silent
+ SET(PYTHON_FIND_QUIETLY TRUE)
+ENDIF(PYTHON_FOUND)
+
+FIND_PROGRAM(PYTHON_EXECUTABLE
+ NAMES python python2.5 python2.4 python2.3 python2.2
+ PATHS /usr/bin /usr/local/bin /usr/pkg/bin
+ )
+
+IF(PYTHON_EXECUTABLE)
+ EXECUTE_PROCESS(
+ COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import *; print get_config_var('CONFINCLUDEPY')"
+ OUTPUT_VARIABLE PYTHON_INC_DIR
+ )
+
+ EXECUTE_PROCESS(
+ COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import *; print get_config_var('LIBPL')"
+ OUTPUT_VARIABLE PYTHON_POSSIBLE_LIB_PATH
+ )
+
+ EXECUTE_PROCESS(
+ COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import *; print get_config_var('LINKFORSHARED')"
+ OUTPUT_VARIABLE PYTHON_LFLAGS
+ )
+
+ # remove the new lines from the output by replacing them with empty strings
+ STRING(REPLACE "\n" "" PYTHON_INC_DIR "${PYTHON_INC_DIR}")
+ STRING(REPLACE "\n" "" PYTHON_POSSIBLE_LIB_PATH "${PYTHON_POSSIBLE_LIB_PATH}")
+ STRING(REPLACE "\n" "" PYTHON_LFLAGS "${PYTHON_LFLAGS}")
+
+ FIND_PATH(PYTHON_INCLUDE_PATH
+ NAMES Python.h
+ PATHS ${PYTHON_INC_DIR}
+ )
+
+ FIND_LIBRARY(PYTHON_LIBRARY
+ NAMES python python2.5 python2.4 python2.3 python2.2
+ PATHS ${PYTHON_POSSIBLE_LIB_PATH}
+ )
+
+ IF(PYTHON_LIBRARY AND PYTHON_INCLUDE_PATH)
+ SET(PYTHON_FOUND TRUE)
+ ENDIF(PYTHON_LIBRARY AND PYTHON_INCLUDE_PATH)
+
+ MARK_AS_ADVANCED(
+ PYTHON_EXECUTABLE
+ PYTHON_INCLUDE_PATH
+ PYTHON_LIBRARY
+ PYTHON_LFLAGS
+ )
+
+ENDIF(PYTHON_EXECUTABLE)
diff --git a/weechat/cmake/FindRuby.cmake b/weechat/cmake/FindRuby.cmake
new file mode 100644
index 000000000..ab55682e0
--- /dev/null
+++ b/weechat/cmake/FindRuby.cmake
@@ -0,0 +1,78 @@
+# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org>
+#
+# 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 2 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, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+# - Find Ruby
+# This module finds if Ruby is installed and determines where the include files
+# and libraries are. It also determines what the name of the library is. This
+# code sets the following variables:
+#
+# RUBY_EXECUTABLE = full path to the ruby binary
+# RUBY_INCLUDE_PATH = path to where ruby.h can be found
+# RUBY_LIBRARY = path to where libruby.so* can be found
+
+IF(RUBY_FOUND)
+ # Already in cache, be silent
+ SET(RUBY_FIND_QUIETLY TRUE)
+ENDIF(RUBY_FOUND)
+
+FIND_PROGRAM(RUBY_EXECUTABLE
+ NAMES ruby ruby1.9 ruby19 ruby1.8 ruby18 ruby1.6 ruby16
+ PATHS /usr/bin /usr/local/bin /usr/pkg/bin
+ )
+
+IF(RUBY_EXECUTABLE)
+ EXECUTE_PROCESS(
+ COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "puts Config::CONFIG['archdir']"
+ OUTPUT_VARIABLE RUBY_ARCH_DIR
+ )
+
+ EXECUTE_PROCESS(
+ COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "puts Config::CONFIG['libdir']"
+ OUTPUT_VARIABLE RUBY_POSSIBLE_LIB_PATH
+ )
+
+ EXECUTE_PROCESS(
+ COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "puts Config::CONFIG['rubylibdir']"
+ OUTPUT_VARIABLE RUBY_RUBY_LIB_PATH
+ )
+
+ # remove the new lines from the output by replacing them with empty strings
+ STRING(REPLACE "\n" "" RUBY_ARCH_DIR "${RUBY_ARCH_DIR}")
+ STRING(REPLACE "\n" "" RUBY_POSSIBLE_LIB_PATH "${RUBY_POSSIBLE_LIB_PATH}")
+ STRING(REPLACE "\n" "" RUBY_RUBY_LIB_PATH "${RUBY_RUBY_LIB_PATH}")
+
+ FIND_PATH(RUBY_INCLUDE_PATH
+ NAMES ruby.h
+ PATHS ${RUBY_ARCH_DIR}
+ )
+
+ FIND_LIBRARY(RUBY_LIBRARY
+ NAMES ruby ruby1.6 ruby16 ruby1.8 ruby18 ruby1.9 ruby19
+ PATHS ${RUBY_POSSIBLE_LIB_PATH} ${RUBY_RUBY_LIB_PATH}
+ )
+
+ IF(RUBY_LIBRARY AND RUBY_INCLUDE_PATH)
+ SET(RUBY_FOUND TRUE)
+ ENDIF(RUBY_LIBRARY AND RUBY_INCLUDE_PATH)
+
+ MARK_AS_ADVANCED(
+ RUBY_EXECUTABLE
+ RUBY_LIBRARY
+ RUBY_INCLUDE_PATH
+ )
+
+ENDIF(RUBY_EXECUTABLE)
diff --git a/weechat/config.h.cmake b/weechat/config.h.cmake
new file mode 100644
index 000000000..37100ce04
--- /dev/null
+++ b/weechat/config.h.cmake
@@ -0,0 +1,29 @@
+#cmakedefine HAVE_ARPA_INET_H
+#cmakedefine HAVE_LIBINTL_H
+#cmakedefine HAVE_LIMITS_H
+#cmakedefine HAVE_LOCALE_H
+#cmakedefine HAVE_NETDB_H
+#cmakedefine HAVE_NETINET_IN_H
+#cmakedefine HAVE_STDLIB_H
+#cmakedefine HAVE_STRING_H
+#cmakedefine HAVE_SYS_SOCKET_H
+#cmakedefine HAVE_SYS_TIME_H
+#cmakedefine HAVE_SYS_TYPES_H
+#cmakedefine HAVE_UNISTD_H
+#cmakedefine HAVE_PWD_H
+#cmakedefine HAVE_ERRNO_H
+#cmakedefine HAVE_REGEX_H
+#cmakedefine HAVE_WCHAR_H
+#cmakedefine HAVE_SYS_FILE_H
+#cmakedefine HAVE_FLOCK
+#cmakedefine HAVE_LANGINFO_CODESET
+#cmakedefine HAVE_STRNDUP
+#cmakedefine ICONV_2ARG_IS_CONST 1
+#define PACKAGE_VERSION "@VERSION@"
+#define PACKAGE "@PROJECT_NAME@"
+#define PACKAGE_NAME "@PROJECT_NAME@"
+#define PACKAGE_STRING "@PKG_STRING@"
+#define WEECHAT_LIBDIR "@LIBDIR@"
+#define WEECHAT_SHAREDIR "@SHAREDIR@"
+#define LOCALEDIR "@LOCALEDIR@"
+#define _GNU_SOURCE 1
diff --git a/weechat/doc/CMakeLists.txt b/weechat/doc/CMakeLists.txt
new file mode 100644
index 000000000..f01ffe866
--- /dev/null
+++ b/weechat/doc/CMakeLists.txt
@@ -0,0 +1,167 @@
+# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org>
+#
+# 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 2 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, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+SET(DOC_LANGS
+ cs
+ de
+ en
+ fr
+ pl
+ ru
+ sco
+ )
+
+FIND_PROGRAM(
+ COPY cp
+ PATHS /bin /usr/bin /usr/local/bin /usr/pkg/bin
+)
+
+FIND_PROGRAM(
+ XSLTPROC xsltproc
+ PATHS /bin /usr/bin /usr/local/bin /usr/pkg/bin
+)
+
+FIND_PROGRAM(
+ DBLATEX dblatex
+ PATHS /bin /usr/bin /usr/local/bin /usr/pkg/bin
+ )
+
+FIND_FILE(DOC_XSL_PREFIX chunk.xsl PATHS
+ /usr/share/xml/docbook/stylesheet/nwalsh/
+ /usr/share/xml/docbook/xsl-stylesheets-1.69/
+ PATH_SUFFIXES html
+ DOC "Path to nwalsh xsl stylesheet"
+ )
+STRING(REPLACE "/html/chunk.xsl" "" DOC_XSL_PREFIX "${DOC_XSL_PREFIX}")
+
+IF(XSLTPROC AND DOC_XSL_PREFIX AND COPY)
+ SET(BUILD_HTML TRUE)
+ENDIF(XSLTPROC AND DOC_XSL_PREFIX AND COPY)
+
+IF(DBLATEX AND COPY)
+ SET(BUILD_PDF TRUE)
+ENDIF(DBLATEX AND COPY)
+
+IF(BUILD_HTML)
+ CONFIGURE_FILE(
+ ${CMAKE_CURRENT_SOURCE_DIR}/weechat-html.xsl.in
+ ${CMAKE_CURRENT_BINARY_DIR}/weechat-html.xsl
+ @ONLY
+ )
+
+ CONFIGURE_FILE(
+ ${CMAKE_CURRENT_SOURCE_DIR}/weechat-html-one.xsl.in
+ ${CMAKE_CURRENT_BINARY_DIR}/weechat-html-one.xsl
+ @ONLY
+ )
+ENDIF(BUILD_HTML)
+
+
+IF(BUILD_HTML OR BUILD_PDF)
+ EXECUTE_PROCESS(
+ COMMAND date "+%F %T"
+ OUTPUT_VARIABLE DOC_DATE
+ )
+ STRING(REPLACE "\n" "" DOC_DATE "${DOC_DATE}")
+
+ CONFIGURE_FILE(
+ ${CMAKE_CURRENT_SOURCE_DIR}/date.xml.in
+ ${CMAKE_CURRENT_BINARY_DIR}/date.xml
+ @ONLY
+ )
+
+ FOREACH(dlang ${DOC_LANGS})
+ IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/weechat.${dlang}.xml)
+
+ IF(BUILD_HTML)
+ FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/${dlang})
+ FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/${dlang}-build)
+ FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html-one/${dlang})
+
+ ADD_CUSTOM_COMMAND(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/html/${dlang}/index.html ${CMAKE_CURRENT_BINARY_DIR}/html-one/${dlang}/weechat.${dlang}.html
+ COMMAND ${COPY} ARGS "${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/weechat.${dlang}.xml" "${CMAKE_CURRENT_BINARY_DIR}/html/${dlang}-build"
+ COMMAND ${COPY} ARGS "${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/config.xml" "${CMAKE_CURRENT_BINARY_DIR}/html/${dlang}-build"
+ COMMAND ${COPY} ARGS "${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/irc_commands.xml" "${CMAKE_CURRENT_BINARY_DIR}/html/${dlang}-build"
+ COMMAND ${COPY} ARGS "${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/key_functions.xml" "${CMAKE_CURRENT_BINARY_DIR}/html/${dlang}-build"
+ COMMAND ${COPY} ARGS "${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/weechat_commands.xml" "${CMAKE_CURRENT_BINARY_DIR}/html/${dlang}-build"
+ COMMAND ${COPY} ARGS "${CMAKE_CURRENT_BINARY_DIR}/date.xml" "${CMAKE_CURRENT_BINARY_DIR}/html/${dlang}-build"
+ COMMAND ${COPY} ARGS "${CMAKE_CURRENT_SOURCE_DIR}/weechat-doc.css" "${CMAKE_CURRENT_BINARY_DIR}/html/${dlang}"
+ COMMAND ${COPY} ARGS "${CMAKE_CURRENT_SOURCE_DIR}/weechat-doc.css" "${CMAKE_CURRENT_BINARY_DIR}/html-one/${dlang}"
+ COMMAND ${XSLTPROC} ARGS -o ${CMAKE_CURRENT_BINARY_DIR}/html/${dlang}/ ${CMAKE_CURRENT_BINARY_DIR}/weechat-html.xsl ${CMAKE_CURRENT_BINARY_DIR}/html/${dlang}-build/weechat.${dlang}.xml
+ COMMAND ${XSLTPROC} ARGS -o ${CMAKE_CURRENT_BINARY_DIR}/html-one/${dlang}/weechat.${dlang}.html ${CMAKE_CURRENT_BINARY_DIR}/weechat-html-one.xsl ${CMAKE_CURRENT_BINARY_DIR}/html/${dlang}-build/weechat.${dlang}.xml
+ DEPENDS
+ ${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/weechat.${dlang}.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/config.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/irc_commands.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/key_functions.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/weechat_commands.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/date.xml.in
+ ${CMAKE_CURRENT_SOURCE_DIR}/weechat-html-one.xsl.in
+ ${CMAKE_CURRENT_SOURCE_DIR}/weechat-html.xsl.in
+ ${CMAKE_CURRENT_SOURCE_DIR}/date.xml.in
+ ${CMAKE_CURRENT_SOURCE_DIR}/weechat-doc.css
+ COMMENT "Building html doc (${dlang})"
+ )
+ ADD_CUSTOM_TARGET(doc-html-${dlang} ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/html/${dlang}/index.html)
+ ADD_CUSTOM_TARGET(doc-html-one-${dlang} ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/html-one/${dlang}/weechat.${dlang}.html)
+ INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/${dlang} DESTINATION share/doc/${PROJECT_NAME}/html)
+
+ ENDIF(BUILD_HTML)
+
+ IF(BUILD_PDF)
+ FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/pdf/${dlang})
+ FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/pdf/${dlang}-build)
+
+ ADD_CUSTOM_COMMAND(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/pdf/${dlang}/weechat.${dlang}.pdf
+ COMMAND ${COPY} ARGS "${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/weechat.${dlang}.xml" "${CMAKE_CURRENT_BINARY_DIR}/pdf/${dlang}-build"
+ COMMAND ${COPY} ARGS "${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/config.xml" "${CMAKE_CURRENT_BINARY_DIR}/pdf/${dlang}-build"
+ COMMAND ${COPY} ARGS "${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/irc_commands.xml" "${CMAKE_CURRENT_BINARY_DIR}/pdf/${dlang}-build"
+ COMMAND ${COPY} ARGS "${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/key_functions.xml" "${CMAKE_CURRENT_BINARY_DIR}/pdf/${dlang}-build"
+ COMMAND ${COPY} ARGS "${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/weechat_commands.xml" "${CMAKE_CURRENT_BINARY_DIR}/pdf/${dlang}-build"
+ COMMAND ${COPY} ARGS "${CMAKE_CURRENT_BINARY_DIR}/date.xml" "${CMAKE_CURRENT_BINARY_DIR}/pdf/${dlang}-build"
+ COMMAND ${DBLATEX} ARGS -c ${CMAKE_CURRENT_SOURCE_DIR}/dblatex.conf -o ${CMAKE_CURRENT_BINARY_DIR}/pdf/${dlang}/weechat.${dlang}.pdf ${CMAKE_CURRENT_BINARY_DIR}/pdf/${dlang}-build/weechat.${dlang}.xml
+ DEPENDS
+ ${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/weechat.${dlang}.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/config.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/irc_commands.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/key_functions.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/weechat_commands.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/date.xml.in
+ ${CMAKE_CURRENT_SOURCE_DIR}/weechat-html-one.xsl.in
+ ${CMAKE_CURRENT_SOURCE_DIR}/date.xml.in
+ COMMENT "Building pdf doc (${dlang})"
+ )
+ ADD_CUSTOM_TARGET(doc-pdf-${dlang} ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/pdf/${dlang}/weechat.${dlang}.pdf)
+ INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/pdf/${dlang}/weechat.${dlang}.pdf DESTINATION share/doc/${PROJECT_NAME})
+
+ ENDIF(BUILD_PDF)
+
+ ENDIF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/weechat.${dlang}.xml)
+
+ ENDFOREACH(dlang ${DOC_LANGS})
+
+ENDIF(BUILD_HTML OR BUILD_PDF)
+
+FOREACH(dlang ${DOC_LANGS})
+ IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/weechat_quickstart.${dlang}.txt)
+ INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/weechat_quickstart.${dlang}.txt DESTINATION share/doc/${PROJECT_NAME})
+ ENDIF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/weechat_quickstart.${dlang}.txt)
+ENDFOREACH(dlang ${DOC_LANGS})
+
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/weechat-curses.1 DESTINATION share/man/man1)
diff --git a/weechat/po/CMakeLists.txt b/weechat/po/CMakeLists.txt
new file mode 100644
index 000000000..19629a0f5
--- /dev/null
+++ b/weechat/po/CMakeLists.txt
@@ -0,0 +1,77 @@
+# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org>
+#
+# 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 2 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, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+SET(PO_FILES
+ fr.po
+ es.po
+ cs.po
+ hu.po
+ de.po
+ ru.po
+ )
+
+SET(COPYRIGHT_HOLDER "WeeChat Team")
+SET(BUGS_ADDRESS "flashcode@flashtux.org")
+SET(POT_FILE ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pot)
+
+INCLUDE(srcfiles.cmake)
+
+# Looking for xgettext, msgmerge and msgfmt
+FIND_PROGRAM(XGETTEXT_EXECUTABLE xgettext)
+FIND_PROGRAM(MSGMERGE_EXECUTABLE msgmerge)
+FIND_PROGRAM(MSGFMT_EXECUTABLE msgfmt)
+
+IF(XGETTEXT_EXECUTABLE AND MSGMERGE_EXECUTABLE AND MSGFMT_EXECUTABLE)
+
+ # Create PO template file weechat.pot
+ SET(SRC_FILES)
+ SET(POT_DEPENDS)
+
+ FOREACH(srcfile ${WEECHAT_SOURCES})
+ SET(SRC_FILES ${SRC_FILES} ${srcfile})
+ SET(POT_DEPENDS ${POT_DEPENDS} ${CMAKE_SOURCE_DIR}/${srcfile})
+ ENDFOREACH(srcfile ${WEECHAT_SOURCES})
+
+ ADD_CUSTOM_COMMAND(
+ OUTPUT ${POT_FILE}
+ COMMAND ${XGETTEXT_EXECUTABLE}
+ ARGS -o ${POT_FILE} --keyword='_' --keyword='N_' --directory=${CMAKE_SOURCE_DIR} --omit-header --msgid-bugs-address=${BUGS_ADDRESS} --copyright-holder=${COPYRIGHT_HOLDER} ${SRC_FILES}
+ DEPENDS ${POT_DEPENDS}
+ COMMENT "Generating PO template file"
+ )
+
+ # Update .po files and compile them to binary .gmo files
+
+ SET(GMO_FILES)
+ FOREACH(pofile ${PO_FILES})
+ GET_FILENAME_COMPONENT(polang ${pofile} NAME_WE)
+
+ SET(gmofile ${CMAKE_CURRENT_BINARY_DIR}/${polang}.gmo)
+ ADD_CUSTOM_COMMAND(
+ OUTPUT ${gmofile}
+ COMMAND ${MSGMERGE_EXECUTABLE} ARGS --quiet -s -o ${CMAKE_CURRENT_BINARY_DIR}/${pofile} ${CMAKE_CURRENT_SOURCE_DIR}/${pofile} ${POT_FILE}
+ COMMAND ${MSGFMT_EXECUTABLE} ARGS -o ${gmofile} ${CMAKE_CURRENT_BINARY_DIR}/${pofile}
+ DEPENDS ${POT_FILE} ${CMAKE_CURRENT_SOURCE_DIR}/${pofile}
+ COMMENT "Compiling locales (${polang})"
+ )
+
+ INSTALL(FILES ${gmofile} DESTINATION share/locale/${polang}/LC_MESSAGES RENAME ${PROJECT_NAME}.mo)
+ SET(GMO_FILES ${GMO_FILES} ${gmofile})
+ ENDFOREACH(pofile ${PO_FILES})
+ ADD_CUSTOM_TARGET(translations ALL DEPENDS ${GMO_FILES})
+
+ENDIF(XGETTEXT_EXECUTABLE AND MSGMERGE_EXECUTABLE AND MSGFMT_EXECUTABLE)
diff --git a/weechat/po/srcfiles.cmake b/weechat/po/srcfiles.cmake
new file mode 100644
index 000000000..8c368f10d
--- /dev/null
+++ b/weechat/po/srcfiles.cmake
@@ -0,0 +1,82 @@
+SET(WEECHAT_SOURCES
+src/irc/irc-mode.c
+src/irc/irc-nick.c
+src/irc/irc-server.c
+src/irc/irc-channel.c
+src/irc/irc-commands.c
+src/irc/irc-display.c
+src/irc/irc-send.c
+src/irc/irc-recv.c
+src/irc/irc-dcc.c
+src/irc/irc-ignore.c
+src/irc/irc.h
+src/plugins/plugins.c
+src/plugins/plugins.h
+src/plugins/plugins-config.c
+src/plugins/plugins-config.h
+src/plugins/plugins-interface.c
+src/plugins/weechat-plugin.h
+src/gui/curses/gui-curses-chat.c
+src/gui/curses/gui-curses-color.c
+src/gui/curses/gui-curses-infobar.c
+src/gui/curses/gui-curses-input.c
+src/gui/curses/gui-curses-keyboard.c
+src/gui/curses/gui-curses-main.c
+src/gui/curses/gui-curses-nicklist.c
+src/gui/curses/gui-curses-panel.c
+src/gui/curses/gui-curses-status.c
+src/gui/curses/gui-curses-window.c
+src/gui/curses/gui-curses.h
+src/gui/gtk/gui-gtk-chat.c
+src/gui/gtk/gui-gtk-color.c
+src/gui/gtk/gui-gtk-infobar.c
+src/gui/gtk/gui-gtk-input.c
+src/gui/gtk/gui-gtk-keyboard.c
+src/gui/gtk/gui-gtk-main.c
+src/gui/gtk/gui-gtk-nicklist.c
+src/gui/gtk/gui-gtk-panel.c
+src/gui/gtk/gui-gtk-status.c
+src/gui/gtk/gui-gtk-window.c
+src/gui/gtk/gui-gtk.h
+src/gui/gui-action.c
+src/gui/gui-buffer.c
+src/gui/gui-common.c
+src/gui/gui-keyboard.c
+src/gui/gui-log.c
+src/gui/gui-panel.c
+src/gui/gui-window.c
+src/gui/gui.h
+src/gui/gui-buffer.h
+src/gui/gui-color.h
+src/gui/gui-keyboard.h
+src/gui/gui-panel.h
+src/gui/gui-window.h
+src/common/alias.c
+src/common/alias.h
+src/common/backtrace.c
+src/common/backtrace.h
+src/common/command.c
+src/common/command.h
+src/common/completion.c
+src/common/completion.h
+src/common/fifo.c
+src/common/fifo.h
+src/common/history.c
+src/common/history.h
+src/common/hotlist.c
+src/common/hotlist.h
+src/common/log.c
+src/common/log.h
+src/common/session.c
+src/common/session.h
+src/common/utf8.c
+src/common/utf8.h
+src/common/util.c
+src/common/util.h
+src/common/weechat.c
+src/common/weechat.h
+src/common/weeconfig.c
+src/common/weeconfig.h
+src/common/weelist.c
+src/common/weelist.h
+)
diff --git a/weechat/src/CMakeLists.txt b/weechat/src/CMakeLists.txt
new file mode 100644
index 000000000..2694d55d1
--- /dev/null
+++ b/weechat/src/CMakeLists.txt
@@ -0,0 +1,95 @@
+# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org>
+#
+# 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 2 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, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+ADD_DEFINITIONS(-DHAVE_CONFIG_H)
+
+INCLUDE(CheckIncludeFiles)
+INCLUDE(CheckFunctionExists)
+
+CHECK_INCLUDE_FILES("arpa/inet.h" HAVE_ARPA_INET_H)
+CHECK_INCLUDE_FILES("libintl.h" HAVE_LIBINTL_H)
+CHECK_INCLUDE_FILES("limits.h" HAVE_LIMITS_H)
+CHECK_INCLUDE_FILES("locale.h" HAVE_LOCALE_H)
+CHECK_INCLUDE_FILES("netdb.h" HAVE_NETDB_H)
+CHECK_INCLUDE_FILES("netinet/in.h" HAVE_NETINET_IN_H)
+CHECK_INCLUDE_FILES("stdlib.h" HAVE_STDLIB_H)
+CHECK_INCLUDE_FILES("string.h" HAVE_STRING_H)
+CHECK_INCLUDE_FILES("sys/socket.h" HAVE_SYS_SOCKET_H)
+CHECK_INCLUDE_FILES("sys/time.h" HAVE_SYS_TIME_H)
+CHECK_INCLUDE_FILES("sys/types.h" HAVE_SYS_TYPES_H)
+CHECK_INCLUDE_FILES("unistd.h" HAVE_UNISTD_H)
+CHECK_INCLUDE_FILES("pwd.h" HAVE_PWD_H)
+CHECK_INCLUDE_FILES("errno.h" HAVE_ERRNO_H)
+CHECK_INCLUDE_FILES("wchar.h" HAVE_WCHAR_H)
+CHECK_INCLUDE_FILES("langinfo.h" HAVE_LANGINFO_CODESET)
+
+CHECK_FUNCTION_EXISTS(gethostbyname HAVE_GETHOSTBYNAME)
+CHECK_FUNCTION_EXISTS(gethostname HAVE_GETHOSTNAME)
+CHECK_FUNCTION_EXISTS(getsockname HAVE_GETSOCKNAME)
+CHECK_FUNCTION_EXISTS(gettimeofday HAVE_GETTIMEOFDAY)
+CHECK_FUNCTION_EXISTS(inet_ntoa HAVE_INET_NTOA)
+CHECK_FUNCTION_EXISTS(memset HAVE_MEMSET)
+CHECK_FUNCTION_EXISTS(mkdir HAVE_MKDIR)
+CHECK_FUNCTION_EXISTS(select HAVE_SELECT)
+CHECK_FUNCTION_EXISTS(setlocale HAVE_SETLOCALE)
+CHECK_FUNCTION_EXISTS(socket HAVE_SOCKET)
+CHECK_FUNCTION_EXISTS(strcasecmp HAVE_STRCASECMP)
+CHECK_FUNCTION_EXISTS(strchr HAVE_STRCHR)
+CHECK_FUNCTION_EXISTS(strdup HAVE_STRDUP)
+CHECK_FUNCTION_EXISTS(strndup HAVE_STRNDUP)
+CHECK_FUNCTION_EXISTS(strncasecmp HAVE_STRNCASECMP)
+CHECK_FUNCTION_EXISTS(strpbrk HAVE_STRPBRK)
+CHECK_FUNCTION_EXISTS(strrchr HAVE_STRRCHR)
+CHECK_FUNCTION_EXISTS(strstr HAVE_STRSTR)
+
+
+#needs to be splitted in subdirectories
+# FIXME: weechat_gui_common MUST be the first lib in the list
+SET(STATIC_LIBS weechat_gui_common)
+
+# Check for Gettext
+IF(NOT DISABLE_NLS)
+ FIND_PACKAGE(Gettext)
+ IF(GETTEXT_FOUND)
+ ADD_DEFINITIONS(-DENABLE_NLS)
+ ENDIF(GETTEXT_FOUND)
+ENDIF(NOT DISABLE_NLS)
+
+# Check for GnuTLS
+IF(NOT DISABLE_GNUTLS)
+ FIND_PACKAGE(GnuTLS)
+
+ IF(GNUTLS_FOUND)
+ STRING(REGEX REPLACE "/[^/]*$" "" GNUTLS_LIBRARY_PATH "${GNUTLS_LIBRARY}")
+ ADD_DEFINITIONS(-DHAVE_GNUTLS)
+ INCLUDE_DIRECTORIES(${GNUTLS_INCLUDE_PATH})
+ SET(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -L${GNUTLS_LIBRARY_PATH}")
+ LIST(APPEND EXTRA_LIBS gnutls)
+ ENDIF(GNUTLS_FOUND)
+ENDIF(NOT DISABLE_GNUTLS)
+
+IF(NOT DISABLE_PLUGINS)
+ ADD_DEFINITIONS(-DPLUGINS)
+ LIST(APPEND STATIC_LIBS weechat_plugins)
+ ADD_SUBDIRECTORY( plugins )
+ENDIF(NOT DISABLE_PLUGINS)
+
+ADD_SUBDIRECTORY( common )
+List(APPEND STATIC_LIBS weechat_main)
+ADD_SUBDIRECTORY( irc )
+LIST(APPEND STATIC_LIBS weechat_irc)
+ADD_SUBDIRECTORY( gui )
diff --git a/weechat/src/common/CMakeLists.txt b/weechat/src/common/CMakeLists.txt
new file mode 100644
index 000000000..158374946
--- /dev/null
+++ b/weechat/src/common/CMakeLists.txt
@@ -0,0 +1,33 @@
+# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org>
+#
+# 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 2 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, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+SET(LIB_MAIN_SRC weechat.c weechat.h alias.c alias.h backtrace.c backtrace.h
+command.c command.h completion.c completion.h weelist.c weelist.h weeconfig.c
+weeconfig.h history.c history.h hotlist.c hotlist.h log.c log.h fifo.c fifo.h
+session.c session.h utf8.c utf8.h util.c util.h)
+
+# Check for flock support
+INCLUDE(CheckSymbolExists)
+CHECK_INCLUDE_FILES("sys/file.h" HAVE_SYS_FILE_H)
+CHECK_SYMBOL_EXISTS(flock "sys/file.h" HAVE_FLOCK)
+
+IF(ICONV_FOUND)
+ ADD_DEFINITIONS( -DHAVE_ICONV )
+ENDIF(ICONV_FOUND)
+
+INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR})
+ADD_LIBRARY(weechat_main STATIC ${LIB_MAIN_SRC})
diff --git a/weechat/src/common/util.c b/weechat/src/common/util.c
index b7c6907da..f6434700c 100644
--- a/weechat/src/common/util.c
+++ b/weechat/src/common/util.c
@@ -33,6 +33,14 @@
#include <iconv.h>
#endif
+#ifndef ICONV_CONST
+ #ifdef ICONV_2ARG_IS_CONST
+ #define ICONV_CONST const
+ #else
+ #define ICONV_CONST
+ #endif
+#endif
+
#include "weechat.h"
#include "utf8.h"
#include "weeconfig.h"
diff --git a/weechat/src/gui/CMakeLists.txt b/weechat/src/gui/CMakeLists.txt
new file mode 100644
index 000000000..7835db2b4
--- /dev/null
+++ b/weechat/src/gui/CMakeLists.txt
@@ -0,0 +1,25 @@
+# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org>
+#
+# 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 2 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, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+SUBDIRS( curses )
+
+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
+gui-panel.h gui-window.h)
+
+INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR})
+ADD_LIBRARY(weechat_gui_common STATIC ${LIB_GUI_COMMON_SRC})
diff --git a/weechat/src/gui/curses/CMakeLists.txt b/weechat/src/gui/curses/CMakeLists.txt
new file mode 100644
index 000000000..6bfdf0bcd
--- /dev/null
+++ b/weechat/src/gui/curses/CMakeLists.txt
@@ -0,0 +1,42 @@
+# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org>
+#
+# 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 2 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, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+SET(WEECHAT_CURSES_SRC gui-curses-chat.c gui-curses-color.c gui-curses-infobar.c
+gui-curses-input.c gui-curses-keyboard.c gui-curses-main.c gui-curses-nicklist.c
+gui-curses-status.c gui-curses-window.c gui-curses-panel.c gui-curses.h)
+
+SET(EXECUTABLE weechat-curses)
+
+INCLUDE(CheckLibraryExists)
+# Check for ncurses and/or ncursesw
+CHECK_INCLUDE_FILES(ncursesw/ncurses.h NCURSESW_HEADERS)
+CHECK_LIBRARY_EXISTS(ncursesw initscr "" NCURSESW_FOUND)
+
+IF(NCURSESW_FOUND)
+ ADD_DEFINITIONS(-DHAVE_NCURSESW_CURSES_H)
+ LIST(APPEND EXTRA_LIBS ncursesw)
+ELSE(NCURSESW_FOUND)
+ CHECK_INCLUDE_FILES(ncurses.h NCURSES_HEADERS)
+ CHECK_LIBRARY_EXISTS(ncurses initscr "" NCURSES_FOUND)
+ LIST(APPEND EXTRA_LIBS ncurses)
+ENDIF(NCURSESW_FOUND)
+
+ADD_EXECUTABLE(${EXECUTABLE} ${WEECHAT_CURSES_SRC})
+INCLUDE_DIRECTORIES(.. ../../common ../../irc ../../plugins)
+TARGET_LINK_LIBRARIES(${EXECUTABLE} ${STATIC_LIBS} ${EXTRA_LIBS})
+
+INSTALL(TARGETS ${EXECUTABLE} RUNTIME DESTINATION bin)
diff --git a/weechat/src/irc/CMakeLists.txt b/weechat/src/irc/CMakeLists.txt
new file mode 100644
index 000000000..68d19060a
--- /dev/null
+++ b/weechat/src/irc/CMakeLists.txt
@@ -0,0 +1,26 @@
+# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org>
+#
+# 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 2 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, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+SET(LIB_IRC_SRC irc.h irc-commands.c irc-send.c irc-recv.c irc-server.c
+irc-channel.c irc-nick.c irc-mode.c irc-dcc.c irc-ignore.c irc-display.c)
+
+CHECK_INCLUDE_FILES("regex.h" HAVE_REGEX_H)
+CHECK_FUNCTION_EXISTS(regexec HAVE_REGEXEC)
+CHECK_FUNCTION_EXISTS(uname HAVE_UNAME)
+
+INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR})
+ADD_LIBRARY(weechat_irc STATIC ${LIB_IRC_SRC})
diff --git a/weechat/src/plugins/CMakeLists.txt b/weechat/src/plugins/CMakeLists.txt
new file mode 100644
index 000000000..ec8d057a0
--- /dev/null
+++ b/weechat/src/plugins/CMakeLists.txt
@@ -0,0 +1,45 @@
+# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org>
+#
+# 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 2 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, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+SET(LIB_PLUGINS_SRC weechat-plugin.h plugins.h plugins.c plugins-interface.c
+plugins-config.h plugins-config.c)
+
+INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR})
+ADD_LIBRARY(weechat_plugins STATIC ${LIB_PLUGINS_SRC})
+
+INCLUDE(CheckIncludeFiles)
+INCLUDE(CheckFunctionExists)
+INCLUDE(CheckLibraryExists)
+
+IF(NOT DISABLE_ASPELL)
+ # Check for aspell libraries
+ FIND_PACKAGE(Aspell)
+ IF(ASPELL_FOUND)
+ ADD_SUBDIRECTORY( aspell )
+ ENDIF(ASPELL_FOUND)
+ENDIF(NOT DISABLE_ASPELL)
+
+IF (NOT DISABLE_CHARSET)
+ # Check for iconv support.
+ FIND_PACKAGE(Iconv)
+ IF(ICONV_FOUND)
+ ADD_DEFINITIONS( -DHAVE_ICONV )
+ ADD_SUBDIRECTORY( charset )
+ ENDIF(ICONV_FOUND)
+ENDIF(NOT DISABLE_CHARSET)
+
+ADD_SUBDIRECTORY( scripts )
diff --git a/weechat/src/plugins/aspell/CMakeLists.txt b/weechat/src/plugins/aspell/CMakeLists.txt
new file mode 100644
index 000000000..d38e75606
--- /dev/null
+++ b/weechat/src/plugins/aspell/CMakeLists.txt
@@ -0,0 +1,26 @@
+# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org>
+#
+# 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 2 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, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+ADD_LIBRARY(aspell MODULE weechat-aspell.h weechat-aspell.c)
+SET_TARGET_PROPERTIES(aspell PROPERTIES PREFIX "")
+
+IF(ASPELL_FOUND)
+ INCLUDE_DIRECTORIES(${ASPELL_INCLUDE_PATH})
+ TARGET_LINK_LIBRARIES(aspell ${ASPELL_LIBRARY})
+ENDIF(ASPELL_FOUND)
+
+INSTALL(TARGETS aspell LIBRARY DESTINATION lib/${PROJECT_NAME}/plugins)
diff --git a/weechat/src/plugins/charset/CMakeLists.txt b/weechat/src/plugins/charset/CMakeLists.txt
new file mode 100644
index 000000000..5068ea68a
--- /dev/null
+++ b/weechat/src/plugins/charset/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org>
+#
+# 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 2 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, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+ADD_LIBRARY(charset MODULE weechat-charset.h weechat-charset.c)
+SET_TARGET_PROPERTIES(charset PROPERTIES PREFIX "")
+
+IF(ICONV_FOUND)
+ INCLUDE_DIRECTORIES(${ICONV_INCLUDE_PATH})
+ IF(ICONV_LIBRARY)
+ TARGET_LINK_LIBRARIES(charset ${ICONV_LIBRARY})
+ ELSE(ICONV_LIBRARY)
+ TARGET_LINK_LIBRARIES(charset)
+ ENDIF(ICONV_LIBRARY)
+ENDIF(ICONV_FOUND)
+
+INSTALL(TARGETS charset LIBRARY DESTINATION lib/${PROJECT_NAME}/plugins)
diff --git a/weechat/src/plugins/scripts/CMakeLists.txt b/weechat/src/plugins/scripts/CMakeLists.txt
new file mode 100644
index 000000000..4831b6ffe
--- /dev/null
+++ b/weechat/src/plugins/scripts/CMakeLists.txt
@@ -0,0 +1,50 @@
+# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org>
+#
+# 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 2 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, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+SET(LIB_SCRIPTS_SRC weechat-script.c weechat-script.h)
+
+ADD_DEFINITIONS(${CMAKE_SHARED_LIBRARY_C_FLAGS})
+INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR})
+ADD_LIBRARY(weechat_scripts STATIC ${LIB_SCRIPTS_SRC})
+
+IF(NOT DISABLE_RUBY)
+ FIND_PACKAGE(Ruby)
+ IF(RUBY_FOUND)
+ ADD_SUBDIRECTORY( ruby )
+ ENDIF(RUBY_FOUND)
+ENDIF(NOT DISABLE_RUBY)
+
+IF(NOT DISABLE_LUA)
+ FIND_PACKAGE(Lua)
+ IF(LUA_FOUND)
+ ADD_SUBDIRECTORY( lua )
+ ENDIF(LUA_FOUND)
+ENDIF(NOT DISABLE_LUA)
+
+IF(NOT DISABLE_PYTHON)
+ FIND_PACKAGE(Python)
+ IF(PYTHON_FOUND)
+ ADD_SUBDIRECTORY( python )
+ ENDIF(PYTHON_FOUND)
+ENDIF(NOT DISABLE_PYTHON)
+
+IF(NOT DISABLE_PERL)
+ FIND_PACKAGE(Perl)
+ IF(PERL_FOUND)
+ ADD_SUBDIRECTORY( perl )
+ ENDIF(PERL_FOUND)
+ENDIF(NOT DISABLE_PERL)
diff --git a/weechat/src/plugins/scripts/lua/CMakeLists.txt b/weechat/src/plugins/scripts/lua/CMakeLists.txt
new file mode 100644
index 000000000..255de8cdc
--- /dev/null
+++ b/weechat/src/plugins/scripts/lua/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org>
+#
+# 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 2 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, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+ADD_LIBRARY(lua MODULE weechat-lua.c)
+SET_TARGET_PROPERTIES(lua PROPERTIES PREFIX "")
+
+IF(LUA_FOUND)
+ INCLUDE_DIRECTORIES(${LUA_INCLUDE_PATH} )
+ IF(LUA_LIBRARY AND LUALIB_LIBRARY)
+ TARGET_LINK_LIBRARIES(lua ${LUA_LIBRARY} ${LUALIB_LIBRARY} weechat_scripts)
+ ELSE(LUA_LIBRARY AND LUALIB_LIBRARY)
+ TARGET_LINK_LIBRARIES(lua ${LUA_LIBRARY} weechat_scripts)
+ ENDIF(LUA_LIBRARY AND LUALIB_LIBRARY)
+ENDIF(LUA_FOUND)
+
+INSTALL(TARGETS lua LIBRARY DESTINATION lib/${PROJECT_NAME}/plugins)
diff --git a/weechat/src/plugins/scripts/perl/CMakeLists.txt b/weechat/src/plugins/scripts/perl/CMakeLists.txt
new file mode 100644
index 000000000..9b5ed98ea
--- /dev/null
+++ b/weechat/src/plugins/scripts/perl/CMakeLists.txt
@@ -0,0 +1,38 @@
+# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org>
+#
+# 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 2 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, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+ADD_LIBRARY(perl MODULE weechat-perl.c)
+
+SET_TARGET_PROPERTIES(perl PROPERTIES PREFIX "")
+
+IF(PERL_FOUND)
+ ADD_DEFINITIONS(${PERL_CFLAGS})
+ INCLUDE_DIRECTORIES(${PERL_INCLUDE_PATH})
+ # ugly hack to force linking against Dynaloader.a
+ STRING(REGEX MATCH "/[^ $]*/DynaLoader.a" PERL_DYNALOADER ${PERL_LFLAGS})
+ IF(PERL_DYNALOADER)
+ STRING(REPLACE "${PERL_DYNALOADER}" "" PERL_LFLAGS "${PERL_LFLAGS}")
+ SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${PERL_LFLAGS}")
+ EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy ${PERL_DYNALOADER} ${CMAKE_CURRENT_BINARY_DIR}/libDynaLoader.a)
+ TARGET_LINK_LIBRARIES(perl ${PERL_LIBRARY} weechat_scripts ${CMAKE_CURRENT_BINARY_DIR}/libDynaLoader.a)
+ ELSE(PERL_DYNALOADER)
+ SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${PERL_LFLAGS}")
+ TARGET_LINK_LIBRARIES(perl ${PERL_LIBRARY} weechat_scripts)
+ ENDIF(PERL_DYNALOADER)
+ENDIF(PERL_FOUND)
+
+INSTALL(TARGETS perl LIBRARY DESTINATION lib/${PROJECT_NAME}/plugins)
diff --git a/weechat/src/plugins/scripts/python/CMakeLists.txt b/weechat/src/plugins/scripts/python/CMakeLists.txt
new file mode 100644
index 000000000..cf7e05533
--- /dev/null
+++ b/weechat/src/plugins/scripts/python/CMakeLists.txt
@@ -0,0 +1,28 @@
+# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org>
+#
+# 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 2 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, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+ADD_LIBRARY(python MODULE weechat-python.c)
+
+SET_TARGET_PROPERTIES(python PROPERTIES PREFIX "")
+
+IF(PYTHON_FOUND)
+ INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH})
+ SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${PYTHON_LFLAGS}")
+ TARGET_LINK_LIBRARIES(python ${PYTHON_LIBRARY} weechat_scripts)
+ENDIF(PYTHON_FOUND)
+
+INSTALL(TARGETS python LIBRARY DESTINATION lib/weechat/plugins)
diff --git a/weechat/src/plugins/scripts/ruby/CMakeLists.txt b/weechat/src/plugins/scripts/ruby/CMakeLists.txt
new file mode 100644
index 000000000..51ea89959
--- /dev/null
+++ b/weechat/src/plugins/scripts/ruby/CMakeLists.txt
@@ -0,0 +1,27 @@
+# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org>
+#
+# 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 2 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, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+ADD_LIBRARY(ruby MODULE weechat-ruby.c)
+
+SET_TARGET_PROPERTIES(ruby PROPERTIES PREFIX "")
+
+IF(RUBY_FOUND)
+ INCLUDE_DIRECTORIES(${RUBY_INCLUDE_PATH})
+ TARGET_LINK_LIBRARIES(ruby ${RUBY_LIBRARY} weechat_scripts)
+ENDIF(RUBY_FOUND)
+
+INSTALL(TARGETS ruby LIBRARY DESTINATION lib/${PROJECT_NAME}/plugins)