[poppler] CMakeLists.txt cmake/modules config.h.cmake ConfigureChecks.cmake glib/CMakeLists.txt glib/demo glib/poppler-features.h.cmake poppler-cairo.pc.cmake poppler-config.h.cmake poppler-glib.pc.cmake poppler.pc.cmake poppler-qt4.pc.cmake poppler-qt.pc.cmake poppler-splash.pc.cmake qt4/CMakeLists.txt qt4/src qt4/tests qt/CMakeLists.txt test/CMakeLists.txt utils/CMakeLists.txt

Pino Toscano pino at kemper.freedesktop.org
Wed Jan 30 14:15:14 PST 2008


 CMakeLists.txt                                    |  390 ++++++
 ConfigureChecks.cmake                             |   47 
 cmake/modules/COPYING-CMAKE-SCRIPTS               |   22 
 cmake/modules/FindCairo.cmake                     |   44 
 cmake/modules/FindFontconfig.cmake                |   47 
 cmake/modules/FindFreetype.cmake                  |   74 +
 cmake/modules/FindGTK.cmake                       |   70 +
 cmake/modules/FindPackageHandleStandardArgs.cmake |   58 
 cmake/modules/FindQt3.cmake                       |  319 +++++
 cmake/modules/FindQt4.cmake                       | 1295 ++++++++++++++++++++++
 cmake/modules/MacroBoolTo01.cmake                 |   20 
 cmake/modules/MacroEnsureVersion.cmake            |  117 +
 cmake/modules/MacroOptionalFindPackage.cmake      |   28 
 cmake/modules/MacroPushRequiredVars.cmake         |   47 
 cmake/modules/PopplerDefaults.cmake               |   10 
 cmake/modules/PopplerMacros.cmake                 |   83 +
 config.h.cmake                                    |  149 ++
 glib/CMakeLists.txt                               |  107 +
 glib/demo/CMakeLists.txt                          |   17 
 glib/poppler-features.h.cmake                     |   24 
 poppler-cairo.pc.cmake                            |    9 
 poppler-config.h.cmake                            |  160 ++
 poppler-glib.pc.cmake                             |   13 
 poppler-qt.pc.cmake                               |   12 
 poppler-qt4.pc.cmake                              |   12 
 poppler-splash.pc.cmake                           |    9 
 poppler.pc.cmake                                  |   11 
 qt/CMakeLists.txt                                 |   33 
 qt4/CMakeLists.txt                                |    2 
 qt4/src/CMakeLists.txt                            |   43 
 qt4/tests/CMakeLists.txt                          |   47 
 test/CMakeLists.txt                               |   52 
 utils/CMakeLists.txt                              |   84 +
 33 files changed, 3455 insertions(+)

New commits:
commit 37d2055137c310ceb217164a76814b188be3b1b2
Author: Pino Toscano <pino at draco.(none)>
Date:   Wed Jan 30 23:12:03 2008 +0100

    Introduce the CMake-based build system.
    
    Mostly works nicely as the autotools, and it mimics (almost) all the autotools behaviours.
    Copied some scripts from the KDE cmake scripts (BSD-licensed).
    TODO: gtk-doc.

diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..7d468a0
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,390 @@
+project(poppler)
+
+cmake_minimum_required(VERSION 2.4.0 FATAL_ERROR)
+
+set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
+
+include(PopplerDefaults)
+include(PopplerMacros)
+include(MacroOptionalFindPackage)
+find_package(PkgConfig)
+include(MacroEnsureVersion)
+include(MacroBoolTo01)
+
+set(POPPLER_VERSION "0.6.80")
+
+# command line switches
+option(ENABLE_XPDF_HEADERS "Install unsupported xpdf headers." OFF)
+option(BUILD_GTK_TESTS "Whether compile the GTK+ test programs." ON)
+option(BUILD_QT3_TESTS "Whether compile the Qt3 test programs." ON)
+option(BUILD_QT4_TESTS "Whether compile the Qt4 test programs." ON)
+option(ENABLE_SPLASH "Build the Splash graphics backend." ON)
+option(ENABLE_UTILS "Compile poppler command line utils." ON)
+option(ENABLE_ABIWORD "Build the Abiword backend." ON)
+option(ENABLE_ZLIB "TODO" OFF)
+option(USE_EXCEPTIONS "Throw exceptions to deal with not enough memory and similar problems." OFF)
+option(USE_FIXEDPOINT "Use fixed point arithmetic" OFF)
+
+# Enable these unconditionally.
+set(MULTITHREAD ON)
+set(OPI_SUPPORT ON)
+set(TEXTOUT_WORD_LIST ON)
+
+# setting the minimum required versions for some components
+set(QT3_MIN_VERSION "3.3.0")
+set(QT4_MIN_VERSION "4.1.0")
+set(CAIRO_VERSION "1.4")
+
+# set the default compile warnings
+if(CMAKE_COMPILER_IS_GNUCXX)
+  set(DEFAULT_COMPILE_WARNINGS_NO)
+  set(DEFAULT_COMPILE_WARNINGS_YES "-Wall -Wno-write-strings")
+  set(DEFAULT_COMPILE_WARNINGS_KDE "-Wnon-virtual-dtor -Wno-long-long -Wundef -ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -O2 -Wformat-security -Wmissing-format-attribute -fno-exceptions -fno-check-new -fno-common")
+endif(CMAKE_COMPILER_IS_GNUCXX)
+
+macro_bool_to_01(ENABLE_SPLASH HAVE_SPLASH)
+find_package(Freetype REQUIRED)
+find_package(Fontconfig REQUIRED)
+macro_optional_find_package(JPEG)
+if(JPEG_FOUND)
+  set(ENABLE_LIBJPEG JPEG_FOUND)
+endif(JPEG_FOUND)
+macro_optional_find_package(Qt3)
+macro_optional_find_package(Qt4)
+macro_optional_find_package(GTK)
+if(GLIB_FOUND)
+  macro_optional_find_package(Cairo)
+  set(HAVE_CAIRO CAIRO_FOUND)
+  if(CAIRO_FOUND)
+    set(CAIRO_REQ "cairo")
+  endif(CAIRO_FOUND)
+endif(GLIB_FOUND)
+if(ENABLE_ZLIB)
+  find_package(ZLIB)
+  if(ZLIB_FOUND)
+    set(HAVE_LIBZ ZLIB_FOUND)
+  endif(ZLIB_FOUND)
+  set(ENABLE_ZLIB ${ZLIB_FOUND})
+endif(ENABLE_ZLIB)
+if(ENABLE_ABIWORD)
+  find_package(LibXml2)
+  set(ENABLE_ABIWORD ${LIBXML2_FOUND})
+endif(ENABLE_ABIWORD)
+
+add_definitions(-DHAVE_CONFIG_H=1 ${FONTCONFIG_DEFINITIONS})
+include_directories(
+  ${CMAKE_CURRENT_SOURCE_DIR}
+  ${CMAKE_CURRENT_SOURCE_DIR}/fofi
+  ${CMAKE_CURRENT_SOURCE_DIR}/goo
+  ${CMAKE_CURRENT_SOURCE_DIR}/poppler
+  ${CMAKE_CURRENT_BINARY_DIR}
+  ${CMAKE_CURRENT_BINARY_DIR}/poppler
+  ${FREETYPE_INCLUDE_DIR}
+)
+set(HAVE_FREETYPE_H ON)
+
+if(ENABLE_ZLIB)
+  include_directories(${ZLIB_INCLUDE_DIR})
+endif(ENABLE_ZLIB)
+if(JPEG_FOUND)
+  include_directories(${JPEG_INCLUDE_DIR})
+  set(ENABLE_LIBJPEG ON)
+endif(JPEG_FOUND)
+if(ENABLE_ABIWORD)
+  include_directories(${LIBXML2_INCLUDE_DIR})
+  add_definitions(${LIBXML2_DEFINITIONS})
+endif(ENABLE_ABIWORD)
+
+if(DEFINED COMPILE_WARNINGS)
+else(DEFINED COMPILE_WARNINGS)
+  set(COMPILE_WARNINGS "yes")
+endif(DEFINED COMPILE_WARNINGS)
+string(TOLOWER "${COMPILE_WARNINGS}" _comp_warnings)
+if(_comp_warnings STREQUAL "no")
+  add_definitions(${DEFAULT_COMPILE_WARNINGS_NO})
+endif(_comp_warnings STREQUAL "no")
+if(_comp_warnings STREQUAL "yes")
+  add_definitions(${DEFAULT_COMPILE_WARNINGS_YES})
+endif(_comp_warnings STREQUAL "yes")
+if(_comp_warnings STREQUAL "kde")
+  set(CMAKE_CXX_FLAGS "${DEFAULT_COMPILE_WARNINGS_KDE} ${CMAKE_CXX_FLAGS}")
+endif(_comp_warnings STREQUAL "kde")
+
+
+include(ConfigureChecks.cmake)
+configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
+configure_file(poppler-config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/poppler/poppler-config.h)
+
+
+set(poppler_SRCS
+  goo/gfile.cc
+  goo/gmempp.cc
+  goo/GooHash.cc
+  goo/GooList.cc
+  goo/GooTimer.cc
+  goo/GooString.cc
+  goo/gmem.cc
+  goo/FixedPoint.cc
+  fofi/FoFiBase.cc
+  fofi/FoFiEncodings.cc
+  fofi/FoFiTrueType.cc
+  fofi/FoFiType1.cc
+  fofi/FoFiType1C.cc
+  poppler/Annot.cc
+  poppler/Array.cc
+  poppler/BuiltinFont.cc
+  poppler/BuiltinFontTables.cc
+  poppler/Catalog.cc
+  poppler/CharCodeToUnicode.cc
+  poppler/CMap.cc
+  poppler/Decrypt.cc
+  poppler/Dict.cc
+  poppler/Error.cc
+  poppler/FontEncodingTables.cc
+  poppler/Form.cc
+  poppler/FontInfo.cc
+  poppler/Function.cc
+  poppler/Gfx.cc
+  poppler/GfxFont.cc
+  poppler/GfxState.cc
+  poppler/GlobalParams.cc
+  poppler/JArithmeticDecoder.cc
+  poppler/JBIG2Stream.cc
+  poppler/JPXStream.cc
+  poppler/Lexer.cc
+  poppler/Link.cc
+  poppler/NameToCharCode.cc
+  poppler/Object.cc
+  poppler/Outline.cc
+  poppler/OutputDev.cc
+  poppler/Page.cc
+  poppler/PageTransition.cc
+  poppler/Parser.cc
+  poppler/PDFDoc.cc
+  poppler/PDFDocEncoding.cc
+  poppler/ProfileData.cc
+  poppler/PreScanOutputDev.cc
+  poppler/PSTokenizer.cc
+  poppler/Stream.cc
+  poppler/UnicodeMap.cc
+  poppler/UnicodeTypeTable.cc
+  poppler/XRef.cc
+  poppler/PSOutputDev.cc
+  poppler/TextOutputDev.cc
+  poppler/PageLabelInfo.cc
+  poppler/SecurityHandler.cc
+  poppler/Sound.cc
+  poppler/XpdfPluginAPI.cc
+)
+set(poppler_LIBS ${FREETYPE_LIBRARIES} ${FONTCONFIG_LIBRARIES})
+if(ENABLE_SPLASH)
+  set(poppler_SRCS ${poppler_SRCS}
+    poppler/SplashOutputDev.cc
+    splash/Splash.cc
+    splash/SplashBitmap.cc
+    splash/SplashClip.cc
+    splash/SplashFTFont.cc
+    splash/SplashFTFontEngine.cc
+    splash/SplashFTFontFile.cc
+    splash/SplashFont.cc
+    splash/SplashFontEngine.cc
+    splash/SplashFontFile.cc
+    splash/SplashFontFileID.cc
+    splash/SplashPath.cc
+    splash/SplashPattern.cc
+    splash/SplashScreen.cc
+    splash/SplashState.cc
+    splash/SplashT1Font.cc
+    splash/SplashT1FontEngine.cc
+    splash/SplashT1FontFile.cc
+    splash/SplashXPath.cc
+    splash/SplashXPathScanner.cc
+  )
+endif(ENABLE_SPLASH)
+if(JPEG_FOUND)
+  set(poppler_SRCS ${poppler_SRCS}
+    poppler/DCTStream.cc
+  )
+  set(poppler_LIBS ${poppler_LIBS} ${JPEG_LIBRARIES})
+endif(JPEG_FOUND)
+if(ENABLE_ZLIB)
+  set(poppler_SRCS ${poppler_SRCS}
+    poppler/FlateStream.cc
+  )
+  set(poppler_LIBS ${poppler_LIBS} ${ZLIB_LIBRARIES})
+endif(ENABLE_ZLIB)
+if(ENABLE_ABIWORD)
+  set(poppler_SRCS ${poppler_SRCS}
+    poppler/ABWOutputDev.cc
+  )
+  set(poppler_LIBS ${poppler_LIBS} ${LIBXML2_LIBRARIES})
+endif(ENABLE_ABIWORD)
+if(WIN32)
+  # gdi32 is needed under win32
+  set(poppler_LIBS ${poppler_LIBS} gdi32)
+endif(WIN32)
+
+add_library(poppler SHARED ${poppler_SRCS})
+set_target_properties(poppler PROPERTIES VERSION 2.0.0 SOVERSION 2)
+target_link_libraries(poppler ${poppler_LIBS})
+install(TARGETS poppler RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
+
+if(ENABLE_XPDF_HEADERS)
+  install(FILES
+    goo/GooHash.h
+    goo/GooList.h
+    goo/GooTimer.h
+    goo/GooMutex.h
+    goo/GooString.h
+    goo/GooVector.h
+    goo/gtypes.h
+    goo/gmem.h
+    goo/gfile.h
+    goo/FixedPoint.h
+    poppler/Annot.h
+    poppler/Array.h
+    poppler/BaseFile.h
+    poppler/BuiltinFont.h
+    poppler/BuiltinFontTables.h
+    poppler/Catalog.h
+    poppler/CharCodeToUnicode.h
+    poppler/CMap.h
+    poppler/Decrypt.h
+    poppler/Dict.h
+    poppler/Error.h
+    poppler/FontEncodingTables.h
+    poppler/FontInfo.h
+    poppler/Form.h
+    poppler/Function.cc
+    poppler/Function.h
+    poppler/Gfx.h
+    poppler/GfxFont.h
+    poppler/GfxState.h
+    poppler/GlobalParams.h
+    poppler/JArithmeticDecoder.h
+    poppler/JBIG2Stream.h
+    poppler/JPXStream.h
+    poppler/Lexer.h
+    poppler/Link.h
+    poppler/NameToCharCode.h
+    poppler/Object.h
+    poppler/Outline.h
+    poppler/OutputDev.h
+    poppler/Page.h
+    poppler/PageTransition.h
+    poppler/Parser.h
+    poppler/PDFDoc.h
+    poppler/PDFDocEncoding.h
+    poppler/ProfileData.h
+    poppler/PreScanOutputDev.h
+    poppler/PSTokenizer.h
+    poppler/Stream-CCITT.h
+    poppler/Stream.h
+    poppler/UnicodeMap.h
+    poppler/UnicodeMapTables.h
+    poppler/UnicodeTypeTable.h
+    poppler/UnicodeCClassTables.h
+    poppler/UnicodeCompTables.h
+    poppler/UnicodeDecompTables.h
+    poppler/XRef.h
+    poppler/CharTypes.h
+    poppler/CompactFontTables.h
+    poppler/ErrorCodes.h
+    poppler/NameToUnicodeTable.h
+    poppler/PSOutputDev.h
+    poppler/TextOutputDev.h
+    poppler/SecurityHandler.h
+    poppler/UTF8.h
+    poppler/XpdfPluginAPI.h
+    poppler/Sound.h
+    ${CMAKE_CURRENT_BINARY_DIR}/poppler/poppler-config.h
+    DESTINATION include/poppler)
+  if(ENABLE_SPLASH)
+    install(FILES
+      poppler/SplashOutputDev.h
+      DESTINATION include/poppler)
+    install(FILES
+      splash/Splash.h
+      splash/SplashBitmap.h
+      splash/SplashClip.h
+      splash/SplashErrorCodes.h
+      splash/SplashFTFont.h
+      splash/SplashFTFontEngine.h
+      splash/SplashFTFontFile.h
+      splash/SplashFont.h
+      splash/SplashFontEngine.h
+      splash/SplashFontFile.h
+      splash/SplashFontFileID.h
+      splash/SplashGlyphBitmap.h
+      splash/SplashMath.h
+      splash/SplashPath.h
+      splash/SplashPattern.h
+      splash/SplashScreen.h
+      splash/SplashState.h
+      splash/SplashT1Font.h
+      splash/SplashT1FontEngine.h
+      splash/SplashT1FontFile.h
+      splash/SplashTypes.h
+      splash/SplashXPath.h
+      splash/SplashXPathScanner.h
+      DESTINATION include/poppler/splash)
+  endif(ENABLE_SPLASH)
+endif(ENABLE_XPDF_HEADERS)
+
+
+if(ENABLE_UTILS)
+  add_subdirectory(utils)
+endif(ENABLE_UTILS)
+if(GLIB_FOUND)
+  add_subdirectory(glib)
+endif(GLIB_FOUND)
+if(QT3_FOUND)
+  add_subdirectory(qt)
+endif(QT3_FOUND)
+add_subdirectory(test)
+if(QT4_FOUND)
+  add_subdirectory(qt4)
+endif(QT4_FOUND)
+
+set(PKG_CONFIG_VERSION_0_18 TRUE)
+if(PKGCONFIG_EXECUTABLE)
+  exec_program(${PKGCONFIG_EXECUTABLE} ARGS --version RETURN_VALUE _return_VALUE OUTPUT_VARIABLE _output_VAR)
+  macro_ensure_version("0.18" "${_output_VAR}" PKG_CONFIG_VERSION_0_18)
+endif(PKGCONFIG_EXECUTABLE)
+if(PKG_CONFIG_VERSION_0_18)
+  set(PC_REQUIRES "")
+  set(PC_REQUIRES_PRIVATE "Requires.private: poppler = ${POPPLER_VERSION}")
+else(PKG_CONFIG_VERSION_0_18)
+  set(PC_REQUIRES "poppler = ${POPPLER_VERSION}")
+  set(PC_REQUIRES_PRIVATE "")
+endif(PKG_CONFIG_VERSION_0_18)
+
+poppler_create_install_pkgconfig(poppler.pc lib/pkgconfig)
+if(ENABLE_SPLASH)
+  poppler_create_install_pkgconfig(poppler-splash.pc lib/pkgconfig)
+endif(ENABLE_SPLASH)
+if(QT3_FOUND)
+  poppler_create_install_pkgconfig(poppler-qt.pc lib/pkgconfig)
+endif(QT3_FOUND)
+if(QT4_FOUND)
+  poppler_create_install_pkgconfig(poppler-qt4.pc lib/pkgconfig)
+endif(QT4_FOUND)
+if(GLIB_FOUND)
+  poppler_create_install_pkgconfig(poppler-glib.pc lib/pkgconfig)
+endif(GLIB_FOUND)
+if(CAIRO_FOUND)
+  poppler_create_install_pkgconfig(poppler-cairo.pc lib/pkgconfig)
+endif(CAIRO_FOUND)
+
+
+message("Building Poppler with support for:")
+show_end_message("splash output" ENABLE_SPLASH)
+show_end_message("cairo output" CAIRO_FOUND)
+show_end_message("abiword output" ENABLE_ABIWORD)
+show_end_message("qt wrapper" QT3_FOUND)
+show_end_message("qt4 wrapper" QT4_FOUND)
+show_end_message("glib wrapper" GLIB_FOUND)
+# message("  use gtk-doc:        $enable_gtk_doc") # TODO
+show_end_message("use libjpeg" ENABLE_LIBJPEG)
+show_end_message("use zlib" ENABLE_ZLIB)
+show_end_message("command line utils" ENABLE_UTILS)
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
new file mode 100644
index 0000000..1ba656a
--- /dev/null
+++ b/ConfigureChecks.cmake
@@ -0,0 +1,47 @@
+# Copyright 2008 Pino Toscano, <pino at kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+include(CheckIncludeFile)
+include(CheckIncludeFiles)
+include(CheckSymbolExists)
+include(CheckFunctionExists)
+include(CheckLibraryExists)
+include(CheckTypeSize)
+include(CheckCSourceCompiles)
+
+check_include_files(dlfcn.h HAVE_DLFCN_H)
+check_include_files(inttypes.h HAVE_INTTYPES_H)
+check_include_files(memory.h HAVE_MEMORY_H)
+check_include_files(stdint.h HAVE_STDINT_H)
+check_include_files(stdlib.h HAVE_STDLIB_H)
+check_include_files(strings.h HAVE_STRINGS_H)
+check_include_files(string.h HAVE_STRING_H)
+check_include_files(sys/stat.h HAVE_SYS_STAT_H)
+check_include_files(sys/types.h HAVE_SYS_TYPES_H)
+check_include_files(unistd.h HAVE_UNISTD_H)
+
+check_function_exists(fseek64 HAVE_FSEEK64)
+check_function_exists(fseeko HAVE_FSEEKO)
+check_function_exists(ftell64 HAVE_FTELL64)
+check_function_exists(gettimeofday HAVE_GETTIMEOFDAY)
+check_function_exists(popen HAVE_POPEN)
+check_function_exists(mkstemp HAVE_MKSTEMP)
+check_function_exists(mkstemps HAVE_MKSTEMPS)
+
+macro(CHECK_FOR_DIR include var)
+  check_c_source_compiles(
+    "#include <${include}>
+
+int main(int argc, char *argv[])
+{
+  DIR* d = 0;
+  return 0;
+}
+" ${var})
+endmacro(CHECK_FOR_DIR)
+check_for_dir("dirent.h" HAVE_DIRENT_H)
+check_for_dir("ndir.h" HAVE_NDIR_H)
+check_for_dir("sys/dir.h" HAVE_SYS_DIR_H)
+check_for_dir("sys/ndir.h" HAVE_SYS_NDIR_H)
diff --git a/cmake/modules/COPYING-CMAKE-SCRIPTS b/cmake/modules/COPYING-CMAKE-SCRIPTS
new file mode 100644
index 0000000..4b41776
--- /dev/null
+++ b/cmake/modules/COPYING-CMAKE-SCRIPTS
@@ -0,0 +1,22 @@
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the copyright
+   notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+3. The name of the author may not be used to endorse or promote products 
+   derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/cmake/modules/FindCairo.cmake b/cmake/modules/FindCairo.cmake
new file mode 100644
index 0000000..a0a8400
--- /dev/null
+++ b/cmake/modules/FindCairo.cmake
@@ -0,0 +1,44 @@
+# - try to find Cairo
+# Once done this will define
+#
+#  CAIRO_FOUND - system has Cairo
+#  CAIRO_CFLAGS - the Cairo CFlags
+#  CAIRO_LIBRARIES - Link these to use Cairo
+#
+# Copyright (c) 2007, Pino Toscano, <pino at kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+if (NOT WIN32)
+  include(UsePkgConfig)
+
+  pkgconfig(cairo _LibCairoIncDir _LibCairoLinkDir _CairoLinkFlags _CairoCflags)
+  set (CAIRO_FOUND FALSE)
+  if (_LibCairoIncDir)
+
+    if (CAIRO_VERSION)
+
+      exec_program(${PKGCONFIG_EXECUTABLE} ARGS --atleast-version=${CAIRO_VERSION} cairo RETURN_VALUE _return_VALUE OUTPUT_VARIABLE _pkgconfigDevNull)
+      if(_return_VALUE STREQUAL "0")
+        set (CAIRO_CFLAGS ${_CairoCflags})
+        set (CAIRO_LIBRARIES ${_CairoLinkFlags})
+      endif(_return_VALUE STREQUAL "0")
+
+    else (CAIRO_VERSION)
+      set (CAIRO_CFLAGS ${_CairoCflags})
+      set (CAIRO_LIBRARIES ${_CairoLinkFlags})
+    endif (CAIRO_VERSION)
+
+    include(FindPackageHandleStandardArgs)
+    find_package_handle_standard_args(Cairo DEFAULT_MSG CAIRO_LIBRARIES CAIRO_CFLAGS)
+
+  endif (_LibCairoIncDir)
+
+endif(NOT WIN32)
+
+mark_as_advanced(
+  CAIRO_CFLAGS
+  CAIRO_LIBRARIES
+)
+
diff --git a/cmake/modules/FindFontconfig.cmake b/cmake/modules/FindFontconfig.cmake
new file mode 100644
index 0000000..c6a8c6a
--- /dev/null
+++ b/cmake/modules/FindFontconfig.cmake
@@ -0,0 +1,47 @@
+# - Try to find the  Fontconfig
+# Once done this will define
+#
+#  FONTCONFIG_FOUND - system has Fontconfig
+#  FONTCONFIG_LIBRARIES - Link these to use FONTCONFIG
+#  FONTCONFIG_DEFINITIONS - Compiler switches required for using FONTCONFIG
+
+# Copyright (c) 2006,2007 Laurent Montel, <montel at kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+
+if (FONTCONFIG_LIBRARIES AND FONTCONFIG_INCLUDE_DIR)
+
+  # in cache already
+  set(FONTCONFIG_FOUND TRUE)
+
+else (FONTCONFIG_LIBRARIES AND FONTCONFIG_INCLUDE_DIR)
+
+  if (NOT WIN32)
+    # use pkg-config to get the directories and then use these values
+    # in the FIND_PATH() and FIND_LIBRARY() calls
+    include(UsePkgConfig)
+
+    pkgconfig(fontconfig _FONTCONFIGIncDir _FONTCONFIGLinkDir _FONTCONFIGLinkFlags _FONTCONFIGCflags)
+
+    set(FONTCONFIG_DEFINITIONS ${_FONTCONFIGCflags} CACHE INTERNAL "The compilation flags for fontconfig")
+  endif (NOT WIN32)
+
+  find_path(FONTCONFIG_INCLUDE_DIR fontconfig/fontconfig.h
+    PATHS
+    ${_FONTCONFIGIncDir}
+    /usr/X11/include
+  )
+
+  find_library(FONTCONFIG_LIBRARIES NAMES fontconfig
+    PATHS
+    ${_FONTCONFIGLinkDir}
+  )
+
+  include(FindPackageHandleStandardArgs)
+  FIND_PACKAGE_HANDLE_STANDARD_ARGS(Fontconfig DEFAULT_MSG FONTCONFIG_LIBRARIES FONTCONFIG_INCLUDE_DIR )
+  
+  mark_as_advanced(FONTCONFIG_LIBRARIES FONTCONFIG_INCLUDE_DIR)
+
+endif (FONTCONFIG_LIBRARIES AND FONTCONFIG_INCLUDE_DIR)
diff --git a/cmake/modules/FindFreetype.cmake b/cmake/modules/FindFreetype.cmake
new file mode 100644
index 0000000..66198b9
--- /dev/null
+++ b/cmake/modules/FindFreetype.cmake
@@ -0,0 +1,74 @@
+# - Try to find the freetype library
+# Once done this will define
+#
+#  FREETYPE_FOUND - system has Freetype
+#  FREETYPE_INCLUDE_DIRS - the FREETYPE include directories
+#  FREETYPE_LIBRARIES - Link these to use FREETYPE
+#  FREETYPE_INCLUDE_DIR is internal and deprecated for use
+
+# Copyright (c) 2006, Laurent Montel, <montel at kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+
+if (FREETYPE_LIBRARIES AND FREETYPE_INCLUDE_DIR)
+
+  # in cache already
+  set(FREETYPE_FOUND TRUE)
+
+else (FREETYPE_LIBRARIES AND FREETYPE_INCLUDE_DIR)
+
+  FIND_PROGRAM(FREETYPECONFIG_EXECUTABLE NAMES freetype-config PATHS
+     /opt/local/bin
+  )
+
+  #reset vars
+  set(FREETYPE_LIBRARIES)
+  set(FREETYPE_INCLUDE_DIR)
+
+  # if freetype-config has been found
+  if(FREETYPECONFIG_EXECUTABLE)
+
+    EXEC_PROGRAM(${FREETYPECONFIG_EXECUTABLE} ARGS --libs RETURN_VALUE _return_VALUE OUTPUT_VARIABLE FREETYPE_LIBRARIES)
+
+    EXEC_PROGRAM(${FREETYPECONFIG_EXECUTABLE} ARGS --cflags RETURN_VALUE _return_VALUE OUTPUT_VARIABLE _freetype_pkgconfig_output)
+    if(FREETYPE_LIBRARIES AND _freetype_pkgconfig_output)
+      set(FREETYPE_FOUND TRUE)
+
+      # freetype-config can print out more than one -I, so we need to chop it up
+      # into a list and process each entry separately
+      SEPARATE_ARGUMENTS(_freetype_pkgconfig_output)
+      FOREACH(value ${_freetype_pkgconfig_output})
+        STRING(REGEX REPLACE "-I(.+)" "\\1" value "${value}")
+        set(FREETYPE_INCLUDE_DIR ${FREETYPE_INCLUDE_DIR} ${value})
+      ENDFOREACH(value)
+    endif(FREETYPE_LIBRARIES AND _freetype_pkgconfig_output)
+
+    MARK_AS_ADVANCED(FREETYPE_LIBRARIES FREETYPE_INCLUDE_DIR)
+
+    set( FREETYPE_LIBRARIES ${FREETYPE_LIBRARIES} CACHE INTERNAL "The libraries for freetype" )
+
+  else(FREETYPECONFIG_EXECUTABLE)
+	find_path (FREETYPE_INCLUDE_DIR freetype2/freetype/freetype.h)
+	set (FREETYPE_INCLUDE_DIR ${FREETYPE_INCLUDE_DIR}/freetype2)
+    find_library(FREETYPE_LIBRARIES freetype)
+    if(FREETYPE_INCLUDE_DIR AND FREETYPE_LIBRARIES)
+        set(FREETYPE_FOUND TRUE)
+    endif(FREETYPE_INCLUDE_DIR AND FREETYPE_LIBRARIES)
+  endif(FREETYPECONFIG_EXECUTABLE)
+
+
+  IF (FREETYPE_FOUND)
+    IF (NOT Freetype_FIND_QUIETLY)
+       MESSAGE(STATUS "Found Freetype: ${FREETYPE_LIBRARIES}")
+    ENDIF (NOT Freetype_FIND_QUIETLY)
+  ELSE (FREETYPE_FOUND)
+    IF (Freetype_FIND_REQUIRED)
+       MESSAGE(FATAL_ERROR "Could not find FreeType library")
+    ENDIF (Freetype_FIND_REQUIRED)
+  ENDIF (FREETYPE_FOUND)
+
+endif (FREETYPE_LIBRARIES AND FREETYPE_INCLUDE_DIR)
+
+set(FREETYPE_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIR})
diff --git a/cmake/modules/FindGTK.cmake b/cmake/modules/FindGTK.cmake
new file mode 100644
index 0000000..799bef6
--- /dev/null
+++ b/cmake/modules/FindGTK.cmake
@@ -0,0 +1,70 @@
+# - try to find GTK (and glib)
+# Once done this will define
+#
+#  GLIB_FOUND - system has GLib
+#  GLIB_CFLAGS - the GLib CFlags
+#  GLIB_LIBRARIES - Link these to use GLib
+#
+# Copyright 2008 Pino Toscano, <pino at kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+include(FindPackageHandleStandardArgs)
+
+if (NOT WIN32)
+  include(UsePkgConfig)
+
+  pkgconfig(glib-2.0 _LibGLIB2IncDir _LibGLIB2LinkDir GLIB2LinkFlags GLIB2Cflags)
+  pkgconfig(gdk-2.0 _LibGDK2IncDir _LibGDK2LinkDir GDK2LinkFlags GDK2Cflags)
+  set (GLIB_FOUND FALSE)
+  if (_LibGLIB2IncDir AND _LibGDK2IncDir)
+
+    exec_program(${PKGCONFIG_EXECUTABLE} ARGS --atleast-version=2.6 glib-2.0 RETURN_VALUE _return_VALUE OUTPUT_VARIABLE _pkgconfigDevNull)
+    if(_return_VALUE STREQUAL "0")
+      set(_glib_FOUND TRUE)
+    endif(_return_VALUE STREQUAL "0")
+
+    exec_program(${PKGCONFIG_EXECUTABLE} ARGS --atleast-version=2.4.0 gdk-2.0 RETURN_VALUE _return_VALUE OUTPUT_VARIABLE _pkgconfigDevNull)
+    if(_return_VALUE STREQUAL "0")
+      set(_gdk_FOUND TRUE)
+    endif(_return_VALUE STREQUAL "0")
+
+    if (_glib_FOUND AND _gdk_FOUND)
+      set (GLIB2_CFLAGS ${GLIB2Cflags} ${GDK2Cflags})
+      set (GLIB2_LIBRARIES ${GLIB2LinkFlags} ${GDK2LinkFlags})
+    endif (_glib_FOUND AND _gdk_FOUND)
+
+    find_package_handle_standard_args(GLib DEFAULT_MSG GLIB2_LIBRARIES GLIB2_CFLAGS)
+
+  endif (_LibGLIB2IncDir AND _LibGDK2IncDir)
+
+  pkgconfig(gtk+-2.0 _LibGTK2IncDir _LibGTK2LinkDir GTK2LinkFlags GTK2Cflags)
+  pkgconfig(gdk-pixbuf-2.0 _LibGDK2PixbufIncDir _LibGDK2PixbufLinkDir GDK2PixbufLinkFlags GDK2PixbufCflags)
+  pkgconfig(libglade-2.0 _LibGLADE2IncDir _LibGLADE2LinkDir GLADE2LinkFlags GLADE2Cflags)
+
+  if (_LibGTK2IncDir AND _LibGDK2PixbufIncDir AND _LibGLADE2IncDir)
+
+    exec_program(${PKGCONFIG_EXECUTABLE} ARGS --atleast-version=2.8.0 gtk+-2.0 RETURN_VALUE _return_VALUE OUTPUT_VARIABLE _pkgconfigDevNull)
+    if(_return_VALUE STREQUAL "0")
+      set(_gtk_FOUND TRUE)
+    endif(_return_VALUE STREQUAL "0")
+
+    if (_gtk_FOUND)
+      set (GTK2_CFLAGS ${GTK2Cflags} ${GDK2PixbufCflags} ${GLADE2Cflags})
+      set (GTK2_LIBRARIES ${GTK2LinkFlags} ${GDK2PixbufLinkFlags} ${GLADE2LinkFlags})
+    endif (_gtk_FOUND)
+
+    find_package_handle_standard_args(GTK DEFAULT_MSG GTK2_LIBRARIES GTK2_CFLAGS)
+
+  endif (_LibGTK2IncDir AND _LibGDK2PixbufIncDir AND _LibGLADE2IncDir)
+
+endif(NOT WIN32)
+
+mark_as_advanced(
+  GLIB2_CFLAGS
+  GLIB2_LIBRARIES
+  GTK2_CFLAGS
+  GTK2_LIBRARIES
+)
+
diff --git a/cmake/modules/FindPackageHandleStandardArgs.cmake b/cmake/modules/FindPackageHandleStandardArgs.cmake
new file mode 100644
index 0000000..151d812
--- /dev/null
+++ b/cmake/modules/FindPackageHandleStandardArgs.cmake
@@ -0,0 +1,58 @@
+# FIND_PACKAGE_HANDLE_STANDARD_ARGS(NAME (DEFAULT_MSG|"Custom failure message") VAR1 ... )
+#    This macro is intended to be used in FindXXX.cmake modules files.
+#    It handles the REQUIRED and QUIET argument to FIND_PACKAGE() and
+#    it also sets the <UPPERCASED_NAME>_FOUND variable.
+#    The package is found if all variables listed are TRUE.
+#    Example:
+#
+#    FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2 DEFAULT_MSG LIBXML2_LIBRARIES LIBXML2_INCLUDE_DIR)
+#
+#    LibXml2 is considered to be found, if both LIBXML2_LIBRARIES and 
+#    LIBXML2_INCLUDE_DIR are valid. Then also LIBXML2_FOUND is set to TRUE.
+#    If it is not found and REQUIRED was used, it fails with FATAL_ERROR, 
+#    independent whether QUIET was used or not.
+#    If it is found, the location is reported using the VAR1 argument, so 
+#    here a message "Found LibXml2: /usr/lib/libxml2.so" will be printed out.
+#    If the second argument is DEFAULT_MSG, the message in the failure case will 
+#    be "Could NOT find LibXml2", if you don't like this message you can specify
+#    your own custom failure message there.
+
+MACRO(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FAIL_MSG _VAR1 )
+
+  IF("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG")
+    IF (${_NAME}_FIND_REQUIRED)
+      SET(_FAIL_MESSAGE "Could not find REQUIRED package ${_NAME}")
+    ELSE (${_NAME}_FIND_REQUIRED)
+      SET(_FAIL_MESSAGE "Could not find OPTIONAL package ${_NAME}")
+    ENDIF (${_NAME}_FIND_REQUIRED)
+  ELSE("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG")
+    SET(_FAIL_MESSAGE "${_FAIL_MSG}")
+  ENDIF("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG")
+
+  STRING(TOUPPER ${_NAME} _NAME_UPPER)
+
+  SET(${_NAME_UPPER}_FOUND TRUE)
+  IF(NOT ${_VAR1})
+    SET(${_NAME_UPPER}_FOUND FALSE)
+  ENDIF(NOT ${_VAR1})
+
+  FOREACH(_CURRENT_VAR ${ARGN})
+    IF(NOT ${_CURRENT_VAR})
+      SET(${_NAME_UPPER}_FOUND FALSE)
+    ENDIF(NOT ${_CURRENT_VAR})
+  ENDFOREACH(_CURRENT_VAR)
+
+  IF (${_NAME_UPPER}_FOUND)
+    IF (NOT ${_NAME}_FIND_QUIETLY)
+        MESSAGE(STATUS "Found ${_NAME}: ${${_VAR1}}")
+    ENDIF (NOT ${_NAME}_FIND_QUIETLY)
+  ELSE (${_NAME_UPPER}_FOUND)
+    IF (${_NAME}_FIND_REQUIRED)
+        MESSAGE(FATAL_ERROR "${_FAIL_MESSAGE}")
+    ELSE (${_NAME}_FIND_REQUIRED)
+      IF (NOT ${_NAME}_FIND_QUIETLY)
+        MESSAGE(STATUS "${_FAIL_MESSAGE}")
+      ENDIF (NOT ${_NAME}_FIND_QUIETLY)
+    ENDIF (${_NAME}_FIND_REQUIRED)
+  ENDIF (${_NAME_UPPER}_FOUND)
+ENDMACRO(FIND_PACKAGE_HANDLE_STANDARD_ARGS)
diff --git a/cmake/modules/FindQt3.cmake b/cmake/modules/FindQt3.cmake
new file mode 100644
index 0000000..06ff940
--- /dev/null
+++ b/cmake/modules/FindQt3.cmake
@@ -0,0 +1,319 @@
+# - Locate Qt include paths and libraries
+# This module defines:
+#  QT3_INCLUDE_DIR - where to find qt.h, etc.
+#  QT3_LIBRARIES   - the libraries to link against to use Qt.
+#  QT3_DEFINITIONS - definitions to use when 
+#                   compiling code that uses Qt.
+#  QT3_FOUND       - If false, don't try to use Qt.
+#
+# If you need the multithreaded version of Qt, set QT_MT_REQUIRED to TRUE
+#
+# Also defined, but not for general use are:
+#  QT3_MOC_EXECUTABLE, where to find the moc tool.
+#  QT3_UIC_EXECUTABLE, where to find the uic tool.
+#  QT3_QT_LIBRARY, where to find the Qt library.
+#  QT3_QTMAIN_LIBRARY, where to find the qtmain 
+#   library. This is only required by Qt3 on Windows.
+
+# These are around for backwards compatibility 
+# they will be set
+#  QT_WRAP_CPP, set true if QT3_MOC_EXECUTABLE is found
+#  QT_WRAP_UI set true if QT3_UIC_EXECUTABLE is found
+
+FILE(GLOB GLOB_PATHS_BIN /usr/lib/qt-3*/bin/)
+FIND_PATH(QT3_INCLUDE_DIR qt.h
+  "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.1;InstallDir]/include/Qt"
+  "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]/include/Qt"
+  "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]/include/Qt"
+  $ENV{QTDIR}/include
+  ${GLOB_PATHS_BIN}
+  /usr/local/qt/include
+  /usr/lib/qt/include
+  /usr/lib/qt3/include
+  /usr/include/qt
+  /usr/share/qt3/include
+  C:/Progra~1/qt/include
+  /usr/include/qt3
+  /usr/X11R6/include
+  )
+
+# if qglobal.h is not in the qt_include_dir then set
+# QT3_INCLUDE_DIR to NOTFOUND
+IF(NOT EXISTS ${QT3_INCLUDE_DIR}/qglobal.h)
+  SET(QT3_INCLUDE_DIR QT3_INCLUDE_DIR-NOTFOUND CACHE PATH "path to qt3 include directory" FORCE)
+ENDIF(NOT EXISTS ${QT3_INCLUDE_DIR}/qglobal.h)
+
+IF(QT3_INCLUDE_DIR)
+  #extract the version string from qglobal.h
+  FILE(READ ${QT3_INCLUDE_DIR}/qglobal.h QGLOBAL_H)
+  STRING(REGEX MATCH "#define[\t ]+QT_VERSION_STR[\t ]+\"([0-9]+.[0-9]+.[0-9]+)\"" QGLOBAL_H "${QGLOBAL_H}")
+  STRING(REGEX REPLACE ".*\"([0-9]+.[0-9]+.[0-9]+)\".*" "\\1" qt_version_str "${QGLOBAL_H}")
+
+  # Under windows the qt library (MSVC) has the format qt-mtXYZ where XYZ is the
+  # version X.Y.Z, so we need to remove the dots from version
+  STRING(REGEX REPLACE "\\." "" qt_version_str_lib "${qt_version_str}")
+ELSE(QT3_INCLUDE_DIR)
+ENDIF(QT3_INCLUDE_DIR)
+
+FILE(GLOB GLOB_PATHS_LIB /usr/lib/qt-3*/lib/)
+IF (QT_MT_REQUIRED)
+  FIND_LIBRARY(QT3_QT_LIBRARY
+    NAMES
+    qt-mt qt-mt${qt_version_str_lib} qt-mtnc${qt_version_str_lib}
+    qt-mtedu${qt_version_str_lib} qt-mt230nc qt-mtnc321 qt-mt3
+    PATHS
+  "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.1;InstallDir]/lib"
+  "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]/lib"
+  "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]/lib"
+    $ENV{QTDIR}/lib
+    ${GLOB_PATHS_LIB}
+    /usr/local/qt/lib
+    /usr/lib/qt/lib
+    /usr/lib/qt3/lib
+    /usr/lib/qt3/lib64
+    /usr/share/qt3/lib
+    C:/Progra~1/qt/lib
+    /usr/X11R6/lib
+    )
+
+ELSE (QT_MT_REQUIRED)
+  FIND_LIBRARY(QT3_QT_LIBRARY
+    NAMES 
+    qt qt-${qt_version_str_lib} qt-edu${qt_version_str_lib} 
+    qt-mt qt-mt${qt_version_str_lib} qt-mtnc${qt_version_str_lib}
+    qt-mtedu${qt_version_str_lib} qt-mt230nc qt-mtnc321 qt-mt3
+    PATHS
+    "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.1;InstallDir]/lib"
+    "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]/lib"
+    "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]/lib"
+    $ENV{QTDIR}/lib
+    ${GLOB_PATHS_LIB}
+    /usr/local/qt/lib
+    /usr/lib/qt/lib
+    /usr/lib/qt3/lib
+    /usr/lib/qt3/lib64
+    /usr/share/qt3/lib
+    C:/Progra~1/qt/lib
+    /usr/X11R6/lib
+    )
+ENDIF (QT_MT_REQUIRED)
+
+IF(QT3_QT_LIBRARY)
+ELSE(QT3_QT_LIBRARY)
+ENDIF(QT3_QT_LIBRARY)
+
+
+FIND_LIBRARY(QT_QASSISTANTCLIENT_LIBRARY
+  NAMES qassistantclient
+  PATHS
+  "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.1;InstallDir]/lib"
+  "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]/lib"
+  "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]/lib"
+  $ENV{QTDIR}/lib
+  ${GLOB_PATHS_LIB}
+  /usr/local/qt/lib
+  /usr/lib/qt3/lib
+  /usr/lib/qt3/lib64
+  /usr/share/qt3/lib
+  C:/Progra~1/qt/lib
+  /usr/X11R6/lib
+  )
+
+# qt 3 should prefer QTDIR over the PATH
+FIND_PROGRAM(QT3_MOC_EXECUTABLE 
+  NAMES moc moc-qt3
+  PATHS 
+  $ENV{QTDIR}/bin 
+  NO_DEFAULT_PATH
+)
+
+FIND_PROGRAM(QT3_MOC_EXECUTABLE 
+  NAMES moc moc-qt3
+  PATHS 
+  "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.1;InstallDir]/include/Qt"
+  "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]/include/Qt"
+  "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]/include/Qt"
+  $ENV{QTDIR}/bin 
+  ${GLOB_PATHS_BIN}
+  /usr/local/qt/bin
+  /usr/lib/qt/bin
+  /usr/lib/qt3/bin
+  /usr/share/qt3/bin
+  C:/Progra~1/qt/bin
+  /usr/X11R6/bin
+  )
+
+IF(QT3_MOC_EXECUTABLE)
+  SET ( QT_WRAP_CPP "YES")
+ELSE(QT3_MOC_EXECUTABLE)
+ENDIF(QT3_MOC_EXECUTABLE)
+
+# qt 3 should prefer QTDIR over the PATH
+FIND_PROGRAM(QT3_UIC_EXECUTABLE uic
+  PATHS 
+  $ENV{QTDIR}/bin 
+  NO_DEFAULT_PATH
+)
+FIND_PROGRAM(QT3_UIC_EXECUTABLE uic
+  "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.1;InstallDir]/include/Qt"
+  "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]/include/Qt"
+  "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]/include/Qt"
+  $ENV{QTDIR}/bin 
+  ${GLOB_PATHS_BIN}
+  /usr/local/qt/bin
+  /usr/lib/qt/bin
+  /usr/lib/qt3/bin
+  /usr/share/qt3/bin
+  C:/Progra~1/qt/bin
+  /usr/X11R6/bin
+  )
+
+IF(QT3_UIC_EXECUTABLE)
+  SET ( QT_WRAP_UI "YES")
+ELSE(QT3_UIC_EXECUTABLE)
+ENDIF(QT3_UIC_EXECUTABLE)
+
+IF (WIN32)
+  FIND_LIBRARY(QT3_QTMAIN_LIBRARY qtmain
+    "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.1;InstallDir]/lib"
+    "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]/lib"
+    "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]/lib"
+    "$ENV{ProgramFiles}/qt/lib"
+    $ENV{QTDIR}/lib "C:/Program Files/qt/lib"
+    DOC "This Library is only needed by and included with Qt3 on MSWindows. It should be NOTFOUND, undefined or IGNORE otherwise."
+    )
+ENDIF (WIN32)
+
+
+IF (QT3_MIN_VERSION)
+
+  STRING(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" qt_major_vers "${qt_version_str}")
+  STRING(REGEX REPLACE "[0-9]+\\.([0-9]+)\\.[0-9]+" "\\1" qt_minor_vers "${qt_version_str}")
+  STRING(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" qt_patch_vers "${qt_version_str}")
+  
+  #now parse the parts of the user given version string into variables 
+  STRING(REGEX MATCH "^[0-9]+\\.[0-9]+\\.[0-9]+$" req_qt_major_vers "${QT3_MIN_VERSION}")
+  IF (NOT req_qt_major_vers)
+    MESSAGE( FATAL_ERROR "Invalid Qt version string given: \"${QT3_MIN_VERSION}\", expected e.g. \"3.1.5\"")
+  ENDIF (NOT req_qt_major_vers)
+  
+  STRING(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" req_qt_major_vers "${QT3_MIN_VERSION}")
+  STRING(REGEX REPLACE "[0-9]+\\.([0-9])+\\.[0-9]+" "\\1" req_qt_minor_vers "${QT3_MIN_VERSION}")
+  STRING(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" req_qt_patch_vers "${QT3_MIN_VERSION}")
+  
+  # req = "6.5.4", qt = "3.2.1"
+  
+  IF (req_qt_major_vers GREATER qt_major_vers)                  # (6 > 3) ?
+    MESSAGE(  FATAL_ERROR "Qt major version not matched (required: ${QT3_MIN_VERSION}, found: ${qt_version_str})")            # yes
+  ELSE  (req_qt_major_vers GREATER qt_major_vers)               # no
+    IF (req_qt_major_vers LESS qt_major_vers)                  # (6 < 3) ?
+      SET( QT_VERSION_BIG_ENOUGH "YES" )                      # yes
+    ELSE (req_qt_major_vers LESS qt_major_vers)                # ( 6==3) ?
+      IF (req_qt_minor_vers GREATER qt_minor_vers)            # (5>2) ?
+        MESSAGE(  FATAL_ERROR "Qt minor version not matched (required: ${QT3_MIN_VERSION}, found: ${qt_version_str})")      # yes
+      ELSE (req_qt_minor_vers GREATER qt_minor_vers)          # no
+        IF (req_qt_minor_vers LESS qt_minor_vers)            # (5<2) ?
+          SET( QT_VERSION_BIG_ENOUGH "YES" )                # yes
+        ELSE (req_qt_minor_vers LESS qt_minor_vers)          # (5==2)
+          IF (req_qt_patch_vers GREATER qt_patch_vers)      # (4>1) ?
+            MESSAGE( FATAL_ERROR "Qt patch level not matched (required: ${QT3_MIN_VERSION}, found: ${qt_version_str})")  # yes
+          ELSE (req_qt_patch_vers GREATER qt_patch_vers)    # (4>1) ?
+            SET( QT_VERSION_BIG_ENOUGH "YES" )             # yes
+          ENDIF (req_qt_patch_vers GREATER qt_patch_vers)   # (4>1) ?
+        ENDIF (req_qt_minor_vers LESS qt_minor_vers)
+      ENDIF (req_qt_minor_vers GREATER qt_minor_vers)
+    ENDIF (req_qt_major_vers LESS qt_major_vers)
+  ENDIF (req_qt_major_vers GREATER qt_major_vers)
+ENDIF (QT3_MIN_VERSION)
+
+# if the include a library are found then we have it
+IF(QT3_INCLUDE_DIR)
+  IF(QT3_QT_LIBRARY)
+    SET( QT3_FOUND "YES" )
+  ENDIF(QT3_QT_LIBRARY)
+ENDIF(QT3_INCLUDE_DIR)
+
+IF(QT3_FOUND)
+  SET( QT3_LIBRARIES ${QT3_LIBRARIES} ${QT3_QT_LIBRARY} )
+  SET( QT3_DEFINITIONS "")
+  
+  IF (WIN32 AND NOT CYGWIN)
+    IF (QT3_QTMAIN_LIBRARY)
+      # for version 3
+      SET (QT3_DEFINITIONS -DQT_DLL -DQT_THREAD_SUPPORT -DNO_DEBUG)
+      SET (QT3_LIBRARIES imm32.lib ${QT3_QT_LIBRARY} ${QT3_QTMAIN_LIBRARY} )
+      SET (QT3_LIBRARIES ${QT3_LIBRARIES} winmm wsock32)
+    ELSE (QT3_QTMAIN_LIBRARY)
+      # for version 2
+      SET (QT3_LIBRARIES imm32.lib ws2_32.lib ${QT3_QT_LIBRARY} )
+    ENDIF (QT3_QTMAIN_LIBRARY)
+  ELSE (WIN32 AND NOT CYGWIN)
+    SET (QT3_LIBRARIES ${QT3_QT_LIBRARY} )
+    
+    SET (QT3_DEFINITIONS -DQT_SHARED -DQT_NO_DEBUG)
+    IF(QT3_QT_LIBRARY MATCHES "qt-mt")
+      SET (QT3_DEFINITIONS ${QT3_DEFINITIONS} -DQT_THREAD_SUPPORT -D_REENTRANT)
+    ENDIF(QT3_QT_LIBRARY MATCHES "qt-mt")
+    
+  ENDIF (WIN32 AND NOT CYGWIN)
+  
+  IF (QT_QASSISTANTCLIENT_LIBRARY)
+    SET (QT3_LIBRARIES ${QT_QASSISTANTCLIENT_LIBRARY} ${QT3_LIBRARIES})
+  ENDIF (QT_QASSISTANTCLIENT_LIBRARY)
+  
+  # Backwards compatibility for CMake1.4 and 1.2
+  SET (QT_MOC_EXE ${QT3_MOC_EXECUTABLE} )
+  SET (QT_UIC_EXE ${QT3_UIC_EXECUTABLE} )
+  # for unix add X11 stuff
+  IF(UNIX)
+    FIND_PACKAGE(X11)
+    IF (X11_FOUND)
+      SET (QT3_LIBRARIES ${QT3_LIBRARIES} ${X11_LIBRARIES})
+    ENDIF (X11_FOUND)
+    IF (CMAKE_DL_LIBS)
+      SET (QT3_LIBRARIES ${QT3_LIBRARIES} ${CMAKE_DL_LIBS})
+    ENDIF (CMAKE_DL_LIBS)
+  ENDIF(UNIX)
+  IF(QT3_QT_LIBRARY MATCHES "qt-mt")
+    FIND_PACKAGE(Threads)
+    SET(QT3_LIBRARIES ${QT3_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
+  ENDIF(QT3_QT_LIBRARY MATCHES "qt-mt")
+ENDIF(QT3_FOUND)
+
+EXEC_PROGRAM(${QT3_MOC_EXECUTABLE} ARGS "-v" OUTPUT_VARIABLE QTVERSION_MOC)
+EXEC_PROGRAM(${QT3_UIC_EXECUTABLE} ARGS "-version" OUTPUT_VARIABLE QTVERSION_UI)
+
+SET(_QT_UIC_VERSION_3 FALSE)
+IF("${QTVERSION_UIC}" MATCHES ".* 3..*")
+  SET(_QT_UIC_VERSION_3 TRUE)
+ENDIF("${QTVERSION_UIC}" MATCHES ".* 3..*")
+
+SET(_QT_MOC_VERSION_3 FALSE)
+IF("${QTVERSION_MOC}" MATCHES ".* 3..*")
+  SET(_QT_MOC_VERSION_3 TRUE)
+ENDIF("${QTVERSION_MOC}" MATCHES ".* 3..*")
+
+SET(QT_WRAP_CPP FALSE)
+IF (QT3_MOC_EXECUTABLE)   
+  IF(_QT_MOC_VERSION_3)
+    SET ( QT_WRAP_CPP TRUE)
+  ENDIF(_QT_MOC_VERSION_3)
+ENDIF (QT3_MOC_EXECUTABLE)   
+
+SET(QT_WRAP_UI FALSE)
+IF (QT3_UIC_EXECUTABLE)   
+  IF(_QT_UIC_VERSION_3)
+    SET ( QT_WRAP_UI TRUE)
+  ENDIF(_QT_UIC_VERSION_3)
+ENDIF (QT3_UIC_EXECUTABLE)   
+
+MARK_AS_ADVANCED(
+  QT3_INCLUDE_DIR
+  QT3_QT_LIBRARY
+  QT3_QTMAIN_LIBRARY
+  QT_QASSISTANTCLIENT_LIBRARY
+  QT3_UIC_EXECUTABLE
+  QT3_MOC_EXECUTABLE
+  QT_WRAP_CPP
+  QT_WRAP_UI
+  ) 
diff --git a/cmake/modules/FindQt4.cmake b/cmake/modules/FindQt4.cmake
new file mode 100644
index 0000000..9122bb3
--- /dev/null
+++ b/cmake/modules/FindQt4.cmake
@@ -0,0 +1,1295 @@
+# - Find QT 4
+# This module can be used to find Qt4.
+# The most important issue is that the Qt4 qmake is available via the system path.
+# This qmake is then used to detect basically everything else.
+# This module defines a number of key variables and macros. First is 
+# QT_USE_FILE which is the path to a CMake file that can be included to compile
+# Qt 4 applications and libraries.  By default, the QtCore and QtGui 
+# libraries are loaded. This behavior can be changed by setting one or more 
+# of the following variables to true:
+#                    QT_DONT_USE_QTCORE
+#                    QT_DONT_USE_QTGUI
+#                    QT_USE_QT3SUPPORT
+#                    QT_USE_QTASSISTANT
+#                    QT_USE_QTDESIGNER
+#                    QT_USE_QTMOTIF
+#                    QT_USE_QTMAIN
+#                    QT_USE_QTNETWORK
+#                    QT_USE_QTNSPLUGIN
+#                    QT_USE_QTOPENGL
+#                    QT_USE_QTSQL
+#                    QT_USE_QTXML
+#                    QT_USE_QTSVG
+#                    QT_USE_QTTEST
+#                    QT_USE_QTUITOOLS
+#                    QT_USE_QTDBUS
+#                    QT_USE_QTSCRIPT
+#
+# All the libraries required are stored in a variable called QT_LIBRARIES.  
+# Add this variable to your TARGET_LINK_LIBRARIES.
+#  
+#  macro QT4_WRAP_CPP(outfiles inputfile ... OPTIONS ...)
+#        create moc code from a list of files containing Qt class with
+#        the Q_OBJECT declaration.  Options may be given to moc, such as those found
+#        when executing "moc -help"
+#
+#  macro QT4_WRAP_UI(outfiles inputfile ... OPTIONS ...)
+#        create code from a list of Qt designer ui files.
+#        Options may be given to uic, such as those found
+#        when executing "uic -help"
+#
+#  macro QT4_ADD_RESOURCES(outfiles inputfile ... OPTIONS ...)
+#        create code from a list of Qt resource files.
+#        Options may be given to rcc, such as those found
+#        when executing "rcc -help"
+#
+#  macro QT4_AUTOMOC(inputfile ... )
+#  macro QT4_GENERATE_MOC(inputfile outputfile )
+#
+#  macro QT4_ADD_DBUS_INTERFACE(outfiles interface basename)
+#        create a the interface header and implementation files with the 
+#        given basename from the given interface xml file and add it to 
+#        the list of sources.
+#        To disable generating a namespace header, set the source file property 
+#        NO_NAMESPACE to TRUE on the interface file.
+#
+#  macro QT4_ADD_DBUS_INTERFACES(outfiles inputfile ... )
+#        create the interface header and implementation files 
+#        for all listed interface xml files
+#        the name will be automatically determined from the name of the xml file
+#        To disable generating namespace headers, set the source file property 
+#        NO_NAMESPACE to TRUE for these inputfiles.
+#
+#  macro QT4_ADD_DBUS_ADAPTOR(outfiles xmlfile parentheader parentclassname [basename] [classname])
+#        create a dbus adaptor (header and implementation file) from the xml file
+#        describing the interface, and add it to the list of sources. The adaptor
+#        forwards the calls to a parent class, defined in parentheader and named
+#        parentclassname. The name of the generated files will be
+#        <basename>adaptor.{cpp,h} where basename defaults to the basename of the xml file.
+#        If <classname> is provided, then it will be used as the classname of the
+#        adaptor itself.
+#
+#  macro QT4_GENERATE_DBUS_INTERFACE( header [interfacename] OPTIONS ...)
+#        generate the xml interface file from the given header.
+#        If the optional argument interfacename is omitted, the name of the 
+#        interface file is constructed from the basename of the header with
+#        the suffix .xml appended.
+#        Options may be given to uic, such as those found when executing "qdbuscpp2xml --help"
+#
+#  QT_FOUND         If false, don't try to use Qt.
+#  QT4_FOUND        If false, don't try to use Qt 4.
+#
+#  QT4_QTCORE_FOUND        True if QtCore was found.
+#  QT4_QTGUI_FOUND         True if QtGui was found.
+#  QT4_QT3SUPPORT_FOUND    True if Qt3Support was found.
+#  QT4_QTASSISTANT_FOUND   True if QtAssistant was found.
+#  QT4_QTDBUS_FOUND        True if QtDBus was found.
+#  QT4_QTDESIGNER_FOUND    True if QtDesigner was found.
+#  QT4_QTDESIGNERCOMPONENTS True if QtDesignerComponents was found.
+#  QT4_QTMOTIF_FOUND       True if QtMotif was found.
+#  QT4_QTNETWORK_FOUND     True if QtNetwork was found.
+#  QT4_QTNSPLUGIN_FOUND    True if QtNsPlugin was found.
+#  QT4_QTOPENGL_FOUND      True if QtOpenGL was found.
+#  QT4_QTSQL_FOUND         True if QtSql was found.
+#  QT4_QTXML_FOUND         True if QtXml was found.
+#  QT4_QTSVG_FOUND         True if QtSvg was found.
+#  QT4_QTSCRIPT_FOUND      True if QtScript was found.
+#  QT4_QTTEST_FOUND        True if QtTest was found.
+#  QT4_QTUITOOLS_FOUND     True if QtUiTools was found.
+#                      
+#  QT4_DEFINITIONS   Definitions to use when compiling code that uses Qt.
+#                  
+#  QT4_INCLUDES      List of paths to all include directories of 
+#                   Qt4 QT4_INCLUDE_DIR and QT4_QTCORE_INCLUDE_DIR are
+#                   always in this variable even if NOTFOUND,
+#                   all other INCLUDE_DIRS are
+#                   only added if they are found.
+#   
+#  QT4_INCLUDE_DIR              Path to "include" of Qt4
+#  QT4_QT4_INCLUDE_DIR           Path to "include/Qt" 
+#  QT4_QT3SUPPORT_INCLUDE_DIR   Path to "include/Qt3Support" 
+#  QT4_QTASSISTANT_INCLUDE_DIR  Path to "include/QtAssistant" 
+#  QT4_QTCORE_INCLUDE_DIR       Path to "include/QtCore"         
+#  QT4_QTDESIGNER_INCLUDE_DIR   Path to "include/QtDesigner" 
+#  QT4_QTDESIGNERCOMPONENTS_INCLUDE_DIR   Path to "include/QtDesigner"
+#  QT4_QTDBUS_INCLUDE_DIR       Path to "include/QtDBus" 
+#  QT4_QTGUI_INCLUDE_DIR        Path to "include/QtGui" 
+#  QT4_QTMOTIF_INCLUDE_DIR      Path to "include/QtMotif" 
+#  QT4_QTNETWORK_INCLUDE_DIR    Path to "include/QtNetwork" 
+#  QT4_QTNSPLUGIN_INCLUDE_DIR   Path to "include/QtNsPlugin" 
+#  QT4_QTOPENGL_INCLUDE_DIR     Path to "include/QtOpenGL" 
+#  QT4_QTSQL_INCLUDE_DIR        Path to "include/QtSql" 
+#  QT4_QTXML_INCLUDE_DIR        Path to "include/QtXml" 
+#  QT4_QTSVG_INCLUDE_DIR        Path to "include/QtSvg"
+#  QT4_QTSCRIPT_INCLUDE_DIR     Path to "include/QtScript"
+#  QT4_QTTEST_INCLUDE_DIR       Path to "include/QtTest"
+#                            
+#  QT4_LIBRARY_DIR              Path to "lib" of Qt4
+# 
+#  QT4_PLUGINS_DIR              Path to "plugins" for Qt4
+#                            
+# For every library of Qt, a QT4_QTFOO_LIBRARY variable is defined, with the full path to the library.
+#
+# So there are the following variables:
+# The Qt3Support library:     QT4_QT3SUPPORT_LIBRARY
+#
+# The QtAssistant library:    QT4_QTASSISTANT_LIBRARY
+#
+# The QtCore library:         QT4_QTCORE_LIBRARY
+#
+# The QtDBus library:         QT4_QTDBUS_LIBRARY
+#
+# The QtDesigner library:     QT4_QTDESIGNER_LIBRARY
+#
+# The QtDesignerComponents library:     QT4_QTDESIGNERCOMPONENTS_LIBRARY
+#
+# The QtGui library:          QT4_QTGUI_LIBRARY
+#
+# The QtMotif library:        QT4_QTMOTIF_LIBRARY
+#
+# The QtNetwork library:      QT4_QTNETWORK_LIBRARY
+#
+# The QtNsPLugin library:     QT4_QTNSPLUGIN_LIBRARY
+#
+# The QtOpenGL library:       QT4_QTOPENGL_LIBRARY
+#
+# The QtSql library:          QT4_QTSQL_LIBRARY
+#
+# The QtXml library:          QT4_QTXML_LIBRARY
+#
+# The QtSvg library:          QT4_QTSVG_LIBRARY
+#
+# The QtScript library:       QT4_QTSCRIPT_LIBRARY
+#
+# The QtTest library:         QT4_QTTEST_LIBRARY
+#
+# The qtmain library for Windows QT4_QTMAIN_LIBRARY
+#
+# The QtUiTools library:      QT4_QTUITOOLS_LIBRARY
+#  
+# also defined, but NOT for general use are
+#  QT4_MOC_EXECUTABLE         Where to find the moc tool.
+#  QT4_UIC_EXECUTABLE         Where to find the uic tool.
+#  QT_UIC3_EXECUTABLE         Where to find the uic3 tool.
+#  QT_RCC_EXECUTABLE          Where to find the rcc tool
+#  QT_DBUSCPP2XML_EXECUTABLE  Where to find the qdbuscpp2xml tool.
+#  QT_DBUSXML2CPP_EXECUTABLE  Where to find the qdbusxml2cpp tool.
+#  
+#  QT_DOC_DIR                Path to "doc" of Qt4
+#  QT_MKSPECS_DIR            Path to "mkspecs" of Qt4
+#
+#
+# These are around for backwards compatibility 
+# they will be set
+#  QT_WRAP_CPP  Set true if QT4_MOC_EXECUTABLE is found
+#  QT_WRAP_UI   Set true if QT4_UIC_EXECUTABLE is found
+#  
+# These variables do _NOT_ have any effect anymore (compared to FindQt.cmake)
+#  QT_MT_REQUIRED         Qt4 is now always multithreaded
+#  
+# These variables are set to "" Because Qt structure changed 
+# (They make no sense in Qt4)
+#  QT4_QT_LIBRARY        Qt-Library is now split
+
+# Copyright (c) 2002 Kitware, Inc., Insight Consortium.  All rights reserved.
+# See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
+
+if (QT4_QMAKE_FOUND)
+   # Check already done in this cmake run, nothing more to do
+
+else (QT4_QMAKE_FOUND)
+
+# check that QT_NO_DEBUG is defined for release configurations
+MACRO(QT_CHECK_FLAG_EXISTS FLAG VAR DOC)
+  IF(NOT ${VAR} MATCHES "${FLAG}")
+    SET(${VAR} "${${VAR}} ${FLAG}" 
+      CACHE STRING "Flags used by the compiler during ${DOC} builds." FORCE)
+  ENDIF(NOT ${VAR} MATCHES "${FLAG}")
+ENDMACRO(QT_CHECK_FLAG_EXISTS FLAG VAR)
+QT_CHECK_FLAG_EXISTS(-DQT_NO_DEBUG CMAKE_CXX_FLAGS_RELWITHDEBINFO "Release with Debug Info")
+QT_CHECK_FLAG_EXISTS(-DQT_NO_DEBUG CMAKE_CXX_FLAGS_RELEASE "release")
+QT_CHECK_FLAG_EXISTS(-DQT_NO_DEBUG CMAKE_CXX_FLAGS_MINSIZEREL "release minsize")
+
+INCLUDE(CheckSymbolExists)
+INCLUDE(MacroAddFileDependencies)
+INCLUDE(MacroPushRequiredVars)
+
+SET(QT_USE_FILE ${CMAKE_ROOT}/Modules/UseQt4.cmake)
+
+SET( QT4_DEFINITIONS "")
+
+IF (WIN32)
+  SET(QT4_DEFINITIONS -DQT_DLL)
+ENDIF(WIN32)
+
+SET(QT4_INSTALLED_VERSION_TOO_OLD FALSE)
+
+#  macro for asking qmake to process pro files
+MACRO(QT_QUERY_QMAKE outvar invar)
+  FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmpQmake/tmp.pro
+    "message(CMAKE_MESSAGE<$$${invar}>)")
+
+  # Invoke qmake with the tmp.pro program to get the desired
+  # information.  Use the same variable for both stdout and stderr
+  # to make sure we get the output on all platforms.
+  EXECUTE_PROCESS(COMMAND ${QT_QMAKE_EXECUTABLE}
+    WORKING_DIRECTORY  
+    ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmpQmake
+    OUTPUT_VARIABLE _qmake_query_output
+    RESULT_VARIABLE _qmake_result
+    ERROR_VARIABLE _qmake_query_output )
+  
+  FILE(REMOVE_RECURSE 
+    "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmpQmake")
+
+  IF(_qmake_result)
+    MESSAGE(WARNING " querying qmake for ${invar}.  qmake reported:\n${_qmake_query_output}")
+  ELSE(_qmake_result)
+    STRING(REGEX REPLACE ".*CMAKE_MESSAGE<([^>]*).*" "\\1" ${outvar} "${_qmake_query_output}")
+  ENDIF(_qmake_result)
+
+ENDMACRO(QT_QUERY_QMAKE)
+
+GET_FILENAME_COMPONENT(qt_install_version "[HKEY_CURRENT_USER\\Software\\trolltech\\Versions;DefaultQtVersion]" NAME)
+# check for qmake
+FIND_PROGRAM(QT_QMAKE_EXECUTABLE NAMES qmake qmake4 qmake-qt4 PATHS
+  "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\4.0.0;InstallDir]/bin"
+  "[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\4.0.0;InstallDir]/bin"
+  "[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\${qt_install_version};InstallDir]/bin"
+  $ENV{QTDIR}/bin
+)
+
+IF (QT_QMAKE_EXECUTABLE)
+
+  SET(QT4_QMAKE_FOUND FALSE)
+  
+  EXEC_PROGRAM(${QT_QMAKE_EXECUTABLE} ARGS "-query QT_VERSION" OUTPUT_VARIABLE QTVERSION)
+
+  # check for qt3 qmake and then try and find qmake4 or qmake-qt4 in the path
+  IF("${QTVERSION}" MATCHES "Unknown")
+    SET(QT_QMAKE_EXECUTABLE NOTFOUND CACHE FILEPATH "" FORCE)
+    FIND_PROGRAM(QT_QMAKE_EXECUTABLE NAMES qmake4 qmake-qt4 PATHS
+      "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\4.0.0;InstallDir]/bin"
+      "[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\4.0.0;InstallDir]/bin"
+      $ENV{QTDIR}/bin
+      )
+    IF(QT_QMAKE_EXECUTABLE)
+      EXEC_PROGRAM(${QT_QMAKE_EXECUTABLE} 
+        ARGS "-query QT_VERSION" OUTPUT_VARIABLE QTVERSION)
+    ENDIF(QT_QMAKE_EXECUTABLE)
+  ENDIF("${QTVERSION}" MATCHES "Unknown")
+
+  # check that we found the Qt4 qmake, Qt3 qmake output won't match here
+  STRING(REGEX MATCH "^[0-9]+\\.[0-9]+\\.[0-9]+" qt_version_tmp "${QTVERSION}")
+  IF (qt_version_tmp)
+
+    # we need at least version 4.0.0
+    IF (NOT QT4_MIN_VERSION)
+      SET(QT4_MIN_VERSION "4.0.0")
+    ENDIF (NOT QT4_MIN_VERSION)
+
+    #now parse the parts of the user given version string into variables
+    STRING(REGEX MATCH "^[0-9]+\\.[0-9]+\\.[0-9]+" req_qt_major_vers "${QT4_MIN_VERSION}")
+    IF (NOT req_qt_major_vers)
+      MESSAGE( FATAL_ERROR "Invalid Qt version string given: \"${QT4_MIN_VERSION}\", expected e.g. \"4.0.1\"")
+    ENDIF (NOT req_qt_major_vers)
+
+    # now parse the parts of the user given version string into variables
+    STRING(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" req_qt_major_vers "${QT4_MIN_VERSION}")
+    STRING(REGEX REPLACE "^[0-9]+\\.([0-9])+\\.[0-9]+" "\\1" req_qt_minor_vers "${QT4_MIN_VERSION}")
+    STRING(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" req_qt_patch_vers "${QT4_MIN_VERSION}")
+
+    IF (NOT req_qt_major_vers EQUAL 4)
+      MESSAGE( FATAL_ERROR "Invalid Qt version string given: \"${QT4_MIN_VERSION}\", major version 4 is required, e.g. \"4.0.1\"")
+    ENDIF (NOT req_qt_major_vers EQUAL 4)
+
+    # and now the version string given by qmake
+    STRING(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" found_qt_major_vers "${QTVERSION}")
+    STRING(REGEX REPLACE "^[0-9]+\\.([0-9])+\\.[0-9]+.*" "\\1" found_qt_minor_vers "${QTVERSION}")
+    STRING(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" found_qt_patch_vers "${QTVERSION}")
+
+    # compute an overall version number which can be compared at once
+    MATH(EXPR req_vers "${req_qt_major_vers}*10000 + ${req_qt_minor_vers}*100 + ${req_qt_patch_vers}")
+    MATH(EXPR found_vers "${found_qt_major_vers}*10000 + ${found_qt_minor_vers}*100 + ${found_qt_patch_vers}")
+
+    IF (found_vers LESS req_vers)
+      SET(QT4_QMAKE_FOUND FALSE)
+      SET(QT4_INSTALLED_VERSION_TOO_OLD TRUE)
+    ELSE (found_vers LESS req_vers)
+      SET(QT4_QMAKE_FOUND TRUE)
+    ENDIF (found_vers LESS req_vers)
+  ENDIF (qt_version_tmp)
+
+ENDIF (QT_QMAKE_EXECUTABLE)
+
+IF (QT4_QMAKE_FOUND)
+
+  if (WIN32)
+    # get qt install dir 
+    get_filename_component(_DIR ${QT_QMAKE_EXECUTABLE} PATH )
+    get_filename_component(QT_INSTALL_DIR ${_DIR} PATH )
+  endif (WIN32)
+
+  # ask qmake for the library dir
+  # Set QT4_LIBRARY_DIR
+  IF (NOT QT4_LIBRARY_DIR)
+    EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE}
+      ARGS "-query QT_INSTALL_LIBS"
+      OUTPUT_VARIABLE QT4_LIBRARY_DIR_TMP )
+    IF(EXISTS "${QT4_LIBRARY_DIR_TMP}")
+      SET(QT4_LIBRARY_DIR ${QT4_LIBRARY_DIR_TMP} CACHE PATH "Qt library dir")
+    ELSE(EXISTS "${QT4_LIBRARY_DIR_TMP}")
+      MESSAGE("Warning: QT_QMAKE_EXECUTABLE reported QT_INSTALL_LIBS as ${QT4_LIBRARY_DIR_TMP}")
+      MESSAGE("Warning: ${QT4_LIBRARY_DIR_TMP} does NOT exist, Qt must NOT be installed correctly.")
+    ENDIF(EXISTS "${QT4_LIBRARY_DIR_TMP}")
+  ENDIF(NOT QT4_LIBRARY_DIR)
+  
+  IF (APPLE)
+    IF (EXISTS ${QT4_LIBRARY_DIR}/QtCore.framework)
+      SET(QT_USE_FRAMEWORKS ON
+        CACHE BOOL "Set to ON if Qt build uses frameworks.")
+    ELSE (EXISTS ${QT4_LIBRARY_DIR}/QtCore.framework)
+      SET(QT_USE_FRAMEWORKS OFF
+        CACHE BOOL "Set to ON if Qt build uses frameworks.")
+    ENDIF (EXISTS ${QT4_LIBRARY_DIR}/QtCore.framework)
+    
+    MARK_AS_ADVANCED(QT_USE_FRAMEWORKS)
+  ENDIF (APPLE)
+  
+  # ask qmake for the binary dir
+  IF (NOT QT_BINARY_DIR)
+     EXEC_PROGRAM(${QT_QMAKE_EXECUTABLE}
+        ARGS "-query QT_INSTALL_BINS"
+        OUTPUT_VARIABLE qt_bins )
+     SET(QT_BINARY_DIR ${qt_bins} CACHE INTERNAL "")
+  ENDIF (NOT QT_BINARY_DIR)
+
+  # ask qmake for the include dir
+  IF (NOT QT_HEADERS_DIR)
+      EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE}
+        ARGS "-query QT_INSTALL_HEADERS" 
+        OUTPUT_VARIABLE qt_headers )
+      SET(QT_HEADERS_DIR ${qt_headers} CACHE INTERNAL "")
+  ENDIF(NOT QT_HEADERS_DIR)
+
+
+  # ask qmake for the documentation directory
+  IF (NOT QT_DOC_DIR)
+    EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE}
+      ARGS "-query QT_INSTALL_DOCS"
+      OUTPUT_VARIABLE qt_doc_dir )
+    SET(QT_DOC_DIR ${qt_doc_dir} CACHE PATH "The location of the Qt docs")
+  ENDIF (NOT QT_DOC_DIR)
+
+  # ask qmake for the mkspecs directory
+  IF (NOT QT_MKSPECS_DIR)
+    EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE}
+      ARGS "-query QMAKE_MKSPECS"
+      OUTPUT_VARIABLE qt_mkspecs_dirs )
+    STRING(REPLACE ":" ";" qt_mkspecs_dirs "${qt_mkspecs_dirs}")
+    FIND_PATH(QT_MKSPECS_DIR qconfig.pri PATHS ${qt_mkspecs_dirs}
+      DOC "The location of the Qt mkspecs containing qconfig.pri"
+      NO_DEFAULT_PATH )
+  ENDIF (NOT QT_MKSPECS_DIR)
+
+  # ask qmake for the plugins directory
+  IF (NOT QT4_PLUGINS_DIR)
+    EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE}
+      ARGS "-query QT_INSTALL_PLUGINS"
+      OUTPUT_VARIABLE qt_plugins_dir )
+    SET(QT4_PLUGINS_DIR ${qt_plugins_dir} CACHE PATH "The location of the Qt plugins")
+  ENDIF (NOT QT4_PLUGINS_DIR)
+  ########################################
+  #
+  #       Setting the INCLUDE-Variables
+  #
+  ########################################
+
+  FIND_PATH(QT4_QTCORE_INCLUDE_DIR QtGlobal
+    ${QT_HEADERS_DIR}/QtCore
+    ${QT4_LIBRARY_DIR}/QtCore.framework/Headers
+    NO_DEFAULT_PATH
+    )
+
+  # Set QT4_INCLUDE_DIR by removine "/QtCore" in the string ${QT4_QTCORE_INCLUDE_DIR}
+  IF( QT4_QTCORE_INCLUDE_DIR AND NOT QT4_INCLUDE_DIR)
+    IF (QT_USE_FRAMEWORKS)
+      SET(QT4_INCLUDE_DIR ${QT_HEADERS_DIR})
+    ELSE (QT_USE_FRAMEWORKS)
+      STRING( REGEX REPLACE "/QtCore$" "" qt4_include_dir ${QT4_QTCORE_INCLUDE_DIR})
+      SET( QT4_INCLUDE_DIR ${qt4_include_dir} CACHE PATH "")
+    ENDIF (QT_USE_FRAMEWORKS)
+  ENDIF( QT4_QTCORE_INCLUDE_DIR AND NOT QT4_INCLUDE_DIR)
+
+  IF( NOT QT4_INCLUDE_DIR)
+    IF( NOT Qt4_FIND_QUIETLY AND Qt4_FIND_REQUIRED)
+      MESSAGE( FATAL_ERROR "Could NOT find QtGlobal header")
+    ENDIF( NOT Qt4_FIND_QUIETLY AND Qt4_FIND_REQUIRED)
+  ENDIF( NOT QT4_INCLUDE_DIR)
+
+  #############################################
+  #
+  # Find out what window system we're using
+  #
+  #############################################
+  # Save required includes and required_flags variables
+  macro_push_required_vars()
+  # Add QT4_INCLUDE_DIR to CMAKE_REQUIRED_INCLUDES
+  SET(CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES};${QT4_INCLUDE_DIR}")
+  # On Mac OS X when Qt has framework support, also add the framework path
+  IF( QT_USE_FRAMEWORKS )
+    SET(CMAKE_REQUIRED_FLAGS "-F${QT4_LIBRARY_DIR} ")
+  ENDIF( QT_USE_FRAMEWORKS )
+  # Check for Window system symbols (note: only one should end up being set)
+  CHECK_SYMBOL_EXISTS(Q_WS_X11 "QtCore/qglobal.h" Q_WS_X11)
+  CHECK_SYMBOL_EXISTS(Q_WS_WIN "QtCore/qglobal.h" Q_WS_WIN)
+  CHECK_SYMBOL_EXISTS(Q_WS_QWS "QtCore/qglobal.h" Q_WS_QWS)
+  CHECK_SYMBOL_EXISTS(Q_WS_MAC "QtCore/qglobal.h" Q_WS_MAC)
+
+  IF (QT4_QTCOPY_REQUIRED)
+     CHECK_SYMBOL_EXISTS(QT_IS_QTCOPY "QtCore/qglobal.h" QT_KDE_QT_COPY)
+     IF (NOT QT_IS_QTCOPY)
+        MESSAGE(FATAL_ERROR "qt-copy is required, but hasn't been found")
+     ENDIF (NOT QT_IS_QTCOPY)
+  ENDIF (QT4_QTCOPY_REQUIRED)
+
+  # Restore CMAKE_REQUIRED_INCLUDES+CMAKE_REQUIRED_FLAGS variables
+  macro_pop_required_vars()
+  #
+  #############################################
+
+  IF (QT_USE_FRAMEWORKS)
+    SET(QT4_DEFINITIONS ${QT4_DEFINITIONS} -F${QT4_LIBRARY_DIR} -L${QT4_LIBRARY_DIR} )
+  ENDIF (QT_USE_FRAMEWORKS)
+
+  # Set QT4_QT3SUPPORT_INCLUDE_DIR
+  FIND_PATH(QT4_QT3SUPPORT_INCLUDE_DIR Qt3Support
+    PATHS
+    ${QT4_INCLUDE_DIR}/Qt3Support
+    ${QT4_LIBRARY_DIR}/Qt3Support.framework/Headers
+    NO_DEFAULT_PATH
+    )
+
+  # Set QT4_QT4_INCLUDE_DIR
+  FIND_PATH(QT4_QT4_INCLUDE_DIR qglobal.h
+    PATHS
+    ${QT4_INCLUDE_DIR}/Qt
+    ${QT4_LIBRARY_DIR}/QtCore.framework/Headers
+    NO_DEFAULT_PATH
+    )
+
+  # Set QT4_QTGUI_INCLUDE_DIR
+  FIND_PATH(QT4_QTGUI_INCLUDE_DIR QtGui
+    PATHS
+    ${QT4_INCLUDE_DIR}/QtGui
+    ${QT4_LIBRARY_DIR}/QtGui.framework/Headers
+    NO_DEFAULT_PATH
+    )
+
+  # Set QT4_QTSVG_INCLUDE_DIR
+  FIND_PATH(QT4_QTSVG_INCLUDE_DIR QtSvg
+    PATHS
+    ${QT4_INCLUDE_DIR}/QtSvg
+    ${QT4_LIBRARY_DIR}/QtSvg.framework/Headers
+    NO_DEFAULT_PATH
+    )
+
+  # Set QT4_QTSCRIPT_INCLUDE_DIR
+  FIND_PATH(QT4_QTSCRIPT_INCLUDE_DIR QtScript
+    PATHS
+    ${QT4_INCLUDE_DIR}/QtScript
+    ${QT4_LIBRARY_DIR}/QtScript.framework/Headers
+    NO_DEFAULT_PATH
+    )
+
+  # Set QT4_QTTEST_INCLUDE_DIR
+  FIND_PATH(QT4_QTTEST_INCLUDE_DIR QtTest
+    PATHS
+    ${QT4_INCLUDE_DIR}/QtTest
+    ${QT4_LIBRARY_DIR}/QtTest.framework/Headers
+    NO_DEFAULT_PATH
+    )
+
+  # Set QT4_QTUITOOLS_INCLUDE_DIR
+  FIND_PATH(QT4_QTUITOOLS_INCLUDE_DIR QtUiTools
+    PATHS
+    ${QT4_INCLUDE_DIR}/QtUiTools
+    ${QT4_LIBRARY_DIR}/QtUiTools.framework/Headers
+    NO_DEFAULT_PATH
+    )
+
+
+
+  # Set QT4_QTMOTIF_INCLUDE_DIR
+  IF(Q_WS_X11)
+    FIND_PATH(QT4_QTMOTIF_INCLUDE_DIR QtMotif PATHS ${QT4_INCLUDE_DIR}/QtMotif NO_DEFAULT_PATH )
+  ENDIF(Q_WS_X11)
+
+  # Set QT4_QTNETWORK_INCLUDE_DIR
+  FIND_PATH(QT4_QTNETWORK_INCLUDE_DIR QtNetwork
+    PATHS
+    ${QT4_INCLUDE_DIR}/QtNetwork
+    ${QT4_LIBRARY_DIR}/QtNetwork.framework/Headers
+    NO_DEFAULT_PATH
+    )
+
+  # Set QT4_QTNSPLUGIN_INCLUDE_DIR
+  FIND_PATH(QT4_QTNSPLUGIN_INCLUDE_DIR QtNsPlugin
+    PATHS
+    ${QT4_INCLUDE_DIR}/QtNsPlugin
+    ${QT4_LIBRARY_DIR}/QtNsPlugin.framework/Headers
+    NO_DEFAULT_PATH
+    )
+
+  # Set QT4_QTOPENGL_INCLUDE_DIR
+  FIND_PATH(QT4_QTOPENGL_INCLUDE_DIR QtOpenGL
+    PATHS
+    ${QT4_INCLUDE_DIR}/QtOpenGL
+    ${QT4_LIBRARY_DIR}/QtOpenGL.framework/Headers
+    NO_DEFAULT_PATH
+    )
+
+  # Set QT4_QTSQL_INCLUDE_DIR
+  FIND_PATH(QT4_QTSQL_INCLUDE_DIR QtSql
+    PATHS
+    ${QT4_INCLUDE_DIR}/QtSql
+    ${QT4_LIBRARY_DIR}/QtSql.framework/Headers
+    NO_DEFAULT_PATH
+    )
+
+  # Set QT4_QTXML_INCLUDE_DIR
+  FIND_PATH(QT4_QTXML_INCLUDE_DIR QtXml
+    PATHS
+    ${QT4_INCLUDE_DIR}/QtXml
+    ${QT4_LIBRARY_DIR}/QtXml.framework/Headers
+    NO_DEFAULT_PATH
+    )
+
+  # Set QT4_QTASSISTANT_INCLUDE_DIR
+  FIND_PATH(QT4_QTASSISTANT_INCLUDE_DIR QtAssistant
+    PATHS
+    ${QT4_INCLUDE_DIR}/QtAssistant
+    ${QT_HEADERS_DIR}/QtAssistant
+    ${QT4_LIBRARY_DIR}/QtAssistant.framework/Headers
+    NO_DEFAULT_PATH
+    )
+
+  # Set QT4_QTDESIGNER_INCLUDE_DIR
+  FIND_PATH(QT4_QTDESIGNER_INCLUDE_DIR QDesignerComponents
+    PATHS
+    ${QT4_INCLUDE_DIR}/QtDesigner
+    ${QT_HEADERS_DIR}/QtDesigner 
+    ${QT4_LIBRARY_DIR}/QtDesigner.framework/Headers
+    NO_DEFAULT_PATH
+    )
+
+  # Set QT4_QTDESIGNERCOMPONENTS_INCLUDE_DIR
+  FIND_PATH(QT4_QTDESIGNERCOMPONENTS_INCLUDE_DIR QDesignerComponents
+    PATHS
+    ${QT4_INCLUDE_DIR}/QtDesigner
+    ${QT_HEADERS_DIR}/QtDesigner
+    NO_DEFAULT_PATH
+    )
+
+
+  # Set QT4_QTDBUS_INCLUDE_DIR
+  FIND_PATH(QT4_QTDBUS_INCLUDE_DIR QtDBus
+    PATHS
+    ${QT4_INCLUDE_DIR}/QtDBus
+    ${QT_HEADERS_DIR}/QtDBus
+    NO_DEFAULT_PATH
+    )
+
+  # Make variables changeble to the advanced user
+  MARK_AS_ADVANCED( QT4_LIBRARY_DIR QT4_INCLUDE_DIR QT4_QT4_INCLUDE_DIR QT_DOC_DIR QT_MKSPECS_DIR QT4_PLUGINS_DIR)
+
+  # Set QT4_INCLUDES
+  SET( QT4_INCLUDES ${QT4_QT4_INCLUDE_DIR} ${QT_MKSPECS_DIR}/default ${QT4_INCLUDE_DIR})
+
+
+  ########################################
+  #
+  #       Setting the LIBRARY-Variables
+  #
+  ########################################
+
+  IF (QT_USE_FRAMEWORKS)
+    # If FIND_LIBRARY found libraries in Apple frameworks, we would NOT have
+    # to jump through these hoops.
+    IF(EXISTS ${QT4_LIBRARY_DIR}/QtCore.framework)
+      SET(QT4_QTCORE_FOUND TRUE)
+      SET(QT4_QTCORE_LIBRARY "-F${QT4_LIBRARY_DIR} -framework QtCore" CACHE STRING "The QtCore library.")
+    ELSE(EXISTS ${QT4_LIBRARY_DIR}/QtCore.framework)
+      SET(QT4_QTCORE_FOUND FALSE)
+    ENDIF(EXISTS ${QT4_LIBRARY_DIR}/QtCore.framework)
+
+    IF(EXISTS ${QT4_LIBRARY_DIR}/QtGui.framework)
+      SET(QT4_QTGUI_FOUND TRUE)
+      SET(QT4_QTGUI_LIBRARY "-F${QT4_LIBRARY_DIR} -framework QtGui" CACHE STRING "The QtGui library.")
+    ELSE(EXISTS ${QT4_LIBRARY_DIR}/QtGui.framework)
+      SET(QT4_QTGUI_FOUND FALSE)
+    ENDIF(EXISTS ${QT4_LIBRARY_DIR}/QtGui.framework)
+
+    IF(EXISTS ${QT4_LIBRARY_DIR}/Qt3Support.framework)
+      SET(QT4_QT3SUPPORT_FOUND TRUE)
+      SET(QT4_QT3SUPPORT_LIBRARY "-F${QT4_LIBRARY_DIR} -framework Qt3Support" CACHE STRING "The Qt3Support library.")
+    ELSE(EXISTS ${QT4_LIBRARY_DIR}/Qt3Support.framework)
+      SET(QT4_QT3SUPPORT_FOUND FALSE)
+    ENDIF(EXISTS ${QT4_LIBRARY_DIR}/Qt3Support.framework)
+
+    IF(EXISTS ${QT4_LIBRARY_DIR}/QtNetwork.framework)
+      SET(QT4_QTNETWORK_FOUND TRUE)
+      SET(QT4_QTNETWORK_LIBRARY "-F${QT4_LIBRARY_DIR} -framework QtNetwork" CACHE STRING "The QtNetwork library.")
+    ELSE(EXISTS ${QT4_LIBRARY_DIR}/QtNetwork.framework)
+      SET(QT4_QTNETWORK_FOUND FALSE)
+    ENDIF(EXISTS ${QT4_LIBRARY_DIR}/QtNetwork.framework)
+
+    IF(EXISTS ${QT4_LIBRARY_DIR}/QtOpenGL.framework)
+      SET(QT4_QTOPENGL_FOUND TRUE)
+      SET(QT4_QTOPENGL_LIBRARY "-F${QT4_LIBRARY_DIR} -framework QtOpenGL" CACHE STRING "The QtOpenGL library.")
+    ELSE(EXISTS ${QT4_LIBRARY_DIR}/QtOpenGL.framework)
+      SET(QT4_QTOPENGL_FOUND FALSE)
+    ENDIF(EXISTS ${QT4_LIBRARY_DIR}/QtOpenGL.framework)
+
+    IF(EXISTS ${QT4_LIBRARY_DIR}/QtSql.framework)
+      SET(QT4_QTSQL_FOUND TRUE)
+      SET(QT4_QTSQL_LIBRARY "-F${QT4_LIBRARY_DIR} -framework QtSql" CACHE STRING "The QtSql library.")
+    ELSE(EXISTS ${QT4_LIBRARY_DIR}/QtSql.framework)
+      SET(QT4_QTSQL_FOUND FALSE)
+    ENDIF(EXISTS ${QT4_LIBRARY_DIR}/QtSql.framework)
+
+    IF(EXISTS ${QT4_LIBRARY_DIR}/QtXml.framework)
+      SET(QT4_QTXML_FOUND TRUE)
+      SET(QT4_QTXML_LIBRARY "-F${QT4_LIBRARY_DIR} -framework QtXml" CACHE STRING "The QtXml library.")
+    ELSE(EXISTS ${QT4_LIBRARY_DIR}/QtXml.framework)
+      SET(QT4_QTXML_FOUND FALSE)
+    ENDIF(EXISTS ${QT4_LIBRARY_DIR}/QtXml.framework)
+
+    IF(EXISTS ${QT4_LIBRARY_DIR}/QtSvg.framework)
+      SET(QT4_QTSVG_FOUND TRUE)
+      SET(QT4_QTSVG_LIBRARY "-F${QT4_LIBRARY_DIR} -framework QtSvg" CACHE STRING "The QtSvg library.")
+    ELSE(EXISTS ${QT4_LIBRARY_DIR}/QtSvg.framework)
+      SET(QT4_QTSVG_FOUND FALSE)
+    ENDIF(EXISTS ${QT4_LIBRARY_DIR}/QtSvg.framework)
+
+    IF(EXISTS ${QT4_LIBRARY_DIR}/QtDBus.framework)
+      SET(QT4_QTDBUS_FOUND TRUE)
+      SET(QT4_QTDBUS_LIBRARY "-F${QT4_LIBRARY_DIR} -framework QtDBus" CACHE STRING "The QtDBus library.")
+    ELSE(EXISTS ${QT4_LIBRARY_DIR}/QtDBus.framework)
+      SET(QT4_QTDBUS_FOUND FALSE)
+    ENDIF(EXISTS ${QT4_LIBRARY_DIR}/QtDBus.framework)
+
+    IF(EXISTS ${QT4_LIBRARY_DIR}/QtTest.framework)
+      SET(QT4_QTTEST_FOUND TRUE)
+      SET(QT4_QTTEST_LIBRARY "-F${QT4_LIBRARY_DIR} -framework QtTest" CACHE STRING "The QtTest library.")
+    ELSE(EXISTS ${QT4_LIBRARY_DIR}/QtTest.framework)
+      SET(QT4_QTTEST_FOUND FALSE)
+    ENDIF(EXISTS ${QT4_LIBRARY_DIR}/QtTest.framework)
+
+    # WTF?  why don't we have frameworks?  :P
+    # Set QT4_QTUITOOLS_LIBRARY
+    FIND_LIBRARY(QT4_QTUITOOLS_LIBRARY NAMES QtUiTools QtUiTools4 PATHS ${QT4_LIBRARY_DIR} )
+    # Set QT4_QTSCRIPT_LIBRARY
+    FIND_LIBRARY(QT4_QTSCRIPT_LIBRARY NAMES QtScript QtScript4    PATHS ${QT4_LIBRARY_DIR} )
+
+  ELSE (QT_USE_FRAMEWORKS)
+    
+    # Set QT4_QTCORE_LIBRARY by searching for a lib with "QtCore."  as part of the filename
+    FIND_LIBRARY(QT4_QTCORE_LIBRARY NAMES QtCore QtCore4 QtCored4          PATHS ${QT4_LIBRARY_DIR} NO_DEFAULT_PATH )
+
+    # Set QT4_QT3SUPPORT_LIBRARY
+    FIND_LIBRARY(QT4_QT3SUPPORT_LIBRARY NAMES Qt3Support Qt3Support4 Qt3Supportd4 PATHS ${QT4_LIBRARY_DIR} NO_DEFAULT_PATH)
+
+    # Set QT4_QTGUI_LIBRARY
+    FIND_LIBRARY(QT4_QTGUI_LIBRARY NAMES QtGui QtGui4 QtGuid4            PATHS ${QT4_LIBRARY_DIR} NO_DEFAULT_PATH)
+
+    # Set QT4_QTMOTIF_LIBRARY
+    IF(Q_WS_X11)
+      FIND_LIBRARY(QT4_QTMOTIF_LIBRARY NAMES QtMotif          PATHS ${QT4_LIBRARY_DIR} NO_DEFAULT_PATH)
+    ENDIF(Q_WS_X11)
+
+    # Set QT4_QTNETWORK_LIBRARY
+    FIND_LIBRARY(QT4_QTNETWORK_LIBRARY NAMES QtNetwork QtNetwork4 QtNetworkd4 PATHS ${QT4_LIBRARY_DIR} NO_DEFAULT_PATH)
+
+    # Set QT4_QTNSPLUGIN_LIBRARY
+    FIND_LIBRARY(QT4_QTNSPLUGIN_LIBRARY NAMES QtNsPlugin      PATHS ${QT4_LIBRARY_DIR} NO_DEFAULT_PATH)
+
+    # Set QT4_QTOPENGL_LIBRARY
+    FIND_LIBRARY(QT4_QTOPENGL_LIBRARY NAMES QtOpenGL QtOpenGL4 QtOpenGLd4    PATHS ${QT4_LIBRARY_DIR} NO_DEFAULT_PATH)
+
+    # Set QT4_QTSQL_LIBRARY
+    FIND_LIBRARY(QT4_QTSQL_LIBRARY NAMES QtSql QtSql4 QtSqld4       PATHS ${QT4_LIBRARY_DIR} NO_DEFAULT_PATH)
+
+    # Set QT4_QTXML_LIBRARY
+    FIND_LIBRARY(QT4_QTXML_LIBRARY NAMES QtXml QtXml4 QtXmld4       PATHS ${QT4_LIBRARY_DIR} NO_DEFAULT_PATH)
+
+    # Set QT4_QTSVG_LIBRARY
+    FIND_LIBRARY(QT4_QTSVG_LIBRARY NAMES QtSvg QtSvg4 QtSvgd4       PATHS ${QT4_LIBRARY_DIR} NO_DEFAULT_PATH)
+
+    # Set QT4_QTSCRIPT_LIBRARY
+    FIND_LIBRARY(QT4_QTSCRIPT_LIBRARY NAMES QtScript QtScript4 QtScriptd4   PATHS ${QT4_LIBRARY_DIR} NO_DEFAULT_PATH)
+
+    # Set QT4_QTUITOOLS_LIBRARY
+    FIND_LIBRARY(QT4_QTUITOOLS_LIBRARY NAMES QtUiTools QtUiTools4 QtUiToolsd4 PATHS ${QT4_LIBRARY_DIR} NO_DEFAULT_PATH)
+
+    # Set QT4_QTTEST_LIBRARY
+    FIND_LIBRARY(QT4_QTTEST_LIBRARY NAMES QtTest QtTest4 QtTestd4          PATHS ${QT4_LIBRARY_DIR} NO_DEFAULT_PATH)
+
+    FIND_LIBRARY(QT4_QTDBUS_LIBRARY NAMES QtDBus QtDBus4 QtDBusd4         PATHS ${QT4_LIBRARY_DIR} NO_DEFAULT_PATH)
+
+    IF(MSVC)
+      FIND_LIBRARY(QT4_QTCORE_LIBRARY_RELEASE    NAMES QtCore4            PATHS ${QT4_LIBRARY_DIR} NO_DEFAULT_PATH)
+      FIND_LIBRARY(QT4_QTCORE_LIBRARY_DEBUG      NAMES QtCored4            PATHS ${QT4_LIBRARY_DIR} NO_DEFAULT_PATH)
+      FIND_LIBRARY(QT4_QT3SUPPORT_LIBRARY_RELEASE NAMES Qt3Support4        PATHS ${QT4_LIBRARY_DIR} NO_DEFAULT_PATH)
+      FIND_LIBRARY(QT4_QT3SUPPORT_LIBRARY_DEBUG  NAMES Qt3Supportd4        PATHS ${QT4_LIBRARY_DIR} NO_DEFAULT_PATH)
+      FIND_LIBRARY(QT4_QTGUI_LIBRARY_RELEASE     NAMES QtGui4             PATHS ${QT4_LIBRARY_DIR} NO_DEFAULT_PATH)
+      FIND_LIBRARY(QT4_QTGUI_LIBRARY_DEBUG       NAMES QtGuid4             PATHS ${QT4_LIBRARY_DIR} NO_DEFAULT_PATH)
+      FIND_LIBRARY(QT4_QTNETWORK_LIBRARY_RELEASE NAMES QtNetwork4         PATHS ${QT4_LIBRARY_DIR} NO_DEFAULT_PATH)
+      FIND_LIBRARY(QT4_QTNETWORK_LIBRARY_DEBUG   NAMES QtNetworkd4         PATHS ${QT4_LIBRARY_DIR} NO_DEFAULT_PATH)
+      FIND_LIBRARY(QT4_QTOPENGL_LIBRARY_RELEASE  NAMES QtOpenGL4          PATHS ${QT4_LIBRARY_DIR} NO_DEFAULT_PATH)
+      FIND_LIBRARY(QT4_QTOPENGL_LIBRARY_DEBUG    NAMES QtOpenGLd4          PATHS ${QT4_LIBRARY_DIR} NO_DEFAULT_PATH)
+      FIND_LIBRARY(QT4_QTSQL_LIBRARY_RELEASE     NAMES QtSql4             PATHS ${QT4_LIBRARY_DIR} NO_DEFAULT_PATH)
+      FIND_LIBRARY(QT4_QTSQL_LIBRARY_DEBUG       NAMES QtSqld4             PATHS ${QT4_LIBRARY_DIR} NO_DEFAULT_PATH)
+      FIND_LIBRARY(QT4_QTXML_LIBRARY_RELEASE     NAMES QtXml4             PATHS ${QT4_LIBRARY_DIR} NO_DEFAULT_PATH)
+      FIND_LIBRARY(QT4_QTXML_LIBRARY_DEBUG       NAMES QtXmld4             PATHS ${QT4_LIBRARY_DIR} NO_DEFAULT_PATH)
+      FIND_LIBRARY(QT4_QTSVG_LIBRARY_RELEASE     NAMES QtSvg4             PATHS ${QT4_LIBRARY_DIR} NO_DEFAULT_PATH)
+      FIND_LIBRARY(QT4_QTSVG_LIBRARY_DEBUG       NAMES QtSvgd4             PATHS ${QT4_LIBRARY_DIR} NO_DEFAULT_PATH)
+      FIND_LIBRARY(QT4_QTSCRIPT_LIBRARY_RELEASE  NAMES QtScript4          PATHS ${QT4_LIBRARY_DIR} NO_DEFAULT_PATH)
+      FIND_LIBRARY(QT4_QTSCRIPT_LIBRARY_DEBUG    NAMES QtScriptd4          PATHS ${QT4_LIBRARY_DIR} NO_DEFAULT_PATH)
+      FIND_LIBRARY(QT4_QTUITOOLS_LIBRARY_RELEASE NAMES QtUiTools QtUiTools4 PATHS ${QT4_LIBRARY_DIR} NO_DEFAULT_PATH)
+      FIND_LIBRARY(QT4_QTUITOOLS_LIBRARY_DEBUG   NAMES QtUiToolsd QtUiToolsd4 PATHS ${QT4_LIBRARY_DIR} NO_DEFAULT_PATH)
+      FIND_LIBRARY(QT4_QTTEST_LIBRARY_RELEASE    NAMES QtTest4            PATHS ${QT4_LIBRARY_DIR} NO_DEFAULT_PATH)
+      FIND_LIBRARY(QT4_QTTEST_LIBRARY_DEBUG      NAMES QtTestd4            PATHS ${QT4_LIBRARY_DIR} NO_DEFAULT_PATH)
+      FIND_LIBRARY(QT4_QTDBUS_LIBRARY_RELEASE    NAMES QtDBus4            PATHS ${QT4_LIBRARY_DIR} NO_DEFAULT_PATH)
+      FIND_LIBRARY(QT4_QTDBUS_LIBRARY_DEBUG      NAMES QtDBusd4            PATHS ${QT4_LIBRARY_DIR} NO_DEFAULT_PATH)
+      FIND_LIBRARY(QT4_QTASSISTANT_LIBRARY_RELEASE NAMES QtAssistantClient4 PATHS ${QT4_LIBRARY_DIR} NO_DEFAULT_PATH)
+      FIND_LIBRARY(QT4_QTASSISTANT_LIBRARY_DEBUG NAMES QtAssistantClientd4 PATHS ${QT4_LIBRARY_DIR} NO_DEFAULT_PATH)
+      FIND_LIBRARY(QT4_QTDESIGNER_LIBRARY_RELEASE NAMES QtDesigner4            PATHS ${QT4_LIBRARY_DIR} NO_DEFAULT_PATH)
+      FIND_LIBRARY(QT4_QTDESIGNER_LIBRARY_DEBUG  NAMES QtDesignerd4            PATHS ${QT4_LIBRARY_DIR} NO_DEFAULT_PATH)
+      FIND_LIBRARY(QT4_QTDESIGNERCOMPONENTS_LIBRARY_RELEASE NAMES QtDesignerComponents4 PATHS ${QT4_LIBRARY_DIR} NO_DEFAULT_PATH)
+      FIND_LIBRARY(QT4_QTDESIGNERCOMPONENTS_LIBRARY_DEBUG NAMES QtDesignerComponentsd4 PATHS ${QT4_LIBRARY_DIR} NO_DEFAULT_PATH)
+      FIND_LIBRARY(QT4_QTMAIN_LIBRARY_RELEASE    NAMES qtmain             PATHS ${QT4_LIBRARY_DIR} NO_DEFAULT_PATH)
+      FIND_LIBRARY(QT4_QTMAIN_LIBRARY_DEBUG      NAMES qtmaind             PATHS ${QT4_LIBRARY_DIR} NO_DEFAULT_PATH)
+    ENDIF(MSVC)
+  ENDIF (QT_USE_FRAMEWORKS)
+
+  IF( NOT QT4_QTCORE_LIBRARY )
+    IF( NOT Qt4_FIND_QUIETLY AND Qt4_FIND_REQUIRED)
+      MESSAGE( FATAL_ERROR "Could NOT find QtCore. Check ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log for more details.")
+    ENDIF( NOT Qt4_FIND_QUIETLY AND Qt4_FIND_REQUIRED)
+  ENDIF( NOT QT4_QTCORE_LIBRARY )
+
+  # Set QT4_QTASSISTANT_LIBRARY
+  FIND_LIBRARY(QT4_QTASSISTANT_LIBRARY NAMES QtAssistantClient QtAssistantClient4 QtAssistant QtAssistant4 QtAssistantd4 PATHS ${QT4_LIBRARY_DIR} NO_DEFAULT_PATH)
+
+  # Set QT4_QTDESIGNER_LIBRARY
+  FIND_LIBRARY(QT4_QTDESIGNER_LIBRARY NAMES QtDesigner QtDesigner4 QtDesignerd4 PATHS ${QT4_LIBRARY_DIR}        NO_DEFAULT_PATH)
+
+  # Set QT4_QTDESIGNERCOMPONENTS_LIBRARY
+  FIND_LIBRARY(QT4_QTDESIGNERCOMPONENTS_LIBRARY NAMES QtDesignerComponents QtDesignerComponents4 QtDesignerComponentsd4 PATHS ${QT4_LIBRARY_DIR}        NO_DEFAULT_PATH)
+
+  # Set QT4_QTMAIN_LIBRARY
+  IF(WIN32)
+    FIND_LIBRARY(QT4_QTMAIN_LIBRARY NAMES qtmain qtmaind PATHS ${QT4_LIBRARY_DIR} NO_DEFAULT_PATH)
+  ENDIF(WIN32)
+
+  ############################################
+  #
+  # Check the existence of the libraries.
+  #
+  ############################################
+
+  MACRO (_QT4_ADJUST_LIB_VARS basename)
+    IF (QT4_${basename}_LIBRARY OR QT4_${basename}_LIBRARY_DEBUG)
+
+      IF(MSVC)
+        # Both set
+        IF (QT4_${basename}_LIBRARY_RELEASE AND QT4_${basename}_LIBRARY_DEBUG)
+          SET(QT4_${basename}_LIBRARY optimized ${QT4_${basename}_LIBRARY_RELEASE} debug ${QT4_${basename}_LIBRARY_DEBUG})
+        ENDIF (QT4_${basename}_LIBRARY_RELEASE AND QT4_${basename}_LIBRARY_DEBUG)
+
+        # Only debug was found
+        IF (NOT QT4_${basename}_LIBRARY_RELEASE AND QT4_${basename}_LIBRARY_DEBUG)
+          SET(QT4_${basename}_LIBRARY ${QT4_${basename}_LIBRARY_DEBUG})
+        ENDIF (NOT QT4_${basename}_LIBRARY_RELEASE AND QT4_${basename}_LIBRARY_DEBUG)
+
+        # Only release was found
+        IF (QT4_${basename}_LIBRARY_RELEASE AND NOT QT4_${basename}_LIBRARY_DEBUG)
+          SET(QT4_${basename}_LIBRARY ${QT4_${basename}_LIBRARY_RELEASE})
+        ENDIF (QT4_${basename}_LIBRARY_RELEASE AND NOT QT4_${basename}_LIBRARY_DEBUG)
+
+        # Hmm, is this used anywhere ? Yes, in UseQt4.cmake. We are currently incompatible :-(
+        SET(QT4_${basename}_LIBRARIES optimized ${QT4_${basename}_LIBRARY} debug ${QT4_${basename}_LIBRARY_DEBUG})
+
+      ENDIF(MSVC)
+
+      SET(QT4_${basename}_LIBRARY ${QT4_${basename}_LIBRARY} CACHE FILEPATH "The Qt4 ${basename} library")
+
+      IF (QT4_${basename}_LIBRARY)
+        SET(QT4_${basename}_FOUND 1)
+      ENDIF (QT4_${basename}_LIBRARY)
+      
+    ENDIF (QT4_${basename}_LIBRARY OR QT4_${basename}_LIBRARY_DEBUG)
+    
+    IF (QT4_${basename}_INCLUDE_DIR)
+      #add the include directory to QT4_INCLUDES
+      SET(QT4_INCLUDES "${QT4_${basename}_INCLUDE_DIR}" ${QT4_INCLUDES})
+    ENDIF (QT4_${basename}_INCLUDE_DIR)
+
+    # Make variables changeble to the advanced user
+    MARK_AS_ADVANCED(QT4_${basename}_LIBRARY QT4_${basename}_INCLUDE_DIR)
+  ENDMACRO (_QT4_ADJUST_LIB_VARS)
+
+
+  # Set QT_xyz_LIBRARY variable and add 
+  # library include path to QT4_INCLUDES
+  _QT4_ADJUST_LIB_VARS(QTCORE)
+  _QT4_ADJUST_LIB_VARS(QTGUI)
+  _QT4_ADJUST_LIB_VARS(QT3SUPPORT)
+  _QT4_ADJUST_LIB_VARS(QTASSISTANT)
+  _QT4_ADJUST_LIB_VARS(QTDESIGNER)
+  _QT4_ADJUST_LIB_VARS(QTDESIGNERCOMPONENTS)
+  _QT4_ADJUST_LIB_VARS(QTNETWORK)
+  _QT4_ADJUST_LIB_VARS(QTNSPLUGIN)
+  _QT4_ADJUST_LIB_VARS(QTOPENGL)
+  _QT4_ADJUST_LIB_VARS(QTSQL)
+  _QT4_ADJUST_LIB_VARS(QTXML)
+  _QT4_ADJUST_LIB_VARS(QTSVG)
+  _QT4_ADJUST_LIB_VARS(QTSCRIPT)
+  _QT4_ADJUST_LIB_VARS(QTUITOOLS)
+  _QT4_ADJUST_LIB_VARS(QTTEST)
+  _QT4_ADJUST_LIB_VARS(QTDBUS)
+
+  # platform dependent libraries
+  IF(Q_WS_X11)
+    _QT4_ADJUST_LIB_VARS(QTMOTIF)
+  ENDIF(Q_WS_X11)
+  IF(WIN32)
+    _QT4_ADJUST_LIB_VARS(QTMAIN)
+  ENDIF(WIN32)
+  
+
+  #######################################
+  #
+  #       Check the executables of Qt 
+  #          ( moc, uic, rcc )
+  #
+  #######################################
+
+
+  # find moc and uic using qmake
+  QT_QUERY_QMAKE(QT4_MOC_EXECUTABLE_INTERNAL "QMAKE_MOC")
+  QT_QUERY_QMAKE(QT4_UIC_EXECUTABLE_INTERNAL "QMAKE_UIC")
+
+  FILE(TO_CMAKE_PATH 
+    "${QT4_MOC_EXECUTABLE_INTERNAL}" QT4_MOC_EXECUTABLE_INTERNAL)
+  FILE(TO_CMAKE_PATH 
+    "${QT4_UIC_EXECUTABLE_INTERNAL}" QT4_UIC_EXECUTABLE_INTERNAL)
+
+  SET(QT4_MOC_EXECUTABLE 
+    ${QT4_MOC_EXECUTABLE_INTERNAL} CACHE FILEPATH "The moc executable")
+  SET(QT4_UIC_EXECUTABLE 
+    ${QT4_UIC_EXECUTABLE_INTERNAL} CACHE FILEPATH "The uic executable")
+
+  FIND_PROGRAM(QT_UIC3_EXECUTABLE
+    NAMES uic3
+    PATHS ${QT_BINARY_DIR}
+    NO_DEFAULT_PATH
+    )
+
+  FIND_PROGRAM(QT_RCC_EXECUTABLE 
+    NAMES rcc
+    PATHS ${QT_BINARY_DIR}
+    NO_DEFAULT_PATH
+    )
+
+  FIND_PROGRAM(QT_DBUSCPP2XML_EXECUTABLE 
+    NAMES qdbuscpp2xml
+    PATHS ${QT_BINARY_DIR}
+    NO_DEFAULT_PATH
+    )
+
+  FIND_PROGRAM(QT_DBUSXML2CPP_EXECUTABLE 
+    NAMES qdbusxml2cpp
+    PATHS ${QT_BINARY_DIR}
+    NO_DEFAULT_PATH
+    )
+
+  IF (QT4_MOC_EXECUTABLE)
+     SET(QT_WRAP_CPP "YES")
+  ENDIF (QT4_MOC_EXECUTABLE)
+
+  IF (QT4_UIC_EXECUTABLE)
+     SET(QT_WRAP_UI "YES")
+  ENDIF (QT4_UIC_EXECUTABLE)
+
+
+
+  MARK_AS_ADVANCED( QT4_UIC_EXECUTABLE QT_UIC3_EXECUTABLE QT4_MOC_EXECUTABLE QT_RCC_EXECUTABLE QT_DBUSXML2CPP_EXECUTABLE QT_DBUSCPP2XML_EXECUTABLE)
+
+  ######################################
+  #
+  #       Macros for building Qt files
+  #
+  ######################################
+  MACRO (QT4_EXTRACT_OPTIONS _qt4_files _qt4_options)
+    SET(${_qt4_files})
+    SET(${_qt4_options})
+    SET(_QT4_DOING_OPTIONS FALSE)
+    FOREACH(_currentArg ${ARGN})
+       IF ("${_currentArg}" STREQUAL "OPTIONS")
+          SET(_QT4_DOING_OPTIONS TRUE)
+       ELSE ("${_currentArg}" STREQUAL "OPTIONS")
+          IF(_QT4_DOING_OPTIONS)
+             LIST(APPEND ${_qt4_options} "${_currentArg}")
+          ELSE(_QT4_DOING_OPTIONS)
+             LIST(APPEND ${_qt4_files} "${_currentArg}")
+          ENDIF(_QT4_DOING_OPTIONS)
+       ENDIF ("${_currentArg}" STREQUAL "OPTIONS")
+    ENDFOREACH(_currentArg)
+  ENDMACRO (QT4_EXTRACT_OPTIONS)
+
+  MACRO (QT4_GET_MOC_INC_DIRS _moc_INC_DIRS)
+     SET(${_moc_INC_DIRS})
+     GET_DIRECTORY_PROPERTY(_inc_DIRS INCLUDE_DIRECTORIES)
+
+     FOREACH(_current ${_inc_DIRS})
+        SET(${_moc_INC_DIRS} ${${_moc_INC_DIRS}} "-I" ${_current})
+     ENDFOREACH(_current ${_inc_DIRS})
+
+  ENDMACRO(QT4_GET_MOC_INC_DIRS)
+
+
+  MACRO (QT4_GENERATE_MOC infile outfile )
+  # get include dirs
+     QT4_GET_MOC_INC_DIRS(moc_includes)
+
+     GET_FILENAME_COMPONENT(abs_infile ${infile} ABSOLUTE)
+
+     IF (MSVC_IDE)
+        SET (_moc_parameter_file ${outfile}_parameters)
+        SET (_moc_param "${moc_includes} \n-o${outfile} \n${abs_infile}")
+        STRING(REGEX REPLACE ";-I;" "\\n-I" _moc_param "${_moc_param}")
+        FILE (WRITE ${_moc_parameter_file} "${_moc_param}")
+        ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
+          COMMAND ${QT4_MOC_EXECUTABLE}
+          ARGS @"${_moc_parameter_file}"
+          DEPENDS ${abs_infile})
+     ELSE (MSVC_IDE)     
+        ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
+           COMMAND ${QT4_MOC_EXECUTABLE}
+           ARGS ${moc_includes} -o ${outfile} ${abs_infile}
+           DEPENDS ${abs_infile})     
+     ENDIF (MSVC_IDE)
+
+     SET_SOURCE_FILES_PROPERTIES(${outfile} PROPERTIES SKIP_AUTOMOC TRUE)  # dont run automoc on this file
+
+     MACRO_ADD_FILE_DEPENDENCIES(${abs_infile} ${outfile})
+  ENDMACRO (QT4_GENERATE_MOC)
+
+
+  # QT4_WRAP_CPP(outfiles inputfile ... )
+  # TODO  perhaps add support for -D, -U and other minor options
+
+  MACRO (QT4_WRAP_CPP outfiles )
+    # get include dirs
+    QT4_GET_MOC_INC_DIRS(moc_includes)
+    QT4_EXTRACT_OPTIONS(moc_files moc_options ${ARGN})
+
+    FOREACH (it ${moc_files})
+      GET_FILENAME_COMPONENT(it ${it} ABSOLUTE)
+      GET_FILENAME_COMPONENT(outfile ${it} NAME_WE)
+
+      SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/moc_${outfile}.cxx)
+      ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
+        COMMAND ${QT4_MOC_EXECUTABLE}
+        ARGS ${moc_includes} ${moc_options} -o ${outfile} ${it}
+        DEPENDS ${it})
+      SET(${outfiles} ${${outfiles}} ${outfile})
+    ENDFOREACH(it)
+
+  ENDMACRO (QT4_WRAP_CPP)
+
+
+  # QT4_WRAP_UI(outfiles inputfile ... )
+
+  MACRO (QT4_WRAP_UI outfiles )
+    QT4_EXTRACT_OPTIONS(ui_files ui_options ${ARGN})
+
+    FOREACH (it ${ui_files})
+      GET_FILENAME_COMPONENT(outfile ${it} NAME_WE)
+      GET_FILENAME_COMPONENT(infile ${it} ABSOLUTE)
+      SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/ui_${outfile}.h)
+      ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
+        COMMAND ${QT4_UIC_EXECUTABLE}
+        ARGS ${ui_options} -o ${outfile} ${infile}
+        MAIN_DEPENDENCY ${infile})
+      SET(${outfiles} ${${outfiles}} ${outfile})
+    ENDFOREACH (it)
+
+  ENDMACRO (QT4_WRAP_UI)
+
+
+  # QT4_ADD_RESOURCES(outfiles inputfile ... )
+  # TODO  perhaps consider adding support for compression and root options to rcc
+
+  MACRO (QT4_ADD_RESOURCES outfiles )
+    QT4_EXTRACT_OPTIONS(rcc_files rcc_options ${ARGN})
+
+    FOREACH (it ${rcc_files})
+      GET_FILENAME_COMPONENT(outfilename ${it} NAME_WE)
+      GET_FILENAME_COMPONENT(infile ${it} ABSOLUTE)
+      GET_FILENAME_COMPONENT(rc_path ${infile} PATH)
+      SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/qrc_${outfilename}.cxx)
+      #  parse file for dependencies 
+      #  all files are absolute paths or relative to the location of the qrc file
+      FILE(READ "${infile}" _RC_FILE_CONTENTS)
+      STRING(REGEX MATCHALL "<file[^<]+" _RC_FILES "${_RC_FILE_CONTENTS}")
+      SET(_RC_DEPENDS)
+      FOREACH(_RC_FILE ${_RC_FILES})
+        STRING(REGEX REPLACE "^<file[^>]*>" "" _RC_FILE "${_RC_FILE}")
+        STRING(REGEX MATCH "^/|([A-Za-z]:/)" _ABS_PATH_INDICATOR "${_RC_FILE}")
+        IF(NOT _ABS_PATH_INDICATOR)
+          SET(_RC_FILE "${rc_path}/${_RC_FILE}")
+        ENDIF(NOT _ABS_PATH_INDICATOR)
+        SET(_RC_DEPENDS ${_RC_DEPENDS} "${_RC_FILE}")
+      ENDFOREACH(_RC_FILE)
+      ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
+        COMMAND ${QT_RCC_EXECUTABLE}
+        ARGS ${rcc_options} -name ${outfilename} -o ${outfile} ${infile}
+        MAIN_DEPENDENCY ${infile}
+        DEPENDS ${_RC_DEPENDS})
+      SET(${outfiles} ${${outfiles}} ${outfile})
+    ENDFOREACH (it)
+
+  ENDMACRO (QT4_ADD_RESOURCES)
+
+  MACRO(QT4_ADD_DBUS_INTERFACE _sources _interface _basename)
+    GET_FILENAME_COMPONENT(_infile ${_interface} ABSOLUTE)
+    SET(_header ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h)
+    SET(_impl   ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp)
+    SET(_moc    ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc)
+
+    GET_SOURCE_FILE_PROPERTY(_nonamespace ${_interface} NO_NAMESPACE)
+    IF ( _nonamespace )
+        SET(_params -N -m)
+    ELSE ( _nonamespace )
+        SET(_params -m)
+    ENDIF ( _nonamespace )
+
+    GET_SOURCE_FILE_PROPERTY(_include ${_interface} INCLUDE)
+    IF ( _include )
+        SET(_params ${_params} -i ${_include})
+    ENDIF ( _include )
+
+    ADD_CUSTOM_COMMAND(OUTPUT ${_impl} ${_header}
+        COMMAND ${QT_DBUSXML2CPP_EXECUTABLE} ${_params} -p ${_basename} ${_infile}
+        DEPENDS ${_infile})
+  
+    SET_SOURCE_FILES_PROPERTIES(${_impl} PROPERTIES SKIP_AUTOMOC TRUE)
+    
+    QT4_GENERATE_MOC(${_header} ${_moc})
+  
+    SET(${_sources} ${${_sources}} ${_impl} ${_header} ${_moc})
+    MACRO_ADD_FILE_DEPENDENCIES(${_impl} ${_moc})
+  
+  ENDMACRO(QT4_ADD_DBUS_INTERFACE)
+  
+  
+  MACRO(QT4_ADD_DBUS_INTERFACES _sources)
+     FOREACH (_current_FILE ${ARGN})
+        GET_FILENAME_COMPONENT(_infile ${_current_FILE} ABSOLUTE)
+        # get the part before the ".xml" suffix
+        STRING(REGEX REPLACE "(.*[/\\.])?([^\\.]+)\\.xml" "\\2" _basename ${_current_FILE})
+        STRING(TOLOWER ${_basename} _basename)
+        QT4_ADD_DBUS_INTERFACE(${_sources} ${_infile} ${_basename}interface)
+     ENDFOREACH (_current_FILE)
+  ENDMACRO(QT4_ADD_DBUS_INTERFACES)
+  
+  
+  MACRO(QT4_GENERATE_DBUS_INTERFACE _header) # _customName OPTIONS -some -options )
+    QT4_EXTRACT_OPTIONS(_customName _qt4_dbus_options ${ARGN})
+
+    GET_FILENAME_COMPONENT(_in_file ${_header} ABSOLUTE)
+    GET_FILENAME_COMPONENT(_basename ${_header} NAME_WE)
+
+    IF (_customName)
+      SET(_target ${CMAKE_CURRENT_BINARY_DIR}/${_customName})
+    ELSE (_customName)
+      SET(_target ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.xml)
+    ENDIF (_customName)
+  
+    ADD_CUSTOM_COMMAND(OUTPUT ${_target}
+        COMMAND ${QT_DBUSCPP2XML_EXECUTABLE} ${_qt4_dbus_options} ${_in_file} > ${_target}
+        DEPENDS ${_in_file}
+    )
+  ENDMACRO(QT4_GENERATE_DBUS_INTERFACE)
+  
+  
+  MACRO(QT4_ADD_DBUS_ADAPTOR _sources _xml_file _include _parentClass) # _optionalBasename _optionalClassName)
+    GET_FILENAME_COMPONENT(_infile ${_xml_file} ABSOLUTE)
+    
+    SET(_optionalBasename "${ARGV4}")
+    IF (_optionalBasename)
+       SET(_basename ${_optionalBasename} )
+    ELSE (_optionalBasename)
+       STRING(REGEX REPLACE "(.*[/\\.])?([^\\.]+)\\.xml" "\\2adaptor" _basename ${_infile})
+       STRING(TOLOWER ${_basename} _basename)
+    ENDIF (_optionalBasename)
+
+    SET(_optionalClassName "${ARGV5}")
+    SET(_header ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h)
+    SET(_impl   ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp)
+    SET(_moc    ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc)
+
+    IF(_optionalClassName)
+       ADD_CUSTOM_COMMAND(OUTPUT ${_impl} ${_header}
+          COMMAND ${QT_DBUSXML2CPP_EXECUTABLE} -m -a ${_basename} -c ${_optionalClassName} -i ${_include} -l ${_parentClass} ${_infile}
+          DEPENDS ${_infile}
+        )
+    ELSE(_optionalClassName)
+       ADD_CUSTOM_COMMAND(OUTPUT ${_impl} ${_header}
+          COMMAND ${QT_DBUSXML2CPP_EXECUTABLE} -m -a ${_basename} -i ${_include} -l ${_parentClass} ${_infile}
+          DEPENDS ${_infile}
+        )
+    ENDIF(_optionalClassName)
+
+    QT4_GENERATE_MOC(${_header} ${_moc})
+    SET_SOURCE_FILES_PROPERTIES(${_impl} PROPERTIES SKIP_AUTOMOC TRUE)
+    MACRO_ADD_FILE_DEPENDENCIES(${_impl} ${_moc})
+
+    SET(${_sources} ${${_sources}} ${_impl} ${_header} ${_moc})
+  ENDMACRO(QT4_ADD_DBUS_ADAPTOR)
+
+   MACRO(QT4_AUTOMOC)
+      QT4_GET_MOC_INC_DIRS(_moc_INCS)
+
+      SET(_matching_FILES )
+      FOREACH (_current_FILE ${ARGN})
+
+         GET_FILENAME_COMPONENT(_abs_FILE ${_current_FILE} ABSOLUTE)
+         # if "SKIP_AUTOMOC" is set to true, we will not handle this file here.
+         # here. this is required to make bouic work correctly:
+         # we need to add generated .cpp files to the sources (to compile them),
+         # but we cannot let automoc handle them, as the .cpp files don't exist yet when
+         # cmake is run for the very first time on them -> however the .cpp files might
+         # exist at a later run. at that time we need to skip them, so that we don't add two
+         # different rules for the same moc file
+         GET_SOURCE_FILE_PROPERTY(_skip ${_abs_FILE} SKIP_AUTOMOC)
+
+         IF ( NOT _skip AND EXISTS ${_abs_FILE} )
+
+            FILE(READ ${_abs_FILE} _contents)
+
+            GET_FILENAME_COMPONENT(_abs_PATH ${_abs_FILE} PATH)
+
+            STRING(REGEX MATCHALL "#include +[^ ]+\\.moc[\">]" _match "${_contents}")
+            IF(_match)
+               FOREACH (_current_MOC_INC ${_match})
+                  STRING(REGEX MATCH "[^ <\"]+\\.moc" _current_MOC "${_current_MOC_INC}")
+
+                  GET_filename_component(_basename ${_current_MOC} NAME_WE)
+   #               SET(_header ${CMAKE_CURRENT_SOURCE_DIR}/${_basename}.h)
+                  IF (EXISTS ${_abs_PATH}/${_basename}.h)
+                    SET(_header ${_abs_PATH}/${_basename}.h)
+                  ELSE (EXISTS ${_abs_PATH}/${_basename}.h)
+                    SET(_header ${_abs_FILE})
+                  ENDIF (EXISTS ${_abs_PATH}/${_basename}.h)
+                  SET(_moc    ${CMAKE_CURRENT_BINARY_DIR}/${_current_MOC})
+                  ADD_CUSTOM_COMMAND(OUTPUT ${_moc}
+                     COMMAND ${QT4_MOC_EXECUTABLE}
+                     ARGS ${_moc_INCS} ${_header} -o ${_moc}
+                     DEPENDS ${_header}
+                  )
+
+                  MACRO_ADD_FILE_DEPENDENCIES(${_abs_FILE} ${_moc})
+               ENDFOREACH (_current_MOC_INC)
+            ENDIF(_match)
+         ENDIF ( NOT _skip AND EXISTS ${_abs_FILE} )
+      ENDFOREACH (_current_FILE)
+   ENDMACRO(QT4_AUTOMOC)
+
+
+
+  ######################################
+  #
+  #       decide if Qt got found
+  #
+  ######################################
+
+  # if the includes,libraries,moc,uic and rcc are found then we have it
+  IF( QT4_LIBRARY_DIR AND QT4_INCLUDE_DIR AND QT4_MOC_EXECUTABLE AND QT4_UIC_EXECUTABLE AND QT_RCC_EXECUTABLE)
+    SET( QT4_FOUND "YES" )
+    IF( NOT Qt4_FIND_QUIETLY)
+      MESSAGE(STATUS "Found Qt-Version ${QTVERSION} (using ${QT_QMAKE_EXECUTABLE})")
+    ENDIF( NOT Qt4_FIND_QUIETLY)
+  ELSE( QT4_LIBRARY_DIR AND QT4_INCLUDE_DIR AND QT4_MOC_EXECUTABLE AND QT4_UIC_EXECUTABLE AND QT_RCC_EXECUTABLE)
+    SET( QT4_FOUND "NO")
+    SET(QT_QMAKE_EXECUTABLE "${QT_QMAKE_EXECUTABLE}-NOTFOUND" CACHE FILEPATH "Invalid qmake found" FORCE)
+    IF( Qt4_FIND_REQUIRED)
+      IF ( NOT QT4_LIBRARY_DIR )
+        MESSAGE(STATUS "Qt libraries NOT found!")
+      ENDIF(NOT QT4_LIBRARY_DIR )
+      IF ( NOT QT4_INCLUDE_DIR )
+        MESSAGE(STATUS "Qt includes NOT found!")
+      ENDIF( NOT QT4_INCLUDE_DIR )
+      IF ( NOT QT4_MOC_EXECUTABLE )
+        MESSAGE(STATUS "Qt's moc NOT found!")
+      ENDIF( NOT QT4_MOC_EXECUTABLE )
+      IF ( NOT QT4_UIC_EXECUTABLE )
+        MESSAGE(STATUS "Qt's uic NOT found!")
+      ENDIF( NOT QT4_UIC_EXECUTABLE )
+      IF ( NOT QT_RCC_EXECUTABLE )
+        MESSAGE(STATUS "Qt's rcc NOT found!")
+      ENDIF( NOT QT_RCC_EXECUTABLE )
+      MESSAGE( FATAL_ERROR "Qt libraries, includes, moc, uic or/and rcc NOT found!")
+    ENDIF( Qt4_FIND_REQUIRED)
+  ENDIF( QT4_LIBRARY_DIR AND QT4_INCLUDE_DIR AND QT4_MOC_EXECUTABLE AND QT4_UIC_EXECUTABLE AND  QT_RCC_EXECUTABLE)
+  SET(QT_FOUND ${QT4_FOUND})
+
+
+  #######################################
+  #
+  #       System dependent settings  
+  #
+  #######################################
+  # for unix add X11 stuff
+  IF(UNIX)
+    # on OS X X11 may not be required
+    IF (Q_WS_X11)
+      FIND_PACKAGE(X11 REQUIRED)
+    ENDIF (Q_WS_X11)
+    FIND_PACKAGE(Threads)
+    SET(QT4_QTCORE_LIBRARY ${QT4_QTCORE_LIBRARY} ${CMAKE_THREAD_LIBS_INIT})
+  ENDIF(UNIX)
+
+
+  #######################################
+  #
+  #       compatibility settings 
+  #
+  #######################################
+  # Backwards compatibility for CMake1.4 and 1.2
+  SET (QT_MOC_EXE ${QT4_MOC_EXECUTABLE} )
+  SET (QT_UIC_EXE ${QT4_UIC_EXECUTABLE} )
+
+  SET( QT4_QT_LIBRARY "")
+
+ELSE(QT4_QMAKE_FOUND)
+   
+   SET(QT_QMAKE_EXECUTABLE "${QT_QMAKE_EXECUTABLE}-NOTFOUND" CACHE FILEPATH "Invalid qmake found" FORCE)
+   IF(Qt4_FIND_REQUIRED)
+      IF(QT4_INSTALLED_VERSION_TOO_OLD)
+         MESSAGE(FATAL_ERROR "The installed Qt version ${QTVERSION} is too old, at least version ${QT4_MIN_VERSION} is required")
+      ELSE(QT4_INSTALLED_VERSION_TOO_OLD)
+         MESSAGE( FATAL_ERROR "Qt qmake not found!")
+      ENDIF(QT4_INSTALLED_VERSION_TOO_OLD)
+   ELSE(Qt4_FIND_REQUIRED)
+      IF(QT4_INSTALLED_VERSION_TOO_OLD AND NOT Qt4_FIND_QUIETLY)
+         MESSAGE(STATUS "The installed Qt version ${QTVERSION} is too old, at least version ${QT4_MIN_VERSION} is required")
+      ENDIF(QT4_INSTALLED_VERSION_TOO_OLD AND NOT Qt4_FIND_QUIETLY)
+   ENDIF(Qt4_FIND_REQUIRED)
+ 
+ENDIF (QT4_QMAKE_FOUND)
+ENDIF (QT4_QMAKE_FOUND)
+
diff --git a/cmake/modules/MacroBoolTo01.cmake b/cmake/modules/MacroBoolTo01.cmake
new file mode 100644
index 0000000..63b9852
--- /dev/null
+++ b/cmake/modules/MacroBoolTo01.cmake
@@ -0,0 +1,20 @@
+# MACRO_BOOL_TO_01( VAR RESULT0 ... RESULTN )
+# This macro evaluates its first argument
+# and sets all the given vaiables either to 0 or 1
+# depending on the value of the first one
+
+# Copyright (c) 2006, Alexander Neundorf, <neundorf at kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+
+MACRO(MACRO_BOOL_TO_01 FOUND_VAR )
+   FOREACH (_current_VAR ${ARGN})
+      IF(${FOUND_VAR})
+         SET(${_current_VAR} 1)
+      ELSE(${FOUND_VAR})
+         SET(${_current_VAR} 0)
+      ENDIF(${FOUND_VAR})
+   ENDFOREACH(_current_VAR)
+ENDMACRO(MACRO_BOOL_TO_01)
diff --git a/cmake/modules/MacroEnsureVersion.cmake b/cmake/modules/MacroEnsureVersion.cmake
new file mode 100644
index 0000000..6797e5b
--- /dev/null
+++ b/cmake/modules/MacroEnsureVersion.cmake
@@ -0,0 +1,117 @@
+# This file defines the following macros for developers to use in ensuring
+# that installed software is of the right version:
+#
+# MACRO_ENSURE_VERSION        - test that a version number is greater than
+#                               or equal to some minimum
+# MACRO_ENSURE_VERSION_RANGE - test that a version number is greater than
+#                               or equal to some minimum and less than some
+#                               maximum
+# MACRO_ENSURE_VERSION2       - deprecated, do not use in new code
+#
+
+# MACRO_ENSURE_VERSION
+# This macro compares version numbers of the form "x.y.z" or "x.y"
+# MACRO_ENSURE_VERSION( FOO_MIN_VERSION FOO_VERSION_FOUND FOO_VERSION_OK)
+# will set FOO_VERSION_OK to true if FOO_VERSION_FOUND >= FOO_MIN_VERSION
+# Leading and trailing text is ok, e.g.
+# MACRO_ENSURE_VERSION( "2.5.31" "flex 2.5.4a" VERSION_OK)
+# which means 2.5.31 is required and "flex 2.5.4a" is what was found on the system
+
+# Copyright (c) 2006, David Faure, <faure at kde.org>
+# Copyright (c) 2007, Will Stephenson <wstephenson at kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+# MACRO_ENSURE_VERSION_RANGE
+# This macro ensures that a version number of the form
+# "x.y.z" or "x.y" falls within a range defined by
+# min_version <= found_version < max_version.
+# If this expression holds, FOO_VERSION_OK will be set TRUE
+#
+# Example: MACRO_ENSURE_VERSION_RANGE3( "0.1.0" ${FOOCODE_VERSION} "0.7.0" FOO_VERSION_OK )
+#
+# This macro will break silently if any of x,y,z are greater than 100.
+#
+# Copyright (c) 2007, Will Stephenson <wstephenson at kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+# NORMALIZE_VERSION
+# Helper macro to convert version numbers of the form "x.y.z"
+# to an integer equal to 10^4 * x + 10^2 * y + z
+#
+# This macro will break silently if any of x,y,z are greater than 100.
+#
+# Copyright (c) 2006, David Faure, <faure at kde.org>
+# Copyright (c) 2007, Will Stephenson <wstephenson at kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+# CHECK_RANGE_INCLUSIVE_LOWER
+# Helper macro to check whether x <= y < z
+#
+# Copyright (c) 2007, Will Stephenson <wstephenson at kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+
+MACRO(NORMALIZE_VERSION _requested_version _normalized_version)
+    STRING(REGEX MATCH "[^0-9]*[0-9]+\\.[0-9]+\\.[0-9]+.*" _threePartMatch "${_requested_version}")
+    if (_threePartMatch)
+    # parse the parts of the version string
+        STRING(REGEX REPLACE "[^0-9]*([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" _major_vers "${_requested_version}")
+        STRING(REGEX REPLACE "[^0-9]*[0-9]+\\.([0-9]+)\\.[0-9]+.*" "\\1" _minor_vers "${_requested_version}")
+        STRING(REGEX REPLACE "[^0-9]*[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" _patch_vers "${_requested_version}")
+    else (_threePartMatch)
+        STRING(REGEX REPLACE "([0-9]+)\\.[0-9]+" "\\1" _major_vers "${_requested_version}")
+        STRING(REGEX REPLACE "[0-9]+\\.([0-9]+)" "\\1" _minor_vers "${_requested_version}")
+        set(_patch_vers "0")
+    endif (_threePartMatch)
+
+    # compute an overall version number which can be compared at once
+    MATH(EXPR ${_normalized_version} "${_major_vers}*10000 + ${_minor_vers}*100 + ${_patch_vers}")
+ENDMACRO(NORMALIZE_VERSION)
+
+MACRO(MACRO_CHECK_RANGE_INCLUSIVE_LOWER _lower_limit _value _upper_limit _ok)
+   if (${_value} LESS ${_lower_limit})
+      set( ${_ok} FALSE )
+  elseif (${_value} EQUAL ${_lower_limit})
+      set( ${_ok} TRUE )
+  elseif (${_value} EQUAL ${_upper_limit})
+      set( ${_ok} FALSE )
+  elseif (${_value} GREATER ${_upper_limit})
+      set( ${_ok} FALSE )
+  else (${_value} LESS ${_lower_limit})
+      set( ${_ok} TRUE )
+  endif (${_value} LESS ${_lower_limit})
+ENDMACRO(MACRO_CHECK_RANGE_INCLUSIVE_LOWER)
+
+MACRO(MACRO_ENSURE_VERSION requested_version found_version var_too_old)
+    NORMALIZE_VERSION( ${requested_version} req_vers_num )
+    NORMALIZE_VERSION( ${found_version} found_vers_num )
+
+    if (found_vers_num LESS req_vers_num)
+        set( ${var_too_old} FALSE )
+    else (found_vers_num LESS req_vers_num)
+        set( ${var_too_old} TRUE )
+    endif (found_vers_num LESS req_vers_num)
+
+ENDMACRO(MACRO_ENSURE_VERSION)
+
+MACRO(MACRO_ENSURE_VERSION2 requested_version2 found_version2 var_too_old2)
+    MACRO_ENSURE_VERSION( ${requested_version2} ${found_version2} ${var_too_old2})
+ENDMACRO(MACRO_ENSURE_VERSION2)
+
+MACRO(MACRO_ENSURE_VERSION_RANGE min_version found_version max_version var_ok)
+    NORMALIZE_VERSION( ${min_version} req_vers_num )
+    NORMALIZE_VERSION( ${found_version} found_vers_num )
+    NORMALIZE_VERSION( ${max_version} max_vers_num )
+
+    MACRO_CHECK_RANGE_INCLUSIVE_LOWER( ${req_vers_num} ${found_vers_num} ${max_vers_num} ${var_ok})
+ENDMACRO(MACRO_ENSURE_VERSION_RANGE)
+
+
diff --git a/cmake/modules/MacroOptionalFindPackage.cmake b/cmake/modules/MacroOptionalFindPackage.cmake
new file mode 100644
index 0000000..816cdb7
--- /dev/null
+++ b/cmake/modules/MacroOptionalFindPackage.cmake
@@ -0,0 +1,28 @@
+# - MACRO_OPTIONAL_FIND_PACKAGE() combines FIND_PACKAGE() with an OPTION()
+# MACRO_OPTIONAL_FIND_PACKAGE( <name> [QUIT] )
+# This macro is a combination of OPTION() and FIND_PACKAGE(), it
+# works like FIND_PACKAGE(), but additionally it automatically creates
+# an option name WITH_<name>, which can be disabled via the cmake GUI.
+# or via -DWITH_<name>=OFF
+# The standard <name>_FOUND variables can be used in the same way
+# as when using the normal FIND_PACKAGE()
+
+# Copyright (c) 2006, Alexander Neundorf, <neundorf at kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+
+MACRO (MACRO_OPTIONAL_FIND_PACKAGE _name )
+   OPTION(WITH_${_name} "Search for ${_name} package" ON)
+   if (WITH_${_name})
+      FIND_PACKAGE(${_name} ${ARGN})
+   else (WITH_${_name})
+      set(${_name}_FOUND)
+      set(${_name}_INCLUDE_DIR)
+      set(${_name}_INCLUDES)
+      set(${_name}_LIBRARY)
+      set(${_name}_LIBRARIES)
+   endif (WITH_${_name})
+ENDMACRO (MACRO_OPTIONAL_FIND_PACKAGE)
+
diff --git a/cmake/modules/MacroPushRequiredVars.cmake b/cmake/modules/MacroPushRequiredVars.cmake
new file mode 100644
index 0000000..650b566
--- /dev/null
+++ b/cmake/modules/MacroPushRequiredVars.cmake
@@ -0,0 +1,47 @@
+# this module defines two macros:
+# MACRO_PUSH_REQUIRED_VARS()
+# and
+# MACRO_POP_REQUIRED_VARS()
+# use these if you call cmake macros which use
+# any of the CMAKE_REQUIRED_XXX variables
+#
+# Usage:
+# MACRO_PUSH_REQUIRED_VARS()
+# SET(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -DSOME_MORE_DEF)
+# CHECK_FUNCTION_EXISTS(...)
+# MACRO_POP_REQUIRED_VARS()
+
+# Copyright (c) 2006, Alexander Neundorf, <neundorf at kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+MACRO(MACRO_PUSH_REQUIRED_VARS)
+
+   IF(NOT DEFINED _PUSH_REQUIRED_VARS_COUNTER)
+      SET(_PUSH_REQUIRED_VARS_COUNTER 0)
+   ENDIF(NOT DEFINED _PUSH_REQUIRED_VARS_COUNTER)
+
+   MATH(EXPR _PUSH_REQUIRED_VARS_COUNTER "${_PUSH_REQUIRED_VARS_COUNTER}+1")
+
+   SET(_CMAKE_REQUIRED_INCLUDES_SAVE_${_PUSH_REQUIRED_VARS_COUNTER}    ${CMAKE_REQUIRED_INCLUDES})
+   SET(_CMAKE_REQUIRED_DEFINITIONS_SAVE_${_PUSH_REQUIRED_VARS_COUNTER} ${CMAKE_REQUIRED_DEFINITIONS})
+   SET(_CMAKE_REQUIRED_LIBRARIES_SAVE_${_PUSH_REQUIRED_VARS_COUNTER}   ${CMAKE_REQUIRED_LIBRARIES})
+   SET(_CMAKE_REQUIRED_FLAGS_SAVE_${_PUSH_REQUIRED_VARS_COUNTER}       ${CMAKE_REQUIRED_FLAGS})
+ENDMACRO(MACRO_PUSH_REQUIRED_VARS)
+
+MACRO(MACRO_POP_REQUIRED_VARS)
+
+# don't pop more than we pushed
+   IF("${_PUSH_REQUIRED_VARS_COUNTER}" GREATER "0")
+
+      SET(CMAKE_REQUIRED_INCLUDES    ${_CMAKE_REQUIRED_INCLUDES_SAVE_${_PUSH_REQUIRED_VARS_COUNTER}})
+      SET(CMAKE_REQUIRED_DEFINITIONS ${_CMAKE_REQUIRED_DEFINITIONS_SAVE_${_PUSH_REQUIRED_VARS_COUNTER}})
+      SET(CMAKE_REQUIRED_LIBRARIES   ${_CMAKE_REQUIRED_LIBRARIES_SAVE_${_PUSH_REQUIRED_VARS_COUNTER}})
+      SET(CMAKE_REQUIRED_FLAGS       ${_CMAKE_REQUIRED_FLAGS_SAVE_${_PUSH_REQUIRED_VARS_COUNTER}})
+
+      MATH(EXPR _PUSH_REQUIRED_VARS_COUNTER "${_PUSH_REQUIRED_VARS_COUNTER}-1")
+   ENDIF("${_PUSH_REQUIRED_VARS_COUNTER}" GREATER "0")
+
+ENDMACRO(MACRO_POP_REQUIRED_VARS)
+
diff --git a/cmake/modules/PopplerDefaults.cmake b/cmake/modules/PopplerDefaults.cmake
new file mode 100644
index 0000000..6ffac47
--- /dev/null
+++ b/cmake/modules/PopplerDefaults.cmake
@@ -0,0 +1,10 @@
+# enable the testing facilities
+enable_testing()
+
+# put the include directories of the sources before other include paths
+# (eg, system includes)
+set(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON)
+
+# colored output
+set(CMAKE_COLOR_MAKEFILE ON)
+
diff --git a/cmake/modules/PopplerMacros.cmake b/cmake/modules/PopplerMacros.cmake
new file mode 100644
index 0000000..4531bcf
--- /dev/null
+++ b/cmake/modules/PopplerMacros.cmake
@@ -0,0 +1,83 @@
+# Copyright 2008 Pino Toscano, <pino at kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+macro(POPPLER_ADD_TEST exe build_flag)
+  set(build_test ${${build_flag}})
+  if(NOT build_test)
+    set(_add_executable_param ${_add_executable_param} EXCLUDE_FROM_ALL)
+  endif(NOT build_test)
+
+  add_executable(${exe} ${_add_executable_param} ${ARGN})
+
+  # if the tests are EXCLUDE_FROM_ALL, add a target "buildtests" to build all tests
+  if(NOT build_test)
+    get_directory_property(_buildtestsAdded BUILDTESTS_ADDED)
+    if(NOT _buildtestsAdded)
+      add_custom_target(buildtests)
+      set_directory_properties(PROPERTIES BUILDTESTS_ADDED TRUE)
+    endif(NOT _buildtestsAdded)
+    add_dependencies(buildtests ${exe})
+  endif(NOT build_test)
+endmacro(POPPLER_ADD_TEST)
+
+macro(POPPLER_ADD_UNITTEST exe build_flag)
+  set(build_test ${${build_flag}})
+  if(NOT build_test)
+    set(_add_executable_param ${_add_executable_param} EXCLUDE_FROM_ALL)
+  endif(NOT build_test)
+
+  add_executable(${exe} ${_add_executable_param} ${ARGN})
+  add_test(${exe} ${EXECUTABLE_OUTPUT_PATH}/${exe})
+
+  # if the tests are EXCLUDE_FROM_ALL, add a target "buildtests" to build all tests
+  if(NOT build_test)
+    get_directory_property(_buildtestsAdded BUILDTESTS_ADDED)
+    if(NOT _buildtestsAdded)
+      add_custom_target(buildtests)
+      set_directory_properties(PROPERTIES BUILDTESTS_ADDED TRUE)
+    endif(NOT _buildtestsAdded)
+    add_dependencies(buildtests ${exe})
+  endif(NOT build_test)
+endmacro(POPPLER_ADD_UNITTEST)
+
+macro(POPPLER_CREATE_INSTALL_PKGCONFIG generated_file install_location)
+  if(NOT WIN32)
+    configure_file(${generated_file}.cmake ${CMAKE_CURRENT_BINARY_DIR}/${generated_file} @ONLY)
+    install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${generated_file} DESTINATION ${install_location})
+  endif(NOT WIN32)
+endmacro(POPPLER_CREATE_INSTALL_PKGCONFIG)
+
+macro(SHOW_END_MESSAGE what enabled)
+  string(LENGTH ${what} length_what)
+  math(EXPR left_char "20 - ${length_what}")
+  set(blanks)
+  foreach(_i RANGE 1 ${left_char})
+    set(blanks "${blanks} ")
+  endforeach(_i)
+  if(${enabled})
+    set(enabled_string "yes")
+  else(${enabled})
+    set(enabled_string "no")
+  endif(${enabled})
+
+  message("  ${what}:${blanks} ${enabled_string}")
+endmacro(SHOW_END_MESSAGE)
+
+
+set(CMAKE_SYSTEM_INCLUDE_PATH ${CMAKE_SYSTEM_INCLUDE_PATH}
+                              "${CMAKE_INSTALL_PREFIX}/include" )
+
+set(CMAKE_SYSTEM_PROGRAM_PATH ${CMAKE_SYSTEM_PROGRAM_PATH}
+                              "${CMAKE_INSTALL_PREFIX}/bin" )
+
+set(CMAKE_SYSTEM_LIBRARY_PATH ${CMAKE_SYSTEM_LIBRARY_PATH}
+                              "${CMAKE_INSTALL_PREFIX}/lib" )
+
+# under Windows dlls may be also installed in bin/
+if(WIN32)
+  set(CMAKE_SYSTEM_LIBRARY_PATH ${CMAKE_SYSTEM_LIBRARY_PATH}
+                                "${CMAKE_INSTALL_PREFIX}/bin" )
+endif(WIN32)
+
diff --git a/config.h.cmake b/config.h.cmake
new file mode 100644
index 0000000..a496b3f
--- /dev/null
+++ b/config.h.cmake
@@ -0,0 +1,149 @@
+/* config.h.  Generated from config.h.cmake by cmake.  */
+
+/* Use libjpeg instead of builtin jpeg decoder. */
+#cmakedefine ENABLE_LIBJPEG 1
+
+/* Use zlib instead of builtin zlib decoder. */
+#cmakedefine ENABLE_ZLIB 1
+
+/* Use cairo for rendering. */
+#cmakedefine HAVE_CAIRO 1
+
+/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'. */
+#cmakedefine HAVE_DIRENT_H 1
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#cmakedefine HAVE_DLFCN_H 1
+
+/* Have FreeType2 include files */
+#cmakedefine HAVE_FREETYPE_H 1
+
+/* Define to 1 if you have the `fseek64' function. */
+#cmakedefine HAVE_FSEEK64 1
+
+/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
+#cmakedefine HAVE_FSEEKO 1
+
+/* Define to 1 if you have the `ftell64' function. */
+#cmakedefine HAVE_FTELL64 1
+
+/* Defines if gettimeofday is available on your system */
+#cmakedefine HAVE_GETTIMEOFDAY 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#cmakedefine HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the `z' library (-lz). */
+#cmakedefine HAVE_LIBZ 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#cmakedefine HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `mkstemp' function. */
+#cmakedefine HAVE_MKSTEMP 1
+
+/* Define to 1 if you have the `mkstemps' function. */
+#cmakedefine HAVE_MKSTEMPS 1
+
+/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
+#cmakedefine HAVE_NDIR_H 1
+
+/* Define to 1 if you have the `popen' function. */
+#cmakedefine HAVE_POPEN 1
+
+/* Use splash for rendering. */
+#cmakedefine HAVE_SPLASH 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#cmakedefine HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#cmakedefine HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#cmakedefine HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#cmakedefine HAVE_STRING_H 1
+
+/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'. */
+#cmakedefine HAVE_SYS_DIR_H 1
+
+/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'. */
+#cmakedefine HAVE_SYS_NDIR_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#cmakedefine HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#cmakedefine HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#cmakedefine HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the <zlib.h> header file. */
+#cmakedefine HAVE_ZLIB_H 1
+
+/* Enable multithreading support. */
+#cmakedefine MULTITHREADED 1
+
+/* Generate OPI comments in PS output. */
+#cmakedefine OPI_SUPPORT 1
+
+/* Name of package */
+#define PACKAGE "poppler"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT ""
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "poppler"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "poppler ${POPPLER_VERSION}"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "poppler"
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "${POPPLER_VERSION}"
+
+/* Poppler data dir */
+#define POPPLER_DATADIR "${CMAKE_INSTALL_PREFIX}/share/poppler"
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Enable word list support. */
+#cmakedefine TEXTOUT_WORD_LIST 1
+
+/* Throw exceptions to deal with not enough memory and similar problems */
+#cmakedefine USE_EXCEPTIONS 1
+
+/* Use fixed point arithmetic */
+#cmakedefine USE_FIXEDPOINT 1
+
+/* Version number of package */
+#define VERSION "${POPPLER_VERSION}"
+
+/* Define to 1 if the X Window System is missing or not being used. */
+/* #undef X_DISPLAY_MISSING */
+
+/*
+ * jpeg.h needs HAVE_BOOLEAN, when the system uses boolean in system
+ * headers and I'm too lazy to write a configure test as long as only
+ * unixware is related
+ */
+#ifdef _UNIXWARE
+#define HAVE_BOOLEAN
+#endif
+
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+/* #undef _FILE_OFFSET_BITS */
+
+/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
+/* #undef _LARGEFILE_SOURCE */
+
+/* Define for large files, on AIX-style hosts. */
+/* #undef _LARGE_FILES */
diff --git a/glib/CMakeLists.txt b/glib/CMakeLists.txt
new file mode 100644
index 0000000..ceb1a7f
--- /dev/null
+++ b/glib/CMakeLists.txt
@@ -0,0 +1,107 @@
+add_definitions(-DG_LOG_DOMAIN=\\"Poppler\\" ${GLIB2_CFLAGS})
+
+include_directories(
+  ${CMAKE_CURRENT_SOURCE_DIR}
+  ${CMAKE_CURRENT_BINARY_DIR}
+)
+if (CAIRO_FOUND)
+  include_directories(${CAIRO_INCLUDES})
+  set (CAIRO_FEATURE "#define POPPLER_HAS_CAIRO 1")
+  add_definitions(${CAIRO_CFLAGS})
+else (CAIRO_FOUND)
+  set (CAIRO_FEATURE "#undef POPPLER_HAS_CAIRO")
+endif (CAIRO_FOUND)
+
+configure_file(poppler-features.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/poppler-features.h)
+
+if (GTK_FOUND)
+  add_subdirectory(demo)
+endif (GTK_FOUND)
+
+set(poppler_glib_public_headers
+  poppler-action.h
+  poppler-document.h
+  poppler-page.h
+  poppler-attachment.h
+  poppler-form-field.h
+  poppler.h
+)
+
+find_program(GLIB2_MKENUMS glib-mkenums)
+
+add_custom_command(
+  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/poppler-enums.h
+  COMMAND ${GLIB2_MKENUMS}
+  ARGS
+    --fhead \"\#ifndef __POPPLER_TYPE_ENUMS_H__\\n\"
+    --fhead \"\#define __POPPLER_TYPE_ENUMS_H__ 1\\n\\n\"
+    --fhead \"\#include <glib-object.h>\\n\\n\"
+    --fhead \"G_BEGIN_DECLS\\n\\n\"
+    --ftail \"G_END_DECLS\\n\\n\"
+    --ftail \"\#endif /* __POPPLER_TYPE_ENUMS_H__ */\\n\"
+    --fprod \"\\n/* --- @filename@ --- */\"
+    --eprod \"\#define POPPLER_TYPE_ at ENUMSHORT@ \(@enum_name at _get_type\(\)\)\\n\"
+    --eprod \"GType @enum_name at _get_type \(void\) G_GNUC_CONST\;\\n\"
+    ${poppler_glib_public_headers} > ${CMAKE_CURRENT_BINARY_DIR}/poppler-enums.h
+  WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+  DEPENDS ${poppler_glib_public_headers}
+)
+
+add_custom_command(
+  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/poppler-enums.c
+  COMMAND ${GLIB2_MKENUMS}
+  ARGS
+    --fhead \"\#include \\"poppler-enums.h\\"\\n\\n\"
+    --fprod \"\\n/* enumerations from \\"@filename@\\" */\"
+    --fprod \"\\n\#include \\"@filename@\\"\"
+    --vhead \"static const G at Type@Value _ at enum_name@_values[] = {\"
+    --vprod \"  { @VALUENAME@, \\"@VALUENAME@\\", \\"@valuenick@\\" },\"
+    --vtail \"  { 0, NULL, NULL }\\n}\;\\n\\n\"
+    --vtail \"GType\\n at enum_name@_get_type \(void\)\\n{\\n\"
+    --vtail \"  static GType type = 0\;\\n\\n\"
+    --vtail \"  if \(G_UNLIKELY \(type == 0\)\)\\n\"
+    --vtail \"    type = g_\@type\@_register_static \(\\"@EnumName@\\", _ at enum_name@_values\)\;\\n\\n\"
+    --vtail \"  return type\;\\n}\\n\\n\"
+    ${poppler_glib_public_headers} > ${CMAKE_CURRENT_BINARY_DIR}/poppler-enums.c
+  WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+  DEPENDS ${poppler_glib_public_headers} ${CMAKE_CURRENT_BINARY_DIR}/poppler-enums.h
+)
+
+
+set(poppler_glib_SRCS
+  poppler-action.cc
+  poppler-document.cc
+  poppler-page.cc
+  poppler-attachment.cc
+  poppler-form-field.cc
+  poppler.cc
+  ${CMAKE_CURRENT_BINARY_DIR}/poppler-enums.c
+)
+if (CAIRO_FOUND)
+  set(poppler_glib_SRCS ${poppler_glib_SRCS}
+    ${CMAKE_SOURCE_DIR}/poppler/CairoFontEngine.cc
+    ${CMAKE_SOURCE_DIR}/poppler/CairoOutputDev.cc
+  )
+endif (CAIRO_FOUND)
+add_library(poppler-glib SHARED ${poppler_glib_SRCS})
+set_target_properties(poppler-glib PROPERTIES VERSION 2.0.0 SOVERSION 2)
+target_link_libraries(poppler-glib poppler ${GLIB2_LIBRARIES})
+if (CAIRO_FOUND)
+  target_link_libraries(poppler-glib ${CAIRO_LIBRARIES})
+endif (CAIRO_FOUND)
+install(TARGETS poppler-glib RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
+
+install(FILES
+  ${poppler_glib_public_headers}
+  ${CMAKE_CURRENT_BINARY_DIR}/poppler-enums.h
+  ${CMAKE_CURRENT_BINARY_DIR}/poppler-features.h
+  DESTINATION include/poppler/glib)
+
+
+
+set(test_poppler_glib_SRCS
+  test-poppler-glib.cc
+)
+poppler_add_test(test-poppler-glib BUILD_GTK_TESTS ${test_poppler_glib_SRCS})
+target_link_libraries(test-poppler-glib poppler-glib)
+
diff --git a/glib/demo/CMakeLists.txt b/glib/demo/CMakeLists.txt
new file mode 100644
index 0000000..a91acdb
--- /dev/null
+++ b/glib/demo/CMakeLists.txt
@@ -0,0 +1,17 @@
+
+add_definitions(${GTK2_CFLAGS})
+
+set(poppler_glib_demo_SRCS
+  main.c
+  fonts.c
+  forms.c
+  info.cc
+  links.c
+  outline.c
+  page.c
+  render.c
+  transitions.c
+  utils.c
+)
+poppler_add_test(poppler-glib-demo BUILD_GTK_TESTS ${poppler_glib_demo_SRCS})
+target_link_libraries(poppler-glib-demo poppler-glib ${GTK2_LIBRARIES})
diff --git a/glib/poppler-features.h.cmake b/glib/poppler-features.h.cmake
new file mode 100644
index 0000000..d6507e7
--- /dev/null
+++ b/glib/poppler-features.h.cmake
@@ -0,0 +1,24 @@
+/* poppler-features.h: glib interface to poppler
+ * Copyright (C) 2006, Red Hat, Inc.
+ *
+ * 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, 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 Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __POPPLER_FEATURES_H__
+#define __POPPLER_FEATURES_H__
+
+${CAIRO_FEATURE}
+
+#endif /* __POPPLER_FEATURES_H__ */
diff --git a/poppler-cairo.pc.cmake b/poppler-cairo.pc.cmake
new file mode 100644
index 0000000..d62eb91
--- /dev/null
+++ b/poppler-cairo.pc.cmake
@@ -0,0 +1,9 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: poppler-cairo
+Description: Cairo backend for Poppler PDF rendering library
+Version: @POPPLER_VERSION@
+Requires: poppler = @POPPLER_VERSION@ cairo >= @CAIRO_VERSION@
diff --git a/poppler-config.h.cmake b/poppler-config.h.cmake
new file mode 100644
index 0000000..3a1547d
--- /dev/null
+++ b/poppler-config.h.cmake
@@ -0,0 +1,160 @@
+//================================================= -*- mode: c++ -*- ====
+//
+// poppler-config.h
+//
+// Copyright 1996-2004 Glyph & Cog, LLC
+//
+//========================================================================
+
+#ifndef POPPLER_CONFIG_H
+#define POPPLER_CONFIG_H
+
+// We duplicate some of the config.h #define's here since they are
+// used in some of the header files we install.  The #ifndef/#endif
+// around #undef look odd, but it's to silence warnings about
+// redefining those symbols.
+
+/* Enable multithreading support. */
+#ifndef MULTITHREADED
+#cmakedefine MULTITHREADED 1
+#endif
+
+/* Enable exceptions. */
+#ifndef USE_EXCEPTIONS
+#cmakedefine USE_EXCEPTIONS 1
+#endif
+
+/* Use fixedpoint. */
+#ifndef USE_FIXEDPOINT
+#cmakedefine USE_FIXEDPOINT 1
+#endif
+
+/* Full path for the system-wide xpdfrc file. */
+#ifndef SYSTEM_XPDFRC
+#cmakedefine SYSTEM_XPDFRC 1
+#endif
+
+/* Include support for OPI comments. */
+#ifndef OPI_SUPPORT
+#cmakedefine OPI_SUPPORT 1
+#endif
+
+/* Enable word list support. */
+#ifndef TEXTOUT_WORD_LIST
+#cmakedefine TEXTOUT_WORD_LIST 1
+#endif
+
+// Also, there's a couple of preprocessor symbols in the header files
+// that are used but never defined: DISABLE_OUTLINE, DEBUG_MEM and
+
+//------------------------------------------------------------------------
+// version
+//------------------------------------------------------------------------
+
+// xpdf version
+#define xpdfVersion         "3.00"
+#define xpdfVersionNum      3.00
+#define xpdfMajorVersion    3
+#define xpdfMinorVersion    0
+#define xpdfMajorVersionStr "3"
+#define xpdfMinorVersionStr "0"
+
+// supported PDF version
+#define supportedPDFVersionStr "1.5"
+#define supportedPDFVersionNum 1.5
+
+// copyright notice
+#define xpdfCopyright "Copyright 1996-2004 Glyph & Cog, LLC"
+
+// Windows resource file stuff
+#define winxpdfVersion "WinXpdf 3.00"
+#define xpdfCopyrightAmp "Copyright 1996-2004 Glyph && Cog, LLC"
+
+//------------------------------------------------------------------------
+// paper size
+//------------------------------------------------------------------------
+
+// default paper size (in points) for PostScript output
+#ifdef A4_PAPER
+#define defPaperWidth  595    // ISO A4 (210x297 mm)
+#define defPaperHeight 842
+#else
+#define defPaperWidth  612    // American letter (8.5x11")
+#define defPaperHeight 792
+#endif
+
+//------------------------------------------------------------------------
+// config file (xpdfrc) path
+//------------------------------------------------------------------------
+
+// user config file name, relative to the user's home directory
+#if defined(VMS) || (defined(WIN32) && !defined(__CYGWIN32__))
+#define xpdfUserConfigFile "xpdfrc"
+#else
+#define xpdfUserConfigFile ".xpdfrc"
+#endif
+
+// system config file name (set via the configure script)
+#ifdef SYSTEM_XPDFRC
+#define xpdfSysConfigFile SYSTEM_XPDFRC
+#else
+// under Windows, we get the directory with the executable and then
+// append this file name
+#define xpdfSysConfigFile "xpdfrc"
+#endif
+
+//------------------------------------------------------------------------
+// X-related constants
+//------------------------------------------------------------------------
+
+// default maximum size of color cube to allocate
+#define defaultRGBCube 5
+
+// number of fonts (combined t1lib, FreeType, X server) to cache
+#define xOutFontCacheSize 64
+
+// number of Type 3 fonts to cache
+#define xOutT3FontCacheSize 8
+
+//------------------------------------------------------------------------
+// popen
+//------------------------------------------------------------------------
+
+#if defined(_MSC_VER) || defined(__BORLANDC__)
+#define popen _popen
+#define pclose _pclose
+#endif
+
+#if defined(VMS) || defined(VMCMS) || defined(DOS) || defined(OS2) || defined(__EMX__) || defined(WIN32) || defined(__DJGPP__) || defined(MACOS)
+#define POPEN_READ_MODE "rb"
+#else
+#define POPEN_READ_MODE "r"
+#endif
+
+//------------------------------------------------------------------------
+// Win32 stuff
+//------------------------------------------------------------------------
+
+#ifdef CDECL
+#cmakedefine CDECL 1
+#endif
+
+#if defined(_MSC_VER) || defined(__BORLANDC__)
+#define CDECL __cdecl
+#else
+#define CDECL
+#endif
+
+//------------------------------------------------------------------------
+// Compiler
+//------------------------------------------------------------------------
+
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
+#define GCC_PRINTF_FORMAT(fmt_index, va_index) \
+	__attribute__((__format__(__printf__, fmt_index, va_index)))
+#else
+#define GCC_PRINTF_FORMAT(fmt_index, va_index)
+#endif
+
+
+#endif /* POPPLER_CONFIG_H */
diff --git a/poppler-glib.pc.cmake b/poppler-glib.pc.cmake
new file mode 100644
index 0000000..6568f7a
--- /dev/null
+++ b/poppler-glib.pc.cmake
@@ -0,0 +1,13 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: poppler-glib
+Description: GLib wrapper for poppler
+Version: @POPPLER_VERSION@
+Requires: @PC_REQUIRES@ gobject-2.0 gdk-2.0 gdk-pixbuf-2.0 @CAIRO_REQ@
+ at PC_REQUIRES_PRIVATE@
+
+Libs: -L${libdir} -lpoppler-glib
+Cflags: -I${includedir}/poppler/glib
diff --git a/poppler-qt.pc.cmake b/poppler-qt.pc.cmake
new file mode 100644
index 0000000..8e83c5f
--- /dev/null
+++ b/poppler-qt.pc.cmake
@@ -0,0 +1,12 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: poppler-qt
+Description: Qt bindings for poppler
+Version: @POPPLER_VERSION@
+Requires: poppler = @POPPLER_VERSION@
+
+Libs: -L${libdir} -lpoppler-qt
+Cflags: -I${includedir}/poppler/qt3
diff --git a/poppler-qt4.pc.cmake b/poppler-qt4.pc.cmake
new file mode 100644
index 0000000..2606cc5
--- /dev/null
+++ b/poppler-qt4.pc.cmake
@@ -0,0 +1,12 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: poppler-qt4
+Description: Qt4 bindings for poppler
+Version: @POPPLER_VERSION@
+Requires: poppler = @POPPLER_VERSION@
+
+Libs: -L${libdir} -lpoppler-qt4
+Cflags: -I${includedir}/poppler/qt4
diff --git a/poppler-splash.pc.cmake b/poppler-splash.pc.cmake
new file mode 100644
index 0000000..375b73a
--- /dev/null
+++ b/poppler-splash.pc.cmake
@@ -0,0 +1,9 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: poppler-splash
+Description: Splash backend for Poppler PDF rendering library
+Version: @POPPLER_VERSION@
+Requires: poppler = @POPPLER_VERSION@
diff --git a/poppler.pc.cmake b/poppler.pc.cmake
new file mode 100644
index 0000000..dc8fcaf
--- /dev/null
+++ b/poppler.pc.cmake
@@ -0,0 +1,11 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: poppler
+Description: PDF rendering library
+Version: @POPPLER_VERSION@
+
+Libs: -L${libdir} -lpoppler
+Cflags: -I${includedir}/poppler
diff --git a/qt/CMakeLists.txt b/qt/CMakeLists.txt
new file mode 100644
index 0000000..f3d0916
--- /dev/null
+++ b/qt/CMakeLists.txt
@@ -0,0 +1,33 @@
+add_definitions(${QT3_DEFINITIONS})
+
+include_directories(
+  ${CMAKE_CURRENT_SOURCE_DIR}
+  ${QT3_INCLUDE_DIR}
+)
+
+set(poppler_qt_SRCS
+  poppler-document.cc
+  poppler-fontinfo.cc
+  poppler-link.cc
+  poppler-page.cc
+  poppler-page-transition.cc
+)
+add_library(poppler-qt SHARED ${poppler_qt_SRCS})
+set_target_properties(poppler-qt PROPERTIES VERSION 2.0.0 SOVERSION 2)
+target_link_libraries(poppler-qt poppler ${QT3_LIBRARIES})
+install(TARGETS poppler-qt RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
+
+install(FILES
+  poppler-qt.h
+  poppler-page-transition.h
+  poppler-link-qt3.h
+  DESTINATION include/poppler/qt3)
+
+
+set(test_poppler_qt_SOURCES
+  test-poppler-qt.cpp
+)
+poppler_add_test(test-poppler-qt BUILD_QT3_TESTS ${test_poppler_qt_SOURCES})
+target_link_libraries(test-poppler-qt poppler-qt)
+
+
diff --git a/qt4/CMakeLists.txt b/qt4/CMakeLists.txt
new file mode 100644
index 0000000..fdfb8f4
--- /dev/null
+++ b/qt4/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_subdirectory(src)
+add_subdirectory(tests)
diff --git a/qt4/src/CMakeLists.txt b/qt4/src/CMakeLists.txt
new file mode 100644
index 0000000..31a31fa
--- /dev/null
+++ b/qt4/src/CMakeLists.txt
@@ -0,0 +1,43 @@
+add_definitions(${QT4_DEFINITIONS})
+
+include_directories(
+  ${CMAKE_CURRENT_SOURCE_DIR}
+  ${CMAKE_SOURCE_DIR}/qt # for PageTransition
+  ${QT4_INCLUDE_DIR}
+)
+
+set(poppler_qt4_SRCS
+  poppler-annotation.cc
+  poppler-document.cc
+  poppler-embeddedfile.cc
+  poppler-fontinfo.cc
+  poppler-form.cc
+  poppler-link.cc
+  poppler-link-extractor.cc
+  poppler-page.cc
+  poppler-base-converter.cc
+  poppler-pdf-converter.cc
+  poppler-ps-converter.cc
+  poppler-qiodeviceoutstream.cc
+  poppler-sound.cc
+  poppler-textbox.cc
+  ${CMAKE_SOURCE_DIR}/qt/poppler-page-transition.cc
+)
+if (ENABLE_SPLASH)
+  set(poppler_qt4_SRCS ${poppler_qt4_SRCS}
+    ${CMAKE_SOURCE_DIR}/poppler/ArthurOutputDev.cc
+  )
+endif (ENABLE_SPLASH)
+add_library(poppler-qt4 SHARED ${poppler_qt4_SRCS})
+set_target_properties(poppler-qt4 PROPERTIES VERSION 2.0.0 SOVERSION 2)
+target_link_libraries(poppler-qt4 poppler ${QT4_QTCORE_LIBRARY} ${QT4_QTGUI_LIBRARY} ${QT4_QTXML_LIBRARY})
+install(TARGETS poppler-qt4 RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
+
+install(FILES
+  poppler-qt4.h
+  poppler-link.h
+  poppler-annotation.h
+  poppler-form.h
+  ${CMAKE_SOURCE_DIR}/qt/poppler-page-transition.h
+  DESTINATION include/poppler/qt4)
+
diff --git a/qt4/tests/CMakeLists.txt b/qt4/tests/CMakeLists.txt
new file mode 100644
index 0000000..bd32548
--- /dev/null
+++ b/qt4/tests/CMakeLists.txt
@@ -0,0 +1,47 @@
+add_definitions(${QT4_DEFINITIONS})
+
+include_directories(
+  ${CMAKE_CURRENT_SOURCE_DIR}
+  ${CMAKE_CURRENT_SOURCE_DIR}/../src
+  ${CMAKE_CURRENT_BINARY_DIR}
+  ${CMAKE_SOURCE_DIR}/qt # for PageTransition
+  ${QT4_INCLUDE_DIR}
+)
+
+macro(QT4_ADD_SIMPLETEST exe source)
+  string(REPLACE "-" "" test_name ${exe})
+  set(${test_name}_SOURCES
+    ${source}
+  )
+  poppler_add_test(${exe} BUILD_QT4_TESTS ${${test_name}_SOURCES})
+  target_link_libraries(${exe} poppler-qt4)
+endmacro(QT4_ADD_SIMPLETEST)
+
+macro(QT4_ADD_QTEST exe source)
+  if (QT4_QTTEST_FOUND)
+    string(REPLACE "-" "" test_name ${exe})
+    set(${test_name}_SOURCES
+      ${source}
+    )
+    poppler_add_unittest(${exe} BUILD_QT4_TESTS ${${test_name}_SOURCES})
+    qt4_automoc(${${test_name}_SOURCES})
+    target_link_libraries(${exe} poppler-qt4 ${QT4_QTTEST_LIBRARY})
+  endif (QT4_QTTEST_FOUND)
+endmacro(QT4_ADD_QTEST)
+
+
+qt4_add_simpletest(test-poppler-qt4 test-poppler-qt4.cpp)
+qt4_add_simpletest(test-password-qt4 test-password-qt4.cpp)
+qt4_add_simpletest(poppler-fonts poppler-fonts.cpp)
+qt4_add_simpletest(poppler_attachments poppler-attachments.cpp)
+qt4_add_simpletest(stress-poppler-qt4 stress-poppler-qt4.cpp)
+
+qt4_add_qtest(check_attachments check_attachments.cpp)
+qt4_add_qtest(check_dateConversion check_dateConversion.cpp)
+qt4_add_qtest(check_fonts check_fonts.cpp)
+qt4_add_qtest(check_metadata check_metadata.cpp)
+qt4_add_qtest(check_pagelayout check_pagelayout.cpp)
+qt4_add_qtest(check_pagemode check_pagemode.cpp)
+qt4_add_qtest(check_password check_password.cpp)
+qt4_add_qtest(check_permissions check_permissions.cpp)
+qt4_add_qtest(check_search check_search.cpp)
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
new file mode 100644
index 0000000..478cb31
--- /dev/null
+++ b/test/CMakeLists.txt
@@ -0,0 +1,52 @@
+
+if (ENABLE_SPLASH)
+
+  set (perf_test_SRCS
+    perf-test.cc
+    perf-test-preview-dummy.cc
+  )
+  add_executable(perf-test ${perf_test_SRCS})
+  target_link_libraries(perf-test poppler)
+
+endif (ENABLE_SPLASH)
+
+if (GTK_FOUND)
+
+  add_definitions(${GTK2_CFLAGS})
+
+  include_directories(
+    ${CMAKE_SOURCE_DIR}/glib
+    ${CMAKE_BINARY_DIR}/glib
+  )
+
+  set (gtk_splash_test_SRCS
+    gtk-splash-test.cc
+  )
+  poppler_add_test(gtk-splash-test BUILD_GTK_TESTS ${gtk_splash_test_SRCS})
+  target_link_libraries(gtk-splash-test poppler ${GTK2_LIBRARIES})
+
+  if (HAVE_CAIRO)
+
+    set (gtk_cairo_test_SRCS
+      gtk-cairo-test.cc
+    )
+    poppler_add_test(gtk-cairo-test BUILD_GTK_TESTS ${gtk_cairo_test_SRCS})
+    target_link_libraries(gtk-cairo-test poppler-glib ${GTK2_LIBRARIES})
+
+    set (pdf_inspector_SRCS
+      pdf-inspector.cc
+    )
+    poppler_add_test(pdf-inspector BUILD_GTK_TESTS ${pdf_inspector_SRCS})
+    target_link_libraries(pdf-inspector poppler-glib ${GTK2_LIBRARIES})
+
+  endif (HAVE_CAIRO)
+
+endif (GTK_FOUND)
+
+set (pdf_fullrewrite_SRCS
+  pdf-fullrewrite.cc
+)
+add_executable(pdf-fullrewrite ${pdf_fullrewrite_SRCS})
+target_link_libraries(pdf-fullrewrite poppler)
+
+
diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt
new file mode 100644
index 0000000..8f8b418
--- /dev/null
+++ b/utils/CMakeLists.txt
@@ -0,0 +1,84 @@
+
+set(common_srcs
+  parseargs.c
+)
+set(common_libs
+  poppler
+)
+if (FONTCONFIG_FOUND)
+  set(common_libs ${common_libs} ${FONTCONFIG_LIBRARIES})
+endif (FONTCONFIG_FOUND)
+
+if (ENABLE_SPLASH)
+  # pdftoppm
+  set(pdftoppm_SOURCES ${common_srcs}
+    pdftoppm.cc
+  )
+  add_executable(pdftoppm ${pdftoppm_SOURCES})
+  target_link_libraries(pdftoppm ${common_libs})
+  install(TARGETS pdftoppm DESTINATION bin)
+endif (ENABLE_SPLASH)
+
+# pdffonts
+set(pdffonts_SOURCES ${common_srcs}
+  pdffonts.cc
+)
+add_executable(pdffonts ${pdffonts_SOURCES})
+target_link_libraries(pdffonts ${common_libs})
+install(TARGETS pdffonts DESTINATION bin)
+
+# pdfimages
+set(pdfimages_SOURCES ${common_srcs}
+  pdfimages.cc
+  ImageOutputDev.cc
+  ImageOutputDev.h
+)
+add_executable(pdfimages ${pdfimages_SOURCES})
+target_link_libraries(pdfimages ${common_libs})
+install(TARGETS pdfimages DESTINATION bin)
+
+# pdfinfo
+set(pdfinfo_SOURCES ${common_srcs}
+  pdfinfo.cc
+)
+add_executable(pdfinfo ${pdfinfo_SOURCES})
+target_link_libraries(pdfinfo ${common_libs})
+install(TARGETS pdfinfo DESTINATION bin)
+
+# pdftops
+set(pdftops_SOURCES ${common_srcs}
+  pdftops.cc
+)
+add_executable(pdftops ${pdftops_SOURCES})
+target_link_libraries(pdftops ${common_libs})
+install(TARGETS pdftops DESTINATION bin)
+
+# pdftotext
+set(pdftotext_SOURCES ${common_srcs}
+  pdftotext.cc
+)
+add_executable(pdftotext ${pdftotext_SOURCES})
+target_link_libraries(pdftotext ${common_libs})
+install(TARGETS pdftotext DESTINATION bin)
+
+# pdftohtml
+set(pdftohtml_SOURCES ${common_srcs}
+  pdftohtml.cc
+  HtmlFonts.cc
+  HtmlLinks.cc
+  HtmlOutputDev.cc
+)
+add_executable(pdftohtml ${pdftohtml_SOURCES})
+target_link_libraries(pdftohtml ${common_libs})
+install(TARGETS pdftohtml DESTINATION bin)
+
+if (ENABLE_ABIWORD)
+  # pdftoabw
+  set(pdftoabw_SOURCES ${common_srcs}
+    pdftoabw.cc
+  )
+  add_executable(pdftoabw ${pdftoabw_SOURCES})
+  target_link_libraries(pdftoabw ${common_libs})
+  install(TARGETS pdftoabw DESTINATION bin)
+endif (ENABLE_ABIWORD)
+


More information about the poppler mailing list