]> git.lyx.org Git - features.git/commitdiff
Initial cmake support.
authorPeter Kümmel <syntheticpp@gmx.net>
Sun, 11 Jun 2006 11:57:25 +0000 (11:57 +0000)
committerPeter Kümmel <syntheticpp@gmx.net>
Sun, 11 Jun 2006 11:57:25 +0000 (11:57 +0000)
trunk/development/cmake/README.cmake:

Building LyX with CMake

CMake 2.4.2 or CVS version from www.cmake.org

Building Visual C++ 2005 project files:

- install Visual C++ 2005
- install Platform SDK 2005, "Core" and "Web Workshop"
- add include and library paths of the SDK to the IDE search paths,
  menu: Tools->Options->VC++ directories->Library files + Include files
- install zlib (www.zlib.net) into %ProgramFiles%/GnuWin32/include+lib
  or %ProgramFiles%/zlib/include+lib
- create a build directory, e.g. .../trunk/../build
- call in the build directory cmake ..\trunk\development\cmake
- start lyx.sln

To generate other build files call "cmake"
which shows a list of possibilities.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14071 a592a061-630c-0410-9148-cb99ea01b6c8

33 files changed:
development/cmake/CMakeLists.txt [new file with mode: 0755]
development/cmake/ConfigureChecks.cmake [new file with mode: 0755]
development/cmake/README.cmake [new file with mode: 0755]
development/cmake/boost/CMakeLists.txt [new file with mode: 0755]
development/cmake/boost/libs/CMakeLists.txt [new file with mode: 0755]
development/cmake/boost/libs/filesystem/CMakeLists.txt [new file with mode: 0755]
development/cmake/boost/libs/iostreams/CMakeLists.txt [new file with mode: 0755]
development/cmake/boost/libs/regex/CMakeLists.txt [new file with mode: 0755]
development/cmake/boost/libs/signals/CMakeLists.txt [new file with mode: 0755]
development/cmake/config.h.cmake [new file with mode: 0755]
development/cmake/intl/CMakeLists.txt [new file with mode: 0755]
development/cmake/intl/libgnuintl.h [new file with mode: 0755]
development/cmake/modules/FindASPELL.cmake [new file with mode: 0755]
development/cmake/modules/FindGNUWIN32.cmake [new file with mode: 0755]
development/cmake/modules/FindICONV.cmake [new file with mode: 0755]
development/cmake/modules/FindQt4.cmake [new file with mode: 0755]
development/cmake/modules/FindZLIB.cmake [new file with mode: 0755]
development/cmake/modules/LyXMacros.cmake [new file with mode: 0755]
development/cmake/modules/LyXPaths.cmake [new file with mode: 0755]
development/cmake/modules/LyXuic.cmake [new file with mode: 0755]
development/cmake/modules/MacroAddFileDependencies.cmake [new file with mode: 0755]
development/cmake/src/CMakeLists.txt [new file with mode: 0755]
development/cmake/src/dummy.cpp [new file with mode: 0755]
development/cmake/src/frontends/CMakeLists.txt [new file with mode: 0755]
development/cmake/src/frontends/controllers/CMakeLists.txt [new file with mode: 0755]
development/cmake/src/frontends/qt4/CMakeLists.txt [new file with mode: 0755]
development/cmake/src/graphics/CMakeLists.txt [new file with mode: 0755]
development/cmake/src/insets/CMakeLists.txt [new file with mode: 0755]
development/cmake/src/mathed/CMakeLists.txt [new file with mode: 0755]
development/cmake/src/support/CMakeLists.txt [new file with mode: 0755]
development/cmake/src/support/package.C.cmake [new file with mode: 0755]
development/cmake/src/tex2lyx/CMakeLists.txt [new file with mode: 0755]
development/cmake/src/version.C.cmake [new file with mode: 0755]

diff --git a/development/cmake/CMakeLists.txt b/development/cmake/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..7d4c013
--- /dev/null
@@ -0,0 +1,76 @@
+project(lyx)
+
+# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
+set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/modules")
+
+include(LyXPaths)
+include(LyXMacros)
+
+find_package(Qt4 REQUIRED)
+find_package(ZLIB REQUIRED)
+
+
+if(all OR nls)
+       find_package(ICONV REQUIRED)
+else(all OR nls)
+       find_package(ICONV)
+endif(all OR nls)
+set(nls)
+
+if(all OR aspell)
+       find_package(ASPELL REQUIRED)
+else(all OR aspell)
+       find_package(ASPELL)
+endif(all OR aspell)
+set(aspell)
+
+message("")
+if(ICONV_FOUND)
+       add_definitions(-DENABLE_NLS=1 -DHAVE_ICONV=1)
+       message("----- Building with ENABLE_NLS and HAVE_ICONV")
+else(ICONV_FOUND)
+       message("----- No iconv found, to get more information use -Dnls=1")
+endif(ICONV_FOUND)
+if(ASPELL_FOUND)
+       add_definitions(-DUSE_ASPELL=1)
+       message("----- Building with USE_ASPELL")
+else(ASPELL_FOUND)     
+       message("----- No aspell, to get more information use -Daspell=1")
+endif(ASPELL_FOUND)
+message("")
+set(all)
+
+# create config.h
+include(ConfigureChecks.cmake)
+configure_file(config.h.cmake ${CMAKE_BINARY_DIR}/config.h )
+
+
+
+if(MSVC)
+       if(MSVC_IDE)
+               add_definitions(-DBOOST_USER_CONFIG=&lt\;config.h&gt\;)
+       else(MSVC_IDE)
+               add_definitions(-DBOOST_USER_CONFIG="<config.h>")
+               SET(CMAKE_EXE_LINKER_FLAGS /MANIFEST)
+       endif(MSVC_IDE)
+
+       SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Zi -wd4996 -wd4800" CACHE STRING "runtime-library flags" FORCE)
+       SET(CMAKE_CXX_FLAGS_RELEASE  "${CMAKE_CXX_FLAGS_RELEASE} -wd4996 -wd4800" CACHE STRING "runtime-library flags" FORCE)
+       SET(CMAKE_C_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
+       SET(CMAKE_C_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE})
+else(MSVC)
+       add_definitions(-DBOOST_USER_CONFIG="<config.h>")
+endif(MSVC)
+
+     
+include_directories( 
+       ${CMAKE_BINARY_DIR} 
+       ${TOP_SRC_DIR}/src 
+       ${TOP_SRC_DIR}/boost 
+       ${QT_INCLUDES} 
+)
+
+
+add_subdirectory(boost)
+add_subdirectory(intl)
+add_subdirectory(src)
diff --git a/development/cmake/ConfigureChecks.cmake b/development/cmake/ConfigureChecks.cmake
new file mode 100755 (executable)
index 0000000..45339ab
--- /dev/null
@@ -0,0 +1,135 @@
+include(CheckIncludeFile)
+include(CheckIncludeFileCXX)
+include(CheckIncludeFiles)
+include(CheckSymbolExists)
+include(CheckFunctionExists)
+include(CheckLibraryExists)
+include(CheckTypeSize)
+include(CheckCXXSourceCompiles)
+
+
+check_include_file_cxx(aspell.h HAVE_ASPELL_H)
+check_include_file_cxx(aspell/aspell.h HAVE_ASPELL_ASPELL_H)
+check_include_file_cxx(istream HAVE_ISTREAM)
+check_include_file_cxx(ostream HAVE_OSTREAM)
+check_include_file_cxx(ios HAVE_IOS)
+check_include_file_cxx(sstream HAVE_SSTREAM)
+check_include_file_cxx(locale HAVE_LOCALE)
+
+check_include_files(io.h HAVE_IO_H)
+check_include_files(limits.h HAVE_LIMITS_H)
+check_include_files(locale.h HAVE_LOCALE_H)
+check_include_files(process.h HAVE_PROCESS_H)
+check_include_files(stdlib.h HAVE_STDLIB_H)
+check_include_files(sys/stat.h HAVE_SYS_STAT_H)
+check_include_files(sys/time.h HAVE_SYS_TIME_H)
+check_include_files(sys/types.h HAVE_SYS_TYPES_H)
+check_include_files(sys/utime.h HAVE_SYS_UTIME_H)
+check_include_files(sys/socket.h HAVE_SYS_SOCKET_H)
+check_include_files(unistd.h HAVE_UNISTD_H)
+check_include_files(inttypes.h HAVE_INTTYPES_H)
+check_include_files(utime.h HAVE_UTIME_H)
+check_include_files(string.h HAVE_STRING_H)
+check_include_files(strings.h HAVE_STRINGS_H)
+check_include_files(argz.h HAVE_ARGZ_H)
+
+
+check_function_exists(open HAVE_OPEN)
+check_function_exists(close HAVE_CLOSE)
+check_function_exists(popen HAVE_POPEN)
+check_function_exists(pclose HAVE_PCLOSE)
+check_function_exists(_open HAVE__OPEN)
+check_function_exists(_close HAVE__CLOSE)
+check_function_exists(_popen HAVE__POPEN)
+check_function_exists(_pclose HAVE__PCLOSE)
+check_function_exists(getpid HAVE_GETPID)
+check_function_exists(_getpid HAVE__GETPID)
+check_function_exists(mkdir  HAVE_MKDIR)
+check_function_exists(_mkdir HAVE__MKDIR)
+check_function_exists(putenv HAVE_PUTENV)
+check_function_exists(mktemp HAVE_MKTEMP)
+check_function_exists(mkstemp HAVE_MKSTEMP)
+check_function_exists(strerror HAVE_STRERROR)
+check_function_exists(getcwd HAVE_GETCWD)
+check_function_exists(stpcpy HAVE_STPCPY)
+check_function_exists(strcasecmp HAVE_STRCASECMP)
+check_function_exists(strdup HAVE_STRDUP)
+check_function_exists(strtoul HAVE_STRTOUL)
+check_function_exists(alloca HAVE_ALLOCA)
+check_function_exists(__fsetlocking HAVE___FSETLOCKING)
+check_function_exists(mempcpy HAVE_MEMPCPY)
+check_function_exists(__argz_count HAVE___ARGZ_COUNT)
+check_function_exists(__argz_next HAVE___ARGZ_NEXT)
+check_function_exists(__argz_stringify HAVE___ARGZ_STRINGIFY)
+check_function_exists(setlocale HAVE_SETLOCALE)
+check_function_exists(tsearch HAVE_TSEARCH)
+check_function_exists(getegid HAVE_GETEGID)
+check_function_exists(getgid HAVE_GETGID)
+check_function_exists(getuid HAVE_GETUID)
+check_function_exists(wcslen HAVE_WCSLEN)
+
+check_symbol_exists(asprintf "stdio.h" HAVE_ASPRINTF)
+check_symbol_exists(wprintf "stdio.h" HAVE_WPRINTF)
+check_symbol_exists(snprintf "stdio.h" HAVE_SNPRINTF)
+check_symbol_exists(printf "stdio.h" HAVE_POSIX_PRINTF)
+check_symbol_exists(fcntl "stdio.h" HAVE_FCNTL)
+check_symbol_exists(pid_t "sys/types.h" HAVE_PID_T)
+check_symbol_exists(intmax_t "inttypes.h" HAVE_INTTYPES_H_WITH_UINTMAX)
+check_symbol_exists(uintmax_t "stdint.h" HAVE_STDINT_H_WITH_UINTMAX)
+check_symbol_exists(LC_MESSAGES "locale.h" HAVE_LC_MESSAGES)
+
+check_type_size(intmax_t HAVE_INTMAX_T)
+check_type_size("long double"  HAVE_LONG_DOUBLE)
+check_type_size("long long"  HAVE_LONG_LONG)
+check_type_size(wchar_t HAVE_WCHAR_T)
+check_type_size(wint_t  HAVE_WINT_T)
+
+
+check_cxx_source_compiles(
+       "
+       #include <algorithm>
+       using std::count;
+       int countChar(char * b, char * e, char const c)
+       {
+               return count(b, e, c);
+       }
+       int main(){return 0;}
+       "
+HAVE_STD_COUNT)
+
+check_cxx_source_compiles(
+       "
+       #include <streambuf>
+       #include <istream>
+       typedef std::istreambuf_iterator<char> type;
+       int main(){return 0;}
+       "
+HAVE_DECL_ISTREAMBUF_ITERATOR)
+
+check_cxx_source_compiles(
+       "
+       #include <cctype>
+       using std::tolower;
+       int main(){return 0;}
+       "
+CXX_GLOBAL_CSTD)
+
+set(PACKAGE lyx)
+set(PACKAGE_VERSION 1.5.0svn)
+
+if(WIN32)
+       set(USE_WINDOWS_PACKAGING 1)
+else(WIN32)
+       set(USE_POSIX_PACKAGING 1)
+endif(WIN32)
+
+
+
+
+
+
+
+
+
+
+
diff --git a/development/cmake/README.cmake b/development/cmake/README.cmake
new file mode 100755 (executable)
index 0000000..b6c4e87
--- /dev/null
@@ -0,0 +1,21 @@
+Building LyX with CMake\r
+\r
+CMake 2.4.2 or CVS version from www.cmake.org\r
+\r
+\r
+Building Visual C++ 2005 project files:\r
+\r
+- install Visual C++ 2005\r
+- install Platform SDK 2005, "Core" and "Web Workshop"\r
+- add include and library paths of the SDK to the IDE search paths,\r
+  menu: Tools->Options->VC++ directories->Library files + Include files\r
+- install zlib (www.zlib.net) into %ProgramFiles%/GnuWin32/include+lib\r
+  or %ProgramFiles%/zlib/include+lib\r
+- create a build directory, e.g. .../trunk/../build\r
+- call in the build directory 'cmake ..\trunk\development\cmake'\r
+- start lyx.sln\r
+\r
+\r
+To generate other build files call 'cmake'\r
+which shows a list of possibilities.\r
+\r
diff --git a/development/cmake/boost/CMakeLists.txt b/development/cmake/boost/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..3b36057
--- /dev/null
@@ -0,0 +1 @@
+add_subdirectory(libs) 
diff --git a/development/cmake/boost/libs/CMakeLists.txt b/development/cmake/boost/libs/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..052153f
--- /dev/null
@@ -0,0 +1,6 @@
+project(boost)
+
+add_subdirectory(filesystem) 
+add_subdirectory(iostreams) 
+add_subdirectory(regex) 
+add_subdirectory(signals) 
diff --git a/development/cmake/boost/libs/filesystem/CMakeLists.txt b/development/cmake/boost/libs/filesystem/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..797d681
--- /dev/null
@@ -0,0 +1,12 @@
+project(boost_filesystem)
+
+set(boost_filesystem_sources
+       convenience.cpp
+       exception.cpp
+       operations_posix_windows.cpp
+       path_posix_windows.cpp
+)
+
+lyx_add_path(boost_filesystem_sources ${TOP_SRC_DIR}/boost/libs/filesystem/src)
+
+add_library(boost_filesystem STATIC ${boost_filesystem_sources})
\ No newline at end of file
diff --git a/development/cmake/boost/libs/iostreams/CMakeLists.txt b/development/cmake/boost/libs/iostreams/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..aca01c5
--- /dev/null
@@ -0,0 +1,16 @@
+project(boost_iostreams)
+
+set(boost_iostreams_sources
+       file_descriptor.cpp
+       mapped_file.cpp
+       zlib.cpp
+)
+
+lyx_add_path(boost_iostreams_sources ${TOP_SRC_DIR}/boost/libs/iostreams/src)
+
+include_directories(${ZLIB_INCLUDE_DIR})
+
+add_library(boost_iostreams STATIC ${boost_iostreams_sources})
+
+target_link_libraries(boost_iostreams ${ZLIB_LIBRARY})
+
diff --git a/development/cmake/boost/libs/regex/CMakeLists.txt b/development/cmake/boost/libs/regex/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..11514f0
--- /dev/null
@@ -0,0 +1,19 @@
+project(boost_regex)
+
+set(boost_regex_sources
+       cpp_regex_traits.cpp
+       c_regex_traits.cpp
+       cregex.cpp
+       fileiter.cpp
+       instances.cpp
+       regex.cpp
+       regex_raw_buffer.cpp
+       regex_traits_defaults.cpp
+       w32_regex_traits.cpp
+)
+
+lyx_add_path(boost_regex_sources ${TOP_SRC_DIR}/boost/libs/regex/src)
+
+add_library(boost_regex STATIC ${boost_regex_sources})
+
+
diff --git a/development/cmake/boost/libs/signals/CMakeLists.txt b/development/cmake/boost/libs/signals/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..8b48bfa
--- /dev/null
@@ -0,0 +1,14 @@
+project(boost_signals)
+
+set(boost_signals_sources
+       connection.cpp 
+       named_slot_map.cpp 
+       signal_base.cpp 
+       slot.cpp 
+       trackable.cpp
+)
+
+lyx_add_path(boost_signals_sources ${TOP_SRC_DIR}/boost/libs/signals/src)
+
+add_library(boost_signals STATIC ${boost_signals_sources})
+       
diff --git a/development/cmake/config.h.cmake b/development/cmake/config.h.cmake
new file mode 100755 (executable)
index 0000000..0f38b94
--- /dev/null
@@ -0,0 +1,144 @@
+/*
+ * \file config.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * This is the compilation configuration file for LyX.
+ * It was generated by autoconfs configure.
+ * You might want to change some of the defaults if something goes wrong
+ * during the compilation.
+ */
+
+#ifndef _CONFIG_H
+#define _CONFIG_H
+
+
+#cmakedefine HAVE_IO_H 1
+#cmakedefine HAVE_LIMITS_H 1
+#cmakedefine HAVE_LOCALE_H 1
+#cmakedefine HAVE_PROCESS_H 1
+#cmakedefine HAVE_STDLIB_H 1
+#cmakedefine HAVE_SYS_STAT_H 1
+#cmakedefine HAVE_SYS_TIME_H 1
+#cmakedefine HAVE_SYS_TYPES_H 1
+#cmakedefine HAVE_SYS_UTIME_H 1
+#cmakedefine HAVE_SYS_SOCKET_H 1
+#cmakedefine HAVE_UNISTD_H 1
+#cmakedefine HAVE_INTTYPES_H 1
+#cmakedefine HAVE_UTIME_H 1
+#cmakedefine HAVE_STRING_H 1
+#cmakedefine HAVE_STRINGS_H 1
+#cmakedefine HAVE_ISTREAM 1
+#cmakedefine HAVE_OSTREAM 1
+#cmakedefine HAVE_IOS 1
+#cmakedefine HAVE_LOCALE 1
+#cmakedefine HAVE_OPEN 1
+#cmakedefine HAVE_CLOSE 1
+#cmakedefine HAVE_POPEN 1
+#cmakedefine HAVE_PCLOSE 1
+#cmakedefine HAVE__OPEN 1
+#cmakedefine HAVE__CLOSE 1
+#cmakedefine HAVE__POPEN 1
+#cmakedefine HAVE__PCLOSE 1
+#cmakedefine HAVE_GETPID 1
+#cmakedefine HAVE__GETPID 1
+#cmakedefine HAVE_MKDIR 1
+#cmakedefine HAVE__MKDIR 1
+#cmakedefine HAVE_PUTENV 1
+#cmakedefine HAVE_MKTEMP 1
+#cmakedefine HAVE_MKSTEMP 1
+#cmakedefine HAVE_STRERROR 1
+#cmakedefine HAVE_STD_COUNT 1
+#cmakedefine HAVE_ASPRINTF 1
+#cmakedefine HAVE_WPRINTF 1
+#cmakedefine HAVE_SNPRINTF 1
+#cmakedefine HAVE_POSIX_PRINTF 1
+#cmakedefine HAVE_FCNTL 1
+#cmakedefine HAVE_INTMAX_T 1
+#cmakedefine HAVE_INTTYPES_H_WITH_UINTMAX 1
+#cmakedefine HAVE_DECL_ISTREAMBUF_ITERATOR 1
+#cmakedefine CXX_GLOBAL_CSTD 1
+#cmakedefine HAVE_GETCWD 1
+#cmakedefine HAVE_STPCPY 1
+#cmakedefine HAVE_STRCASECMP 1
+#cmakedefine HAVE_STRDUP 1
+#cmakedefine HAVE_STRTOUL 1
+#cmakedefine HAVE_ALLOCA 1
+#cmakedefine HAVE___FSETLOCKING 1
+#cmakedefine HAVE_MEMPCPY 1
+#cmakedefine HAVE___ARGZ_COUNT 1
+#cmakedefine HAVE___ARGZ_NEXT 1
+#cmakedefine HAVE___ARGZ_STRINGIFY 1
+#cmakedefine HAVE_SETLOCALE 1
+#cmakedefine HAVE_TSEARCH 1
+#cmakedefine HAVE_GETEGID 1
+#cmakedefine HAVE_GETGID 1
+#cmakedefine HAVE_GETUID 1
+#cmakedefine HAVE_WCSLEN 1
+#cmakedefine HAVE_WPRINTF 1
+#cmakedefine HAVE_LONG_DOUBLE 1
+#cmakedefine HAVE_LONG_LONG 1
+#cmakedefine HAVE_WCHAR_T 1
+#cmakedefine HAVE_WINT_T 1
+#cmakedefine HAVE_STDINT_H_WITH_UINTMAX 1
+#cmakedefine HAVE_LC_MESSAGES 1    
+#cmakedefine HAVE_SSTREAM 1
+#cmakedefine HAVE_ARGZ_H 1
+
+#cmakedefine HAVE_ASPELL_ASPELL_H 1
+#cmakedefine HAVE_ASPELL_H 1
+
+
+#cmakedefine PACKAGE "${PACKAGE}"
+#cmakedefine PACKAGE_VERSION ${PACKAGE_VERSION}
+
+#cmakedefine USE_POSIX_PACKAGING 1
+#cmakedefine USE_WINDOWS_PACKAGING 1
+#cmakedefine PATH_MAX ${PATH_MAX}
+
+#ifdef _MSC_VER
+#undef HAVE_OPEN  // use _open instead
+#define pid_t int
+#define PATH_MAX 512
+#endif
+
+#ifdef _WIN32 
+#undef HAVE_MKDIR // use _mkdir instead
+#endif
+
+#define BOOST_ALL_NO_LIB 1
+
+#if defined(HAVE_OSTREAM) && defined(HAVE_LOCALE) && defined(HAVE_SSTREAM)
+#  define USE_BOOST_FORMAT 1
+#else
+#  define USE_BOOST_FORMAT 0
+#endif
+
+
+#if !defined(ENABLE_ASSERTIONS)
+#  define BOOST_DISABLE_ASSERTS 1
+#endif
+#define BOOST_ENABLE_ASSERT_HANDLER 1
+
+#define BOOST_DISABLE_THREADS 1
+#define BOOST_NO_WREGEX 1
+#define BOOST_NO_WSTRING 1
+
+#ifdef __CYGWIN__
+#  define BOOST_POSIX 1
+#endif
+
+#if defined(HAVE_NEWAPIS_H)
+#  define WANT_GETFILEATTRIBUTESEX_WRAPPER 1
+#endif
+
+#if defined(MAKE_INTL_LIB) && defined(_MSC_VER)
+#define __attribute__(x)
+#define inline
+#define uintmax_t UINT_MAX
+#endif
+
+
+
+
+#endif
\ No newline at end of file
diff --git a/development/cmake/intl/CMakeLists.txt b/development/cmake/intl/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..cb2df37
--- /dev/null
@@ -0,0 +1,79 @@
+project(intl) 
+
+# libgnuintl.h.in => libintl.h
+configure_file(libgnuintl.h ${CMAKE_CURRENT_BINARY_DIR}/libgnuintl.h COPYONLY)
+configure_file(libgnuintl.h ${CMAKE_CURRENT_BINARY_DIR}/libintl.h COPYONLY)
+
+
+add_definitions(
+    -DHAVE_CONFIG_H=1
+    -DMAKE_INTL_LIB
+    -DIN_LIBINTL
+    -DENABLE_RELOCATABLE=1
+    -DIN_LIBRARY
+    -DNO_XMALLOC
+    -Dset_relocation_prefix=libintl_set_relocation_prefix
+    -Drelocate=libintl_relocate
+    -DDEPENDS_ON_LIBICONV=1
+    -DICONV_CONST=const
+    )
+    
+    
+if(MSVC_IDE)
+       add_definitions(
+               -DLOCALEDIR="${LOCALE_DIR}" 
+               -DLOCALE_ALIAS_PATH="${LOCALE_DIR}"
+               -DLIBDIR="${TOP_SRC_DIR}"
+               -DINSTALLDIR="${PREFIX}"
+               )
+else(MSVC_IDE)
+       add_definitions(
+               -DLOCALEDIR=\\"${LOACLE_DIR}\\" 
+               -DLOCALE_ALIAS_PATH=\\"${LOACLE_DIR}\\"
+               -DLIBDIR=\\"${TOP_SRC_DIR}\\"
+               -DINSTALLDIR=\\"${PREFIX}\\" 
+               )
+endif(MSVC_IDE)
+
+    
+
+
+set(intl_sources 
+      bindtextdom.c
+      dcgettext.c
+      dgettext.c
+      gettext.c
+      finddomain.c
+      loadmsgcat.c
+      localealias.c
+      textdomain.c
+      l10nflist.c
+      explodename.c
+      dcigettext.c
+      dcngettext.c
+      dngettext.c
+      ngettext.c
+      plural.c
+      plural-exp.c
+      localcharset.c
+      relocatable.c
+      localename.c
+      log.c
+      printf.c
+      osdep.c
+      intl-compat.c
+)
+
+lyx_add_path(intl_sources ${TOP_SRC_DIR}/intl)
+
+include_directories(${TOP_SRC_DIR}/intl ${CMAKE_CURRENT_BINARY_DIR})
+
+if(ICONV_FOUND)
+       include_directories(${ICONV_INCLUDE_DIR})
+endif(ICONV_FOUND)
+
+add_library(intl STATIC ${intl_sources})
+
+if(ICONV_FOUND)
+       target_link_libraries(intl ${ICONV_LIBRARY})
+endif(ICONV_FOUND)
diff --git a/development/cmake/intl/libgnuintl.h b/development/cmake/intl/libgnuintl.h
new file mode 100755 (executable)
index 0000000..1d6a275
--- /dev/null
@@ -0,0 +1,383 @@
+/* Message catalogs for internationalization.
+   Copyright (C) 1995-1997, 2000-2003 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify it
+   under the terms of the GNU Library 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+   USA.  */
+
+#ifndef _LIBINTL_H
+#define _LIBINTL_H     1
+
+#include <locale.h>
+
+/* The LC_MESSAGES locale category is the category used by the functions
+   gettext() and dgettext().  It is specified in POSIX, but not in ANSI C.
+   On systems that don't define it, use an arbitrary value instead.
+   On Solaris, <locale.h> defines __LOCALE_H (or _LOCALE_H in Solaris 2.5)
+   then includes <libintl.h> (i.e. this file!) and then only defines
+   LC_MESSAGES.  To avoid a redefinition warning, don't define LC_MESSAGES
+   in this case.  */
+#if !defined LC_MESSAGES && !(defined __LOCALE_H || (defined _LOCALE_H && defined __sun))
+# define LC_MESSAGES 1729
+#endif
+
+/* We define an additional symbol to signal that we use the GNU
+   implementation of gettext.  */
+#define __USE_GNU_GETTEXT 1
+
+/* Provide information about the supported file formats.  Returns the
+   maximum minor revision number supported for a given major revision.  */
+#define __GNU_GETTEXT_SUPPORTED_REVISION(major) \
+  ((major) == 0 ? 1 : -1)
+
+/* Resolve a platform specific conflict on DJGPP.  GNU gettext takes
+   precedence over _conio_gettext.  */
+#ifdef __DJGPP__
+# undef gettext
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* We redirect the functions to those prefixed with "libintl_".  This is
+   necessary, because some systems define gettext/textdomain/... in the C
+   library (namely, Solaris 2.4 and newer, and GNU libc 2.0 and newer).
+   If we used the unprefixed names, there would be cases where the
+   definition in the C library would override the one in the libintl.so
+   shared library.  Recall that on ELF systems, the symbols are looked
+   up in the following order:
+     1. in the executable,
+     2. in the shared libraries specified on the link command line, in order,
+     3. in the dependencies of the shared libraries specified on the link
+        command line,
+     4. in the dlopen()ed shared libraries, in the order in which they were
+        dlopen()ed.
+   The definition in the C library would override the one in libintl.so if
+   either
+     * -lc is given on the link command line and -lintl isn't, or
+     * -lc is given on the link command line before -lintl, or
+     * libintl.so is a dependency of a dlopen()ed shared library but not
+       linked to the executable at link time.
+   Since Solaris gettext() behaves differently than GNU gettext(), this
+   would be unacceptable.
+
+   The redirection happens by default through macros in C, so that &gettext
+   is independent of the compilation unit, but through inline functions in
+   C++, in order not to interfere with the name mangling of class fields or
+   class methods called 'gettext'.  */
+
+/* The user can define _INTL_REDIRECT_INLINE or _INTL_REDIRECT_MACROS.
+   If he doesn't, we choose the method.  A third possible method is
+   _INTL_REDIRECT_ASM, supported only by GCC.  */
+#if !(defined _INTL_REDIRECT_INLINE || defined _INTL_REDIRECT_MACROS)
+# if __GNUC__ >= 2 && !defined __APPLE_CC__ && !defined __MINGW32__ && !(__GNUC__ == 2 && defined _AIX) && (defined __STDC__ || defined __cplusplus)
+#  define _INTL_REDIRECT_ASM
+# else
+#  ifdef __cplusplus
+#   define _INTL_REDIRECT_INLINE
+#  else
+#   define _INTL_REDIRECT_MACROS
+#  endif
+# endif
+#endif
+/* Auxiliary macros.  */
+#ifdef _INTL_REDIRECT_ASM
+# define _INTL_ASM(cname) __asm__ (_INTL_ASMNAME (__USER_LABEL_PREFIX__, #cname))
+# define _INTL_ASMNAME(prefix,cnamestring) _INTL_STRINGIFY (prefix) cnamestring
+# define _INTL_STRINGIFY(prefix) #prefix
+#else
+# define _INTL_ASM(cname)
+#endif
+
+/* Look up MSGID in the current default message catalog for the current
+   LC_MESSAGES locale.  If not found, returns MSGID itself (the default
+   text).  */
+#ifdef _INTL_REDIRECT_INLINE
+extern char *libintl_gettext (const char *__msgid);
+static inline char *gettext (const char *__msgid)
+{
+  return libintl_gettext (__msgid);
+}
+#else
+#ifdef _INTL_REDIRECT_MACROS
+# define gettext libintl_gettext
+#endif
+extern char *gettext (const char *__msgid)
+       _INTL_ASM (libintl_gettext);
+#endif
+
+/* Look up MSGID in the DOMAINNAME message catalog for the current
+   LC_MESSAGES locale.  */
+#ifdef _INTL_REDIRECT_INLINE
+extern char *libintl_dgettext (const char *__domainname, const char *__msgid);
+static inline char *dgettext (const char *__domainname, const char *__msgid)
+{
+  return libintl_dgettext (__domainname, __msgid);
+}
+#else
+#ifdef _INTL_REDIRECT_MACROS
+# define dgettext libintl_dgettext
+#endif
+extern char *dgettext (const char *__domainname, const char *__msgid)
+       _INTL_ASM (libintl_dgettext);
+#endif
+
+/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
+   locale.  */
+#ifdef _INTL_REDIRECT_INLINE
+extern char *libintl_dcgettext (const char *__domainname, const char *__msgid,
+                               int __category);
+static inline char *dcgettext (const char *__domainname, const char *__msgid,
+                              int __category)
+{
+  return libintl_dcgettext (__domainname, __msgid, __category);
+}
+#else
+#ifdef _INTL_REDIRECT_MACROS
+# define dcgettext libintl_dcgettext
+#endif
+extern char *dcgettext (const char *__domainname, const char *__msgid,
+                       int __category)
+       _INTL_ASM (libintl_dcgettext);
+#endif
+
+
+/* Similar to `gettext' but select the plural form corresponding to the
+   number N.  */
+#ifdef _INTL_REDIRECT_INLINE
+extern char *libintl_ngettext (const char *__msgid1, const char *__msgid2,
+                              unsigned long int __n);
+static inline char *ngettext (const char *__msgid1, const char *__msgid2,
+                             unsigned long int __n)
+{
+  return libintl_ngettext (__msgid1, __msgid2, __n);
+}
+#else
+#ifdef _INTL_REDIRECT_MACROS
+# define ngettext libintl_ngettext
+#endif
+extern char *ngettext (const char *__msgid1, const char *__msgid2,
+                      unsigned long int __n)
+       _INTL_ASM (libintl_ngettext);
+#endif
+
+/* Similar to `dgettext' but select the plural form corresponding to the
+   number N.  */
+#ifdef _INTL_REDIRECT_INLINE
+extern char *libintl_dngettext (const char *__domainname, const char *__msgid1,
+                               const char *__msgid2, unsigned long int __n);
+static inline char *dngettext (const char *__domainname, const char *__msgid1,
+                              const char *__msgid2, unsigned long int __n)
+{
+  return libintl_dngettext (__domainname, __msgid1, __msgid2, __n);
+}
+#else
+#ifdef _INTL_REDIRECT_MACROS
+# define dngettext libintl_dngettext
+#endif
+extern char *dngettext (const char *__domainname,
+                       const char *__msgid1, const char *__msgid2,
+                       unsigned long int __n)
+       _INTL_ASM (libintl_dngettext);
+#endif
+
+/* Similar to `dcgettext' but select the plural form corresponding to the
+   number N.  */
+#ifdef _INTL_REDIRECT_INLINE
+extern char *libintl_dcngettext (const char *__domainname,
+                                const char *__msgid1, const char *__msgid2,
+                                unsigned long int __n, int __category);
+static inline char *dcngettext (const char *__domainname,
+                               const char *__msgid1, const char *__msgid2,
+                               unsigned long int __n, int __category)
+{
+  return libintl_dcngettext (__domainname, __msgid1, __msgid2, __n, __category);
+}
+#else
+#ifdef _INTL_REDIRECT_MACROS
+# define dcngettext libintl_dcngettext
+#endif
+extern char *dcngettext (const char *__domainname,
+                        const char *__msgid1, const char *__msgid2,
+                        unsigned long int __n, int __category)
+       _INTL_ASM (libintl_dcngettext);
+#endif
+
+
+/* Set the current default message catalog to DOMAINNAME.
+   If DOMAINNAME is null, return the current default.
+   If DOMAINNAME is "", reset to the default of "messages".  */
+#ifdef _INTL_REDIRECT_INLINE
+extern char *libintl_textdomain (const char *__domainname);
+static inline char *textdomain (const char *__domainname)
+{
+  return libintl_textdomain (__domainname);
+}
+#else
+#ifdef _INTL_REDIRECT_MACROS
+# define textdomain libintl_textdomain
+#endif
+extern char *textdomain (const char *__domainname)
+       _INTL_ASM (libintl_textdomain);
+#endif
+
+/* Specify that the DOMAINNAME message catalog will be found
+   in DIRNAME rather than in the system locale data base.  */
+#ifdef _INTL_REDIRECT_INLINE
+extern char *libintl_bindtextdomain (const char *__domainname,
+                                    const char *__dirname);
+static inline char *bindtextdomain (const char *__domainname,
+                                   const char *__dirname)
+{
+  return libintl_bindtextdomain (__domainname, __dirname);
+}
+#else
+#ifdef _INTL_REDIRECT_MACROS
+# define bindtextdomain libintl_bindtextdomain
+#endif
+extern char *bindtextdomain (const char *__domainname, const char *__dirname)
+       _INTL_ASM (libintl_bindtextdomain);
+#endif
+
+/* Specify the character encoding in which the messages from the
+   DOMAINNAME message catalog will be returned.  */
+#ifdef _INTL_REDIRECT_INLINE
+extern char *libintl_bind_textdomain_codeset (const char *__domainname,
+                                             const char *__codeset);
+static inline char *bind_textdomain_codeset (const char *__domainname,
+                                            const char *__codeset)
+{
+  return libintl_bind_textdomain_codeset (__domainname, __codeset);
+}
+#else
+#ifdef _INTL_REDIRECT_MACROS
+# define bind_textdomain_codeset libintl_bind_textdomain_codeset
+#endif
+extern char *bind_textdomain_codeset (const char *__domainname,
+                                     const char *__codeset)
+       _INTL_ASM (libintl_bind_textdomain_codeset);
+#endif
+
+
+/* Support for format strings with positions in *printf(), following the
+   POSIX/XSI specification.
+   Note: These replacements for the *printf() functions are visible only
+   in source files that #include <libintl.h> or #include "gettext.h".
+   Packages that use *printf() in source files that don't refer to _()
+   or gettext() but for which the format string could be the return value
+   of _() or gettext() need to add this #include.  Oh well.  */
+
+#if !HAVE_POSIX_PRINTF
+
+#include <stdio.h>
+#include <stddef.h>
+
+/* Get va_list.  */
+#if __STDC__ || defined __cplusplus || defined _MSC_VER
+# include <stdarg.h>
+#else
+# include <varargs.h>
+#endif
+
+#undef fprintf
+#define fprintf libintl_fprintf
+extern int fprintf (FILE *, const char *, ...);
+#undef vfprintf
+#define vfprintf libintl_vfprintf
+extern int vfprintf (FILE *, const char *, va_list);
+
+#undef printf
+#define printf libintl_printf
+extern int printf (const char *, ...);
+#undef vprintf
+#define vprintf libintl_vprintf
+extern int vprintf (const char *, va_list);
+
+#undef sprintf
+#define sprintf libintl_sprintf
+extern int sprintf (char *, const char *, ...);
+#undef vsprintf
+#define vsprintf libintl_vsprintf
+extern int vsprintf (char *, const char *, va_list);
+
+#if HAVE_SNPRINTF
+
+#undef snprintf
+#define snprintf libintl_snprintf
+extern int snprintf (char *, size_t, const char *, ...);
+#undef vsnprintf
+#define vsnprintf libintl_vsnprintf
+extern int vsnprintf (char *, size_t, const char *, va_list);
+
+#endif
+
+#if HAVE_ASPRINTF
+
+#undef asprintf
+#define asprintf libintl_asprintf
+extern int asprintf (char **, const char *, ...);
+#undef vasprintf
+#define vasprintf libintl_vasprintf
+extern int vasprintf (char **, const char *, va_list);
+
+#endif
+
+#if HAVE_WPRINTF
+
+#undef fwprintf
+#define fwprintf libintl_fwprintf
+extern int fwprintf (FILE *, const wchar_t *, ...);
+#undef vfwprintf
+#define vfwprintf libintl_vfwprintf
+extern int vfwprintf (FILE *, const wchar_t *, va_list);
+
+#undef wprintf
+#define wprintf libintl_wprintf
+extern int wprintf (const wchar_t *, ...);
+#undef vwprintf
+#define vwprintf libintl_vwprintf
+extern int vwprintf (const wchar_t *, va_list);
+
+#undef swprintf
+#define swprintf libintl_swprintf
+extern int swprintf (wchar_t *, size_t, const wchar_t *, ...);
+#undef vswprintf
+#define vswprintf libintl_vswprintf
+extern int vswprintf (wchar_t *, size_t, const wchar_t *, va_list);
+
+#endif
+
+#endif
+
+
+/* Support for relocatable packages.  */
+
+/* Sets the original and the current installation prefix of the package.
+   Relocation simply replaces a pathname starting with the original prefix
+   by the corresponding pathname with the current prefix instead.  Both
+   prefixes should be directory names without trailing slash (i.e. use ""
+   instead of "/").  */
+#define libintl_set_relocation_prefix libintl_set_relocation_prefix
+extern void
+       libintl_set_relocation_prefix (const char *orig_prefix,
+                                     const char *curr_prefix);
+
+
+#ifdef __cplusplus
+}
+#endif
+    
+#endif /* libintl.h */
diff --git a/development/cmake/modules/FindASPELL.cmake b/development/cmake/modules/FindASPELL.cmake
new file mode 100755 (executable)
index 0000000..f67dec8
--- /dev/null
@@ -0,0 +1,44 @@
+# - Try to find ASPELL
+# Once done this will define
+#
+#  ASPELL_FOUND - system has ASPELL
+#  ASPELL_INCLUDE_DIR - the ASPELL include directory
+#  ASPELL_LIBRARIES - The libraries needed to use ASPELL
+#  ASPELL_DEFINITIONS - Compiler switches required for using ASPELL
+#
+
+if (ASPELL_INCLUDE_DIR AND ASPELL_LIBRARIES)
+  # Already in cache, be silent
+  set(ASPELL_FIND_QUIETLY TRUE)
+endif (ASPELL_INCLUDE_DIR AND ASPELL_LIBRARIES)
+
+FIND_PATH(ASPELL_INCLUDE_DIR aspell.h
+  /usr/include
+  /usr/local/include
+  /usr/local/include/aspell
+)
+
+FIND_LIBRARY(ASPELL_LIBRARIES NAMES aspell aspell-15 libaspell
+  PATHS
+  /usr/lib
+  /usr/local/lib
+)
+
+
+if (ASPELL_INCLUDE_DIR AND ASPELL_LIBRARIES)
+   set(ASPELL_FOUND TRUE)
+endif (ASPELL_INCLUDE_DIR AND ASPELL_LIBRARIES)
+
+if (ASPELL_FOUND)
+  if (NOT ASPELL_FIND_QUIETLY)
+    message(STATUS "Found ASPELL: ${ASPELL_LIBRARIES}")
+  endif (NOT ASPELL_FIND_QUIETLY)
+else (ASPELL_FOUND)
+  if (ASPELL_FIND_REQUIRED)
+    message("aspell header: ${ASPELL_INCLUDE_DIR}")
+    message("aspell lib   : ${ASPELL_LIBRARIES}")
+    message(FATAL_ERROR "Could NOT find ASPELL")
+  endif (ASPELL_FIND_REQUIRED)
+endif (ASPELL_FOUND)
+
+MARK_AS_ADVANCED(ASPELL_INCLUDE_DIR ASPELL_LIBRARIES)
diff --git a/development/cmake/modules/FindGNUWIN32.cmake b/development/cmake/modules/FindGNUWIN32.cmake
new file mode 100755 (executable)
index 0000000..8b1b15a
--- /dev/null
@@ -0,0 +1,32 @@
+if (WIN32)
+
+file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _progFiles)
+
+find_file(GNUWIN32_DIR gnuwin32
+   ${_progFiles}
+   "C:/"
+)
+
+if (GNUWIN32_DIR)
+   set(GNUWIN32_INCLUDE_DIR ${GNUWIN32_DIR}/include)
+   set(GNUWIN32_LIBRARY_DIR ${GNUWIN32_DIR}/lib)
+   set(GNUWIN32_BINARY_DIR  ${GNUWIN32_DIR}/bin)
+   set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} ${GNUWIN32_INCLUDE_DIR})
+   set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ${GNUWIN32_LIBRARY_DIR})
+   set(GNUWIN32_FOUND TRUE)
+else (GNUWIN32_DIR)
+   set(GNUWIN32_FOUND)
+endif (GNUWIN32_DIR)
+
+if (GNUWIN32_FOUND)
+  if (NOT GNUWIN32_FIND_QUIETLY)
+    message(STATUS "Found GNUWIN32: ${GNUWIN32_DIR}")
+  endif (NOT GNUWIN32_FIND_QUIETLY)
+else (GNUWIN32_FOUND)
+  if (GNUWIN32_FIND_REQUIRED)
+    message(SEND_ERROR "Could NOT find GNUWIN32")
+  endif (GNUWIN32_FIND_REQUIRED)
+endif (GNUWIN32_FOUND)
+
+endif (WIN32)
+
diff --git a/development/cmake/modules/FindICONV.cmake b/development/cmake/modules/FindICONV.cmake
new file mode 100755 (executable)
index 0000000..b602904
--- /dev/null
@@ -0,0 +1,56 @@
+\r
+if (ICONV_INCLUDE_DIR)\r
+  # Already in cache, be silent\r
+  set(ICONV_FIND_QUIETLY TRUE)\r
+endif (ICONV_INCLUDE_DIR)\r
+\r
+FIND_PATH(ICONV_INCLUDE_DIR iconv.h\r
+ /usr/include\r
+ /usr/local/include\r
+)\r
+\r
+set(POTENTIAL_ICONV_LIBS iconv libiconv)\r
+FIND_LIBRARY(ICONV_LIBRARY NAMES ${POTENTIAL_ICONV_LIBS}\r
+PATHS\r
+ /usr/lib\r
+ /usr/local/lib\r
+)\r
+\r
+if(WIN32)\r
+       FIND_FILE(ICONV_DLL iconv.dll NO_DEFAULT_PATH ENV PATH)\r
+       FIND_FILE(ICONV_DLL_HELP iconv.dll)\r
+       IF(ICONV_FIND_REQUIRED)\r
+               IF(NOT ICONV_DLL AND NOT ICONV_DLL_HELP)\r
+                       MESSAGE(FATAL_ERROR "Could not find iconv.dll, please add correct your PATH environment variable")\r
+               ENDIF(NOT ICONV_DLL AND NOT ICONV_DLL_HELP)\r
+               IF(NOT ICONV_DLL AND ICONV_DLL_HELP)\r
+                       GET_FILENAME_COMPONENT(ICONV_DLL_HELP ${ICONV_DLL_HELP} PATH)\r
+                       MESSAGE("Could not find iconv.dll in standard search path, please add ")\r
+                       MESSAGE("${ICONV_DLL_HELP}  to your PATH environment variable.")\r
+                       MESSAGE(FATAL_ERROR)\r
+               ENDIF(NOT ICONV_DLL AND ICONV_DLL_HELP)\r
+       ENDIF(ICONV_FIND_REQUIRED)\r
+ELSE(WIN32)\r
+       set(ICONV_DLL TRUE)\r
+endif(WIN32)\r
+\r
+\r
+IF (ICONV_INCLUDE_DIR AND ICONV_LIBRARY AND ICONV_DLL)\r
+   SET(ICONV_FOUND TRUE)\r
+ENDIF (ICONV_INCLUDE_DIR AND ICONV_LIBRARY AND ICONV_DLL)\r
+\r
+IF (ICONV_FOUND)\r
+   IF (NOT ICONV_FIND_QUIETLY)\r
+      MESSAGE(STATUS "Found iconv: ${ICONV_LIBRARY}")\r
+   ENDIF (NOT ICONV_FIND_QUIETLY)\r
+ELSE (ICONV_FOUND)\r
+   IF (ICONV_FIND_REQUIRED)\r
+      MESSAGE(STATUS "Looked for iconv library named ${POTENTIAL_ICONV_LIBS}.")\r
+      MESSAGE(STATUS "Found no acceptable iconv library. This is fatal.")\r
+      message("iconv header: ${ICONV_INCLUDE_DIR}")\r
+      message("iconv lib   : ${ICONV_LIBRARY}")\r
+      MESSAGE(FATAL_ERROR "Could NOT find iconv library")\r
+   ENDIF (ICONV_FIND_REQUIRED)\r
+ENDIF (ICONV_FOUND)\r
+\r
+MARK_AS_ADVANCED(ICONV_LIBRARY ICONV_INCLUDE_DIR)\r
diff --git a/development/cmake/modules/FindQt4.cmake b/development/cmake/modules/FindQt4.cmake
new file mode 100755 (executable)
index 0000000..659faf1
--- /dev/null
@@ -0,0 +1,899 @@
+# - 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
+#
+# 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 ... )
+#  macro QT4_WRAP_UI(outfiles inputfile ... )
+#  macro QT4_ADD_RESOURCE(outfiles inputfile ... )
+#  macro QT4_AUTOMOC(inputfile ... )
+#  macro QT4_GENERATE_MOC(inputfile outputfile )
+#
+#  QT_FOUND         If false, don't try to use Qt.
+#  QT4_FOUND        If false, don't try to use Qt 4.
+#
+#  QT_QTCORE_FOUND        True if QtCore was found.
+#  QT_QTGUI_FOUND         True if QtGui was found.
+#  QT_QT3SUPPORT_FOUND    True if Qt3Support was found.
+#  QT_QTASSISTANT_FOUND   True if QtAssistant was found.
+#  QT_QTDESIGNER_FOUND    True if QtDesigner was found.
+#  QT_QTMOTIF_FOUND       True if QtMotif was found.
+#  QT_QTNETWORK_FOUND     True if QtNetwork was found.
+#  QT_QTNSPLUGIN_FOUND    True if QtNsPlugin was found.
+#  QT_QTOPENGL_FOUND      True if QtOpenGL was found.
+#  QT_QTSQL_FOUND         True if QtSql was found.
+#  QT_QTXML_FOUND         True if QtXml was found.
+#  QT_QTSVG_FOUND         True if QtSvg was found.
+#  QT_QTTEST_FOUND        True if QtTest was found.
+#
+#  QT_DEFINITIONS   Definitions to use when compiling code that uses Qt.
+#
+#  QT_INCLUDES      List of paths to all include directories of
+#                   Qt4 QT_INCLUDE_DIR and QT_QTCORE_INCLUDE_DIR are
+#                   always in this variable even if NOTFOUND,
+#                   all other INCLUDE_DIRS are
+#                   only added if they are found.
+#
+#  QT_INCLUDE_DIR              Path to "include" of Qt4
+#  QT_QT_INCLUDE_DIR           Path to "include/Qt"
+#  QT_QT3SUPPORT_INCLUDE_DIR   Path to "include/Qt3Support"
+#  QT_QTASSISTANT_INCLUDE_DIR  Path to "include/QtAssistant"
+#  QT_QTCORE_INCLUDE_DIR       Path to "include/QtCore"
+#  QT_QTDESIGNER_INCLUDE_DIR   Path to "include/QtDesigner"
+#  QT_QTGUI_INCLUDE_DIR        Path to "include/QtGui"
+#  QT_QTMOTIF_INCLUDE_DIR      Path to "include/QtMotif"
+#  QT_QTNETWORK_INCLUDE_DIR    Path to "include/QtNetwork"
+#  QT_QTNSPLUGIN_INCLUDE_DIR   Path to "include/QtNsPlugin"
+#  QT_QTOPENGL_INCLUDE_DIR     Path to "include/QtOpenGL"
+#  QT_QTSQL_INCLUDE_DIR        Path to "include/QtSql"
+#  QT_QTXML_INCLUDE_DIR        Path to "include/QtXml"
+#  QT_QTSVG_INCLUDE_DIR        Path to "include/QtSvg"
+#  QT_QTTEST_INCLUDE_DIR       Path to "include/QtTest"
+#
+#  QT_LIBRARY_DIR              Path to "lib" of Qt4
+#
+# For every library of Qt there are three variables:
+#  QT_QTFOO_LIBRARY_RELEASE, which contains the full path to the release version
+#  QT_QTFOO_LIBRARY_DEBUG, which contains the full path to the debug version
+#  QT_QTFOO_LIBRARY, the full path to the release version if available, otherwise to the debug version
+#
+# So there are the following variables:
+# The Qt3Support library:     QT_QT3SUPPORT_LIBRARY
+#                             QT_QT3SUPPORT_LIBRARY_RELEASE
+#                             QT_QT3SUPPORT_DEBUG
+#
+# The QtAssistant library:    QT_QTASSISTANT_LIBRARY
+#                             QT_QTASSISTANT_LIBRARY_RELEASE
+#                             QT_QTASSISTANT_LIBRARY_DEBUG
+#
+# The QtCore library:         QT_QTCORE_LIBRARY
+#                             QT_QTCORE_LIBRARY_RELEASE
+#                             QT_QTCORE_LIBRARY_DEBUG
+#
+# The QtDesigner library:     QT_QTDESIGNER_LIBRARY
+#                             QT_QTDESIGNER_LIBRARY_RELEASE
+#                             QT_QTDESIGNER_LIBRARY_DEBUG
+#
+# The QtGui library:          QT_QTGUI_LIBRARY
+#                             QT_QTGUI_LIBRARY_RELEASE
+#                             QT_QTGUI_LIBRARY_DEBUG
+#
+# The QtMotif library:        QT_QTMOTIF_LIBRARY
+#                             QT_QTMOTIF_LIBRARY_RELEASE
+#                             QT_QTMOTIF_LIBRARY_DEBUG
+#
+# The QtNetwork library:      QT_QTNETWORK_LIBRARY
+#                             QT_QTNETWORK_LIBRARY_RELEASE
+#                             QT_QTNETWORK_LIBRARY_DEBUG
+#
+# The QtNsPLugin library:     QT_QTNSPLUGIN_LIBRARY
+#                             QT_QTNSPLUGIN_LIBRARY_RELEASE
+#                             QT_QTNSPLUGIN_LIBRARY_DEBUG
+#
+# The QtOpenGL library:       QT_QTOPENGL_LIBRARY
+#                             QT_QTOPENGL_LIBRARY_RELEASE
+#                             QT_QTOPENGL_LIBRARY_DEBUG
+#
+# The QtSql library:          QT_QTSQL_LIBRARY
+#                             QT_QTSQL_LIBRARY_RELEASE
+#                             QT_QTSQL_LIBRARY_DEBUG
+#
+# The QtXml library:          QT_QTXML_LIBRARY
+#                             QT_QTXML_LIBRARY_RELEASE
+#                             QT_QTXML_LIBRARY_DEBUG
+#
+# The QtSvg library:          QT_QTSVG_LIBRARY
+#                             QT_QTSVG_LIBRARY_RELEASE
+#                             QT_QTSVG_LIBRARY_DEBUG
+#
+# The QtTest library:         QT_QTTEST_LIBRARY
+#                             QT_QTTEST_LIBRARY_RELEASE
+#                             QT_QTTEST_LIBRARY_DEBUG
+#
+# The qtmain library for Windows QT_QTMAIN_LIBRARY
+#                             QT_QTMAIN_LIBRARY_RELEASE
+#                             QT_QTMAIN_LIBRARY_DEBUG
+#
+#The QtUiTools library:       QT_QTUITOOLS_LIBRARY
+#                             QT_QTUITOOLS_LIBRARY_RELEASE
+#                             QT_QTUITOOLS_LIBRARY_DEBUG
+#
+# also defined, but NOT for general use are
+#  QT_MOC_EXECUTABLE          Where to find the moc tool.
+#  QT_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_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 QT_MOC_EXECUTABLE is found
+#  QT_WRAP_UI   Set true if QT_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)
+#  QT_QT_LIBRARY        Qt-Library is now split
+
+INCLUDE(CheckSymbolExists)
+INCLUDE(MacroAddFileDependencies)
+
+SET(QT_USE_FILE ${CMAKE_ROOT}/Modules/UseQt4.cmake)
+
+SET( QT_DEFINITIONS "")
+
+IF (WIN32)
+  SET(QT_DEFINITIONS -DQT_DLL)
+ENDIF(WIN32)
+
+# check for qmake
+FIND_PROGRAM(QT_QMAKE_EXECUTABLE NAMES qmake 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
+)
+
+SET(QT4_INSTALLED_VERSION_TOO_OLD FALSE)
+
+
+IF (QT_QMAKE_EXECUTABLE)
+
+   SET(QT4_QMAKE_FOUND FALSE)
+   
+   EXEC_PROGRAM(${QT_QMAKE_EXECUTABLE} ARGS "-query QT_VERSION" OUTPUT_VARIABLE QTVERSION)
+
+   # 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 QT_MIN_VERSION)
+         SET(QT_MIN_VERSION "4.0.0")
+      ENDIF (NOT QT_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 "${QT_MIN_VERSION}")
+      IF (NOT req_qt_major_vers)
+         MESSAGE( FATAL_ERROR "Invalid Qt version string given: \"${QT_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 "${QT_MIN_VERSION}")
+      STRING(REGEX REPLACE "^[0-9]+\\.([0-9])+\\.[0-9]+" "\\1" req_qt_minor_vers "${QT_MIN_VERSION}")
+      STRING(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" req_qt_patch_vers "${QT_MIN_VERSION}")
+   
+      IF (NOT req_qt_major_vers EQUAL 4)
+         MESSAGE( FATAL_ERROR "Invalid Qt version string given: \"${QT_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)
+
+  # ask qmake for the library dir
+  # Set QT_LIBRARY_DIR
+  IF (NOT QT_LIBRARY_DIR)
+    EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE}
+       ARGS "-query QT_INSTALL_LIBS"
+       OUTPUT_VARIABLE QT_LIBRARY_DIR_TMP )
+    IF(EXISTS "${QT_LIBRARY_DIR_TMP}")
+       SET(QT_LIBRARY_DIR ${QT_LIBRARY_DIR_TMP} CACHE PATH "Qt library dir")
+    ELSE(EXISTS "${QT_LIBRARY_DIR_TMP}")
+       MESSAGE("Warning: QT_QMAKE_EXECUTABLE reported QT_INSTALL_LIBS as ${QT_LIBRARY_DIR_TMP}")
+       MESSAGE("Warning: ${QT_LIBRARY_DIR_TMP} does NOT exist, Qt must NOT be installed correctly.")
+    ENDIF(EXISTS "${QT_LIBRARY_DIR_TMP}")
+  ENDIF(NOT QT_LIBRARY_DIR)
+
+  IF (APPLE)
+    IF (EXISTS ${QT_LIBRARY_DIR}/QtCore.framework)
+      SET(QT_USE_FRAMEWORKS ON
+         CACHE BOOL "Set to ON if Qt build uses frameworks.")
+    ELSE (EXISTS ${QT_LIBRARY_DIR}/QtCore.framework)
+       SET(QT_USE_FRAMEWORKS OFF
+         CACHE BOOL "Set to ON if Qt build uses frameworks.")
+    ENDIF (EXISTS ${QT_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_dir )
+    SET(QT_MKSPECS_DIR ${qt_mkspecs_dir} CACHE PATH "The location of the Qt mkspecs")
+  ENDIF (NOT QT_MKSPECS_DIR)
+
+  ########################################
+  #
+  #       Setting the INCLUDE-Variables
+  #
+  ########################################
+
+  FIND_PATH(QT_QTCORE_INCLUDE_DIR QtGlobal
+    "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\4.0.0;InstallDir]/include/QtCore"
+    ${QT_HEADERS_DIR}/QtCore
+    ${QT_LIBRARY_DIR}/QtCore.framework/Headers
+    $ENV{QTDIR}/include/QtCore
+   "$ENV{ProgramFiles}/qt/include/Qt"
+   )
+
+  # Set QT_INCLUDE_DIR by removine "/QtCore" in the string ${QT_QTCORE_INCLUDE_DIR}
+  IF( QT_QTCORE_INCLUDE_DIR AND NOT QT_INCLUDE_DIR)
+    IF (QT_USE_FRAMEWORKS)
+      SET(QT_INCLUDE_DIR ${QT_HEADERS_DIR})
+    ELSE (QT_USE_FRAMEWORKS)
+      STRING( REGEX REPLACE "/QtCore$" "" qt4_include_dir ${QT_QTCORE_INCLUDE_DIR})
+      SET( QT_INCLUDE_DIR ${qt4_include_dir} CACHE PATH "")
+    ENDIF (QT_USE_FRAMEWORKS)
+  ENDIF( QT_QTCORE_INCLUDE_DIR AND NOT QT_INCLUDE_DIR)
+
+  IF( NOT QT_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 QT_INCLUDE_DIR)
+
+  #############################################
+  #
+  # Find out what window system we're using
+  #
+  #############################################
+  # Save required includes variable
+  SET(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES})
+  # Add QT_INCLUDE_DIR to CMAKE_REQUIRED_INCLUDES
+  SET(CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES};${QT_INCLUDE_DIR}")
+  # 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_MAC "QtCore/qglobal.h" Q_WS_MAC)
+  CHECK_SYMBOL_EXISTS(Q_WS_WIN "QtCore/qglobal.h" Q_WS_WIN)
+
+  IF (QT_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 (QT_QTCOPY_REQUIRED)
+
+  # Restore CMAKE_REQUIRED_INCLUDES variable
+  SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE})
+  #
+  #############################################
+
+  IF (QT_USE_FRAMEWORKS)
+    SET(QT_DEFINITIONS ${QT_DEFINITIONS} -F${QT_LIBRARY_DIR} -L${QT_LIBRARY_DIR} )
+  ENDIF (QT_USE_FRAMEWORKS)
+
+  # Set QT_QT3SUPPORT_INCLUDE_DIR
+  FIND_PATH(QT_QT3SUPPORT_INCLUDE_DIR Qt3Support
+    PATHS
+    ${QT_INCLUDE_DIR}/Qt3Support
+    ${QT_LIBRARY_DIR}/Qt3Support.framework/Headers
+    NO_DEFAULT_PATH
+    )
+
+  # Set QT_QT_INCLUDE_DIR
+  FIND_PATH(QT_QT_INCLUDE_DIR qglobal.h
+    PATHS
+    ${QT_INCLUDE_DIR}/Qt
+    ${QT_LIBRARY_DIR}/QtCore.framework/Headers
+    NO_DEFAULT_PATH
+    )
+
+  # Set QT_QTGUI_INCLUDE_DIR
+  FIND_PATH(QT_QTGUI_INCLUDE_DIR QtGui
+    PATHS
+    ${QT_INCLUDE_DIR}/QtGui
+    ${QT_LIBRARY_DIR}/QtGui.framework/Headers
+    NO_DEFAULT_PATH
+    )
+
+  # Set QT_QTSVG_INCLUDE_DIR
+  FIND_PATH(QT_QTSVG_INCLUDE_DIR QtSvg
+    PATHS
+    ${QT_INCLUDE_DIR}/QtSvg
+    ${QT_LIBRARY_DIR}/QtSvg.framework/Headers
+    NO_DEFAULT_PATH
+    )
+
+  # Set QT_QTTEST_INCLUDE_DIR
+  FIND_PATH(QT_QTTEST_INCLUDE_DIR QtTest
+    PATHS
+    ${QT_INCLUDE_DIR}/QtTest
+    ${QT_LIBRARY_DIR}/QtTest.framework/Headers
+    NO_DEFAULT_PATH
+    )
+
+  # Set QT_QTUITOOLS_INCLUDE_DIR
+  FIND_PATH(QT_QTUITOOLS_INCLUDE_DIR QtTest
+    PATHS
+    ${QT_INCLUDE_DIR}/QtUiTools
+    ${QT_LIBRARY_DIR}/QtUiTools.framework/Headers
+    NO_DEFAULT_PATH
+    )
+
+
+
+  # Set QT_QTMOTIF_INCLUDE_DIR
+  IF(Q_WS_X11)
+    FIND_PATH(QT_QTMOTIF_INCLUDE_DIR QtMotif PATHS ${QT_INCLUDE_DIR}/QtMotif NO_DEFAULT_PATH )
+  ENDIF(Q_WS_X11)
+
+  # Set QT_QTNETWORK_INCLUDE_DIR
+  FIND_PATH(QT_QTNETWORK_INCLUDE_DIR QtNetwork
+    PATHS
+    ${QT_INCLUDE_DIR}/QtNetwork
+    ${QT_LIBRARY_DIR}/QtNetwork.framework/Headers
+    NO_DEFAULT_PATH
+    )
+
+  # Set QT_QTNSPLUGIN_INCLUDE_DIR
+  FIND_PATH(QT_QTNSPLUGIN_INCLUDE_DIR QtNsPlugin
+    PATHS
+    ${QT_INCLUDE_DIR}/QtNsPlugin
+    ${QT_LIBRARY_DIR}/QtNsPlugin.framework/Headers
+    NO_DEFAULT_PATH
+    )
+
+  # Set QT_QTOPENGL_INCLUDE_DIR
+  FIND_PATH(QT_QTOPENGL_INCLUDE_DIR QtOpenGL
+    PATHS
+    ${QT_INCLUDE_DIR}/QtOpenGL
+    ${QT_LIBRARY_DIR}/QtOpenGL.framework/Headers
+    NO_DEFAULT_PATH
+    )
+
+  # Set QT_QTSQL_INCLUDE_DIR
+  FIND_PATH(QT_QTSQL_INCLUDE_DIR QtSql
+    PATHS
+    ${QT_INCLUDE_DIR}/QtSql
+    ${QT_LIBRARY_DIR}/QtSql.framework/Headers
+    NO_DEFAULT_PATH
+    )
+
+  # Set QT_QTXML_INCLUDE_DIR
+  FIND_PATH(QT_QTXML_INCLUDE_DIR QtXml
+    PATHS
+    ${QT_INCLUDE_DIR}/QtXml
+    ${QT_LIBRARY_DIR}/QtXml.framework/Headers
+    NO_DEFAULT_PATH
+    )
+
+  # Set QT_QTASSISTANT_INCLUDE_DIR
+  FIND_PATH(QT_QTASSISTANT_INCLUDE_DIR QtAssistant
+    PATHS
+    ${QT_INCLUDE_DIR}/QtAssistant
+    ${QT_HEADERS_DIR}/QtAssistant
+    NO_DEFAULT_PATH
+    )
+
+  # Set QT_QTDESIGNER_INCLUDE_DIR
+  FIND_PATH(QT_QTDESIGNER_INCLUDE_DIR QDesignerComponents
+    PATHS
+    ${QT_INCLUDE_DIR}/QtDesigner
+    ${QT_HEADERS_DIR}/QtDesigner
+    NO_DEFAULT_PATH
+    )
+
+  # Make variables changeble to the advanced user
+  MARK_AS_ADVANCED( QT_LIBRARY_DIR QT_INCLUDE_DIR QT_QT_INCLUDE_DIR QT_DOC_DIR)
+
+  # Set QT_INCLUDES
+  SET( QT_INCLUDES ${QT_INCLUDE_DIR} ${QT_QT_INCLUDE_DIR} ${QT_MKSPECS_DIR}/default )
+
+
+  ########################################
+  #
+  #       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.
+    SET(QT_QTCORE_LIBRARY_RELEASE "-F${QT_LIBRARY_DIR} -framework QtCore" CACHE STRING "The QtCore library.")
+    SET(QT_QTCORE_LIBRARY_DEBUG   "-F${QT_LIBRARY_DIR} -framework QtCore" CACHE STRING "The QtCore library.")
+    SET(QT_QT3SUPPORT_LIBRARY_RELEASE "-framework Qt3Support" CACHE STRING "The Qt3Support library.")
+    SET(QT_QT3SUPPORT_LIBRARY_DEBUG   "-framework Qt3Support" CACHE STRING "The Qt3Support library.")
+    SET(QT_QTGUI_LIBRARY_RELEASE      "-framework QtGui"      CACHE STRING "The QtGui library.")
+    SET(QT_QTGUI_LIBRARY_DEBUG        "-framework QtGui"      CACHE STRING "The QtGui library.")
+    SET(QT_QTNETWORK_LIBRARY_RELEASE  "-framework QtNetwork"  CACHE STRING "The QtNetwork library.")
+    SET(QT_QTNETWORK_LIBRARY_DEBUG    "-framework QtNetwork"  CACHE STRING "The QtNetwork library.")
+    SET(QT_QTOPENGL_LIBRARY_RELEASE   "-framework QtOpenGL"   CACHE STRING "The QtOpenGL library.")
+    SET(QT_QTOPENGL_LIBRARY_DEBUG     "-framework QtOpenGL"   CACHE STRING "The QtOpenGL library.")
+    SET(QT_QTSQL_LIBRARY_RELEASE      "-framework QtSql"      CACHE STRING "The QtSql library.")
+    SET(QT_QTSQL_LIBRARY_DEBUG        "-framework QtSql"      CACHE STRING "The QtSql library.")
+    SET(QT_QTXML_LIBRARY_RELEASE      "-framework QtXml"      CACHE STRING "The QtXml library.")
+    SET(QT_QTXML_LIBRARY_DEBUG        "-framework QtXml"      CACHE STRING "The QtXml library.")
+    SET(QT_QTSVG_LIBRARY_RELEASE      "-framework QtSvg"      CACHE STRING "The QtSvg library.")
+    SET(QT_QTSVG_LIBRARY_DEBUG        "-framework QtSvg"      CACHE STRING "The QtSvg library.")
+    SET(QT_QTUITOOLS_LIBRARY_RELEASE      "-framework QtUiTools"      CACHE STRING "The QtUiTools library.")
+    SET(QT_QTUITOOLS_LIBRARY_DEBUG        "-framework QtUiTools"      CACHE STRING "The QtUiTools library.")
+
+
+    # WTF?  why don't we have frameworks?  :P
+    SET(QT_QTTEST_LIBRARY_RELEASE "-L${QT_LIBRARY_DIR} -lQtTest" CACHE STRING "The QtTest library.")
+    SET(QT_QTTEST_LIBRARY_DEBUG   "-L${QT_LIBRARY_DIR} -lQtTest_debug" CACHE STRING "The QtTest library.")
+    MARK_AS_ADVANCED(QT_QT3SUPPORT_LIBRARY QT_QTGUI_LIBRARY )
+
+  ELSE (QT_USE_FRAMEWORKS)
+
+    # Set QT_QTCORE_LIBRARY by searching for a lib with "QtCore."  as part of the filename
+    FIND_LIBRARY(QT_QTCORE_LIBRARY_RELEASE NAMES QtCore QtCore4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH )
+    FIND_LIBRARY(QT_QTCORE_LIBRARY_DEBUG NAMES QtCore_debug QtCored4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
+
+    # Set QT_QT3SUPPORT_LIBRARY
+    FIND_LIBRARY(QT_QT3SUPPORT_LIBRARY_RELEASE NAMES Qt3Support Qt3Support4 PATHS ${QT_LIBRARY_DIR}        NO_DEFAULT_PATH)
+    FIND_LIBRARY(QT_QT3SUPPORT_LIBRARY_DEBUG   NAMES Qt3Support_debug Qt3Supportd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
+
+    # Set QT_QTGUI_LIBRARY
+    FIND_LIBRARY(QT_QTGUI_LIBRARY_RELEASE NAMES QtGui QtGui4 PATHS ${QT_LIBRARY_DIR}        NO_DEFAULT_PATH)
+    FIND_LIBRARY(QT_QTGUI_LIBRARY_DEBUG   NAMES QtGui_debug QtGuid4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
+
+    # Set QT_QTMOTIF_LIBRARY
+    IF(Q_WS_X11)
+      FIND_LIBRARY(QT_QTMOTIF_LIBRARY_RELEASE NAMES QtMotif PATHS ${QT_LIBRARY_DIR}       NO_DEFAULT_PATH)
+      FIND_LIBRARY(QT_QTMOTIF_LIBRARY_DEBUG   NAMES QtMotif_debug PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
+    ENDIF(Q_WS_X11)
+
+    # Set QT_QTNETWORK_LIBRARY
+    FIND_LIBRARY(QT_QTNETWORK_LIBRARY_RELEASE NAMES QtNetwork QtNetwork4 PATHS ${QT_LIBRARY_DIR}        NO_DEFAULT_PATH)
+    FIND_LIBRARY(QT_QTNETWORK_LIBRARY_DEBUG   NAMES QtNetwork_debug QtNetworkd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
+
+    # Set QT_QTNSPLUGIN_LIBRARY
+    FIND_LIBRARY(QT_QTNSPLUGIN_LIBRARY_RELEASE NAMES QtNsPlugin PATHS ${QT_LIBRARY_DIR}       NO_DEFAULT_PATH)
+    FIND_LIBRARY(QT_QTNSPLUGIN_LIBRARY_DEBUG   NAMES QtNsPlugin_debug PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
+
+    # Set QT_QTOPENGL_LIBRARY
+    FIND_LIBRARY(QT_QTOPENGL_LIBRARY_RELEASE NAMES QtOpenGL QtOpenGL4 PATHS ${QT_LIBRARY_DIR}        NO_DEFAULT_PATH)
+    FIND_LIBRARY(QT_QTOPENGL_LIBRARY_DEBUG   NAMES QtOpenGL_debug QtOpenGLd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
+
+    # Set QT_QTSQL_LIBRARY
+    FIND_LIBRARY(QT_QTSQL_LIBRARY_RELEASE NAMES QtSql QtSql4 PATHS ${QT_LIBRARY_DIR}        NO_DEFAULT_PATH)
+    FIND_LIBRARY(QT_QTSQL_LIBRARY_DEBUG   NAMES QtSql_debug QtSqld4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
+
+    # Set QT_QTXML_LIBRARY
+    FIND_LIBRARY(QT_QTXML_LIBRARY_RELEASE NAMES QtXml QtXml4 PATHS ${QT_LIBRARY_DIR}        NO_DEFAULT_PATH)
+    FIND_LIBRARY(QT_QTXML_LIBRARY_DEBUG   NAMES QtXml_debug QtXmld4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
+
+    # Set QT_QTSVG_LIBRARY
+    FIND_LIBRARY(QT_QTSVG_LIBRARY_RELEASE NAMES QtSvg QtSvg4 PATHS ${QT_LIBRARY_DIR}        NO_DEFAULT_PATH)
+    FIND_LIBRARY(QT_QTSVG_LIBRARY_DEBUG   NAMES QtSvg_debug QtSvgd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
+
+    # Set QT_QTUITOOLS_LIBRARY
+    FIND_LIBRARY(QT_QTUITOOLS_LIBRARY_RELEASE NAMES QtUiTools QtUiTools4 PATHS ${QT_LIBRARY_DIR}        NO_DEFAULT_PATH)
+    FIND_LIBRARY(QT_QTUITOOLS_LIBRARY_DEBUG   NAMES QtUiTools_debug QtUiToolsd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
+
+    # Set QT_QTTEST_LIBRARY
+    FIND_LIBRARY(QT_QTTEST_LIBRARY_RELEASE NAMES QtTest QtTest4 PATHS ${QT_LIBRARY_DIR}                      NO_DEFAULT_PATH)
+    FIND_LIBRARY(QT_QTTEST_LIBRARY_DEBUG   NAMES QtTest_debug QtTest_debug4 QtTestd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
+
+    MARK_AS_ADVANCED(QT_QT3SUPPORT_LIBRARY QT_QTGUI_LIBRARY )
+
+  ENDIF (QT_USE_FRAMEWORKS)
+
+  IF( NOT QT_QTCORE_LIBRARY_DEBUG AND NOT QT_QTCORE_LIBRARY_RELEASE )
+    IF( NOT Qt4_FIND_QUIETLY AND Qt4_FIND_REQUIRED)
+      MESSAGE( FATAL_ERROR "Could NOT find QtCore. Check CMakeFiles/CMakeError.log for more details.")
+    ENDIF( NOT Qt4_FIND_QUIETLY AND Qt4_FIND_REQUIRED)
+  ENDIF( NOT QT_QTCORE_LIBRARY_DEBUG AND NOT QT_QTCORE_LIBRARY_RELEASE )
+
+  # Set QT_QTASSISTANT_LIBRARY
+  FIND_LIBRARY(QT_QTASSISTANT_LIBRARY_RELEASE NAMES QtAssistantClient QtAssistant QtAssistant4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
+  FIND_LIBRARY(QT_QTASSISTANT_LIBRARY_DEBUG   NAMES QtAssistantClientd QtAssistantClient_debug QtAssistant_debug QtAssistantd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
+
+  # Set QT_QTDESIGNER_LIBRARY
+  FIND_LIBRARY(QT_QTDESIGNER_LIBRARY_RELEASE NAMES QtDesigner QtDesigner4 PATHS ${QT_LIBRARY_DIR}        NO_DEFAULT_PATH)
+  FIND_LIBRARY(QT_QTDESIGNER_LIBRARY_DEBUG   NAMES QtDesigner_debug QtDesignerd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
+  
+  ############################################
+  #
+  # Check the existence of the libraries.
+  #
+  ############################################
+
+  MACRO (_QT4_ADJUST_LIB_VARS basename)
+    IF (QT_${basename}_INCLUDE_DIR)
+
+      # if only the release version was found, set the debug variable also to the release version
+      IF (QT_${basename}_LIBRARY_RELEASE AND NOT QT_${basename}_LIBRARY_DEBUG)
+        SET(QT_${basename}_LIBRARY_DEBUG ${QT_${basename}_LIBRARY_RELEASE})
+        SET(QT_${basename}_LIBRARY       ${QT_${basename}_LIBRARY_RELEASE})
+        SET(QT_${basename}_LIBRARIES     ${QT_${basename}_LIBRARY_RELEASE})
+      ENDIF (QT_${basename}_LIBRARY_RELEASE AND NOT QT_${basename}_LIBRARY_DEBUG)
+
+      # if only the debug version was found, set the release variable also to the debug version
+      IF (QT_${basename}_LIBRARY_DEBUG AND NOT QT_${basename}_LIBRARY_RELEASE)
+        SET(QT_${basename}_LIBRARY_RELEASE ${QT_${basename}_LIBRARY_DEBUG})
+        SET(QT_${basename}_LIBRARY         ${QT_${basename}_LIBRARY_DEBUG})
+        SET(QT_${basename}_LIBRARIES       ${QT_${basename}_LIBRARY_DEBUG})
+      ENDIF (QT_${basename}_LIBRARY_DEBUG AND NOT QT_${basename}_LIBRARY_RELEASE)
+
+      IF (QT_${basename}_LIBRARY_DEBUG AND QT_${basename}_LIBRARY_RELEASE)
+        IF(NOT MSVC)
+          SET(QT_${basename}_LIBRARY       ${QT_${basename}_LIBRARY_RELEASE})
+        ELSE(NOT MSVC)
+          SET(QT_${basename}_LIBRARY       optimized ${QT_${basename}_LIBRARY_RELEASE} debug ${QT_${basename}_LIBRARY_DEBUG})
+        ENDIF(NOT MSVC)
+        SET(QT_${basename}_LIBRARIES       optimized ${QT_${basename}_LIBRARY_RELEASE} debug ${QT_${basename}_LIBRARY_DEBUG})
+      ENDIF (QT_${basename}_LIBRARY_DEBUG AND QT_${basename}_LIBRARY_RELEASE)
+
+      SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY} CACHE FILEPATH "The Qt ${basename} library")
+
+      IF (QT_${basename}_LIBRARY)
+        SET(QT_${basename}_FOUND 1)
+      ENDIF (QT_${basename}_LIBRARY)
+
+      #add the include directory to QT_INCLUDES
+      SET(QT_INCLUDES ${QT_INCLUDES} "${QT_${basename}_INCLUDE_DIR}")
+    ENDIF (QT_${basename}_INCLUDE_DIR )
+
+    # Make variables changeble to the advanced user
+    MARK_AS_ADVANCED(QT_${basename}_LIBRARY QT_${basename}_LIBRARY_RELEASE QT_${basename}_LIBRARY_DEBUG QT_${basename}_INCLUDE_DIR)
+  ENDMACRO (_QT4_ADJUST_LIB_VARS)
+
+  IF(WIN32)
+     _QT4_ADJUST_LIB_VARS(QTMAIN)
+  ENDIF(WIN32)
+
+
+  _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)
+  IF(Q_WS_X11)
+    _QT4_ADJUST_LIB_VARS(QTMOTIF)
+  ENDIF(Q_WS_X11)
+  _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(QTUITOOLS)
+  _QT4_ADJUST_LIB_VARS(QTTEST)
+
+  #######################################
+  #
+  #       Check the executables of Qt
+  #          ( moc, uic, rcc )
+  #
+  #######################################
+
+
+   # find moc and uic using qmake
+   FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeTmpQmake/tmp.pro
+      "message("MOC <$$QMAKE_MOC>") 
+      message("UIC <$$QMAKE_UIC>") 
+   ")
+
+   EXECUTE_PROCESS(COMMAND ${QT_QMAKE_EXECUTABLE}
+      WORKING_DIRECTORY  ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeTmpQmake
+      OUTPUT_VARIABLE _moc_OUTPUT
+      ERROR_VARIABLE _moc_OUTPUT )
+
+   FILE(REMOVE_RECURSE "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeTmpQmake")
+
+   STRING(REGEX REPLACE ".*MOC<([^>]+).*" "\\1" QT_MOC_EXECUTABLE "${_moc_OUTPUT}" )
+   STRING(REGEX REPLACE ".*UIC<([^>]+).*" "\\1" QT_UIC_EXECUTABLE "${_moc_OUTPUT}" )
+
+   FILE(TO_CMAKE_PATH "${QT_MOC_EXECUTABLE}" QT_MOC_EXECUTABLE)
+   FILE(TO_CMAKE_PATH "${QT_UIC_EXECUTABLE}" QT_UIC_EXECUTABLE)
+
+   SET(QT_MOC_EXECUTABLE ${QT_MOC_EXECUTABLE} CACHE FILEPATH "The moc executable")
+   SET(QT_UIC_EXECUTABLE ${QT_UIC_EXECUTABLE} 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
+    )
+
+  IF (QT_MOC_EXECUTABLE)
+     SET(QT_WRAP_CPP "YES")
+  ENDIF (QT_MOC_EXECUTABLE)
+
+  IF (QT_UIC_EXECUTABLE)
+     SET(QT_WRAP_UI "YES")
+  ENDIF (QT_UIC_EXECUTABLE)
+
+
+
+  MARK_AS_ADVANCED( QT_UIC_EXECUTABLE QT_UIC3_EXECUTABLE QT_MOC_EXECUTABLE QT_RCC_EXECUTABLE )
+
+  ######################################
+  #
+  #       Macros for building Qt files
+  #
+  ######################################
+
+  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(infile ${infile} ABSOLUTE)
+
+     ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
+        COMMAND ${QT_MOC_EXECUTABLE}
+        ARGS ${moc_includes} -o ${outfile} ${infile}
+        DEPENDS ${infile})
+
+     MACRO_ADD_FILE_DEPENDENCIES(${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)
+
+    FOREACH (it ${ARGN})
+      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 ${QT_MOC_EXECUTABLE}
+        ARGS ${moc_includes} -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 )
+
+    FOREACH (it ${ARGN})
+      GET_FILENAME_COMPONENT(outfile ${it} NAME_WE)
+      SET(infile ${CMAKE_CURRENT_SOURCE_DIR}/${it})
+      SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/ui_${outfile}.h)
+      ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
+        COMMAND ${QT_UIC_EXECUTABLE}
+        ARGS -o ${outfile} ${infile}
+        MAIN_DEPENDENCY ${infile})
+      SET(${outfiles} ${${outfiles}} ${outfile})
+    ENDFOREACH (it)
+
+  ENDMACRO (QT4_WRAP_UI)
+
+
+  # QT4_ADD_RESOURCE(outfiles inputfile ... )
+  # TODO  perhaps consider adding support for compression and root options to rcc
+
+  MACRO (QT4_ADD_RESOURCES outfiles )
+
+    FOREACH (it ${ARGN})
+      GET_FILENAME_COMPONENT(outfilename ${it} NAME_WE)
+      SET(infile ${CMAKE_CURRENT_SOURCE_DIR}/${it})
+      SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/qrc_${outfilename}.cxx)
+      ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
+        COMMAND ${QT_RCC_EXECUTABLE}
+        ARGS -name ${outfilename} -o ${outfile} ${infile}
+        MAIN_DEPENDENCY ${infile} )
+      SET(${outfiles} ${${outfiles}} ${outfile})
+    ENDFOREACH (it)
+
+  ENDMACRO (QT4_ADD_RESOURCES)
+
+
+   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)
+                  SET(_header ${_abs_PATH}/${_basename}.h)
+                  SET(_moc    ${CMAKE_CURRENT_BINARY_DIR}/${_current_MOC})
+                  ADD_CUSTOM_COMMAND(OUTPUT ${_moc}
+                     COMMAND ${QT_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( QT_LIBRARY_DIR AND QT_INCLUDE_DIR AND QT_MOC_EXECUTABLE AND QT_UIC_EXECUTABLE AND QT_RCC_EXECUTABLE)
+    SET( QT4_FOUND "YES" )
+    IF( NOT Qt4_FIND_QUIETLY)
+      MESSAGE(STATUS "Found Qt-Version ${QTVERSION}")
+    ENDIF( NOT Qt4_FIND_QUIETLY)
+  ELSE( QT_LIBRARY_DIR AND QT_INCLUDE_DIR AND QT_MOC_EXECUTABLE AND QT_UIC_EXECUTABLE AND QT_RCC_EXECUTABLE)
+    SET( QT4_FOUND "NO")
+    IF( Qt4_FIND_REQUIRED)
+      MESSAGE( FATAL_ERROR "Qt libraries, includes, moc, uic or/and rcc NOT found!")
+    ENDIF( Qt4_FIND_REQUIRED)
+  ENDIF( QT_LIBRARY_DIR AND QT_INCLUDE_DIR AND QT_MOC_EXECUTABLE AND QT_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)
+    ENDIF (Q_WS_X11)
+    FIND_PACKAGE(Threads)
+    SET(QT_QTCORE_LIBRARY ${QT_QTCORE_LIBRARY} ${CMAKE_THREAD_LIBS_INIT})
+  ENDIF(UNIX)
+
+
+  #######################################
+  #
+  #       compatibility settings
+  #
+  #######################################
+  # Backwards compatibility for CMake1.4 and 1.2
+  SET (QT_MOC_EXE ${QT_MOC_EXECUTABLE} )
+  SET (QT_UIC_EXE ${QT_UIC_EXECUTABLE} )
+
+  SET( QT_QT_LIBRARY "")
+
+ELSE(QT4_QMAKE_FOUND)
+
+   IF(Qt4_FIND_REQUIRED)
+      IF(QT4_INSTALLED_VERSION_TOO_OLD)
+         MESSAGE(FATAL_ERROR "The installed Qt version ${QTVERSION} is too old, at least version ${QT_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 ${QT_MIN_VERSION} is required")
+      ENDIF(QT4_INSTALLED_VERSION_TOO_OLD AND NOT Qt4_FIND_QUIETLY)
+   ENDIF(Qt4_FIND_REQUIRED)
+ENDIF (QT4_QMAKE_FOUND)
+
diff --git a/development/cmake/modules/FindZLIB.cmake b/development/cmake/modules/FindZLIB.cmake
new file mode 100755 (executable)
index 0000000..4ebf5fa
--- /dev/null
@@ -0,0 +1,34 @@
+if (ZLIB_INCLUDE_DIR)\r
+  # Already in cache, be silent\r
+  set(ZLIB_FIND_QUIETLY TRUE)\r
+endif (ZLIB_INCLUDE_DIR)\r
+\r
+FIND_PATH(ZLIB_INCLUDE_DIR zlib.h\r
+ /usr/include\r
+ /usr/local/include\r
+)\r
+\r
+set(POTENTIAL_Z_LIBS z zlib zdll)\r
+FIND_LIBRARY(ZLIB_LIBRARY NAMES ${POTENTIAL_Z_LIBS}\r
+PATHS\r
+ /usr/lib\r
+ /usr/local/lib\r
+)\r
+\r
+IF (ZLIB_INCLUDE_DIR AND ZLIB_LIBRARY)\r
+   SET(ZLIB_FOUND TRUE)\r
+ENDIF (ZLIB_INCLUDE_DIR AND ZLIB_LIBRARY)\r
+\r
+IF (ZLIB_FOUND)\r
+   IF (NOT ZLIB_FIND_QUIETLY)\r
+      MESSAGE(STATUS "Found Z: ${ZLIB_LIBRARY}")\r
+   ENDIF (NOT ZLIB_FIND_QUIETLY)\r
+ELSE (ZLIB_FOUND)\r
+   IF (ZLIB_FIND_REQUIRED)\r
+      MESSAGE(STATUS "Looked for Z libraries named ${POTENTIAL_Z_LIBS}.")\r
+      MESSAGE(STATUS "Found no acceptable Z library. This is fatal.")\r
+      MESSAGE(FATAL_ERROR "Could NOT find z library")\r
+   ENDIF (ZLIB_FIND_REQUIRED)\r
+ENDIF (ZLIB_FOUND)\r
+\r
+MARK_AS_ADVANCED(ZLIB_LIBRARY ZLIB_INCLUDE_DIR)\r
diff --git a/development/cmake/modules/LyXMacros.cmake b/development/cmake/modules/LyXMacros.cmake
new file mode 100755 (executable)
index 0000000..9db86f1
--- /dev/null
@@ -0,0 +1,99 @@
+
+macro(lyx_add_path _list _prefix)
+       set(_tmp)
+       foreach(_current ${${_list}})
+               set(_tmp ${_tmp} ${_prefix}/${_current})
+               #message( ${_prefix}/${_current})
+       endforeach(_current)     
+       set(${_list} ${_tmp})  
+endmacro(lyx_add_path _out _prefix)
+
+
+#create the implementation files from the ui files and add them to the list of sources
+#usage: LYX_ADD_QT4_UI_FILES(foo_SRCS ${ui_files})
+macro (LYX_ADD_QT4_UI_FILES _sources )
+   foreach (_current_FILE ${ARGN})
+
+      get_filename_component(_tmp_FILE ${_current_FILE} ABSOLUTE)
+      get_filename_component(_basename ${_tmp_FILE} NAME_WE)
+      set(_header ${CMAKE_CURRENT_BINARY_DIR}/ui/${_basename}.h)
+
+      # we need to run uic and replace some things in the generated file
+      # this is done by executing the cmake script kde4uic.cmake
+      add_custom_command(OUTPUT ${_header}
+         COMMAND ${CMAKE_COMMAND}
+         ARGS
+         -DKDE4_HEADER:BOOL=ON
+         -DKDE_UIC_EXECUTABLE:FILEPATH=${QT_UIC_EXECUTABLE}
+         -DKDE_UIC_FILE:FILEPATH=${_tmp_FILE}
+         -DKDE_UIC_H_FILE:FILEPATH=${_header}
+         -DKDE_UIC_BASENAME:STRING=${_basename}
+         -P ${CMAKE_MODULE_PATH}/LyXuic.cmake
+         MAIN_DEPENDENCY ${_tmp_FILE}
+      )
+      set(${_sources} ${${_sources}} ${_header})
+   endforeach (_current_FILE)
+endmacro (LYX_ADD_QT4_UI_FILES)
+
+
+
+MACRO (LYX_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 (EXISTS ${_abs_FILE} AND NOT _skip)
+
+         file(READ ${_abs_FILE} _contents)
+
+         get_filename_component(_abs_PATH ${_abs_FILE} PATH)
+
+         string(REGEX MATCHALL "#include +[^ ]+_moc\\.cpp[\">]" _match "${_contents}")
+         if (_match)
+            foreach (_current_MOC_INC ${_match})
+               string(REGEX MATCH "[^ <\"]+_moc\\.cpp" _current_MOC "${_current_MOC_INC}")
+
+               get_filename_component(_basename ${_current_MOC} NAME_WE)               
+                       
+                               string(LENGTH ${_basename} _length)
+                               MATH(EXPR _mocless_length ${_length}-4)
+                               STRING(SUBSTRING  ${_basename} 0 ${_mocless_length} _mocless_name )
+   
+          set(_header ${_abs_PATH}/${_mocless_name}.h)
+          
+          #message(STATUS "moc : ${_header}")
+
+
+
+               #set(_header ${CMAKE_CURRENT_SOURCE_DIR}/${_basename}.h)
+               #set(_header ${_abs_PATH}/${_basename}.h)
+               set(_moc    ${CMAKE_CURRENT_BINARY_DIR}/${_current_MOC})
+               
+   #set(_moc    ${_abs_PATH}/${_current_MOC})
+       add_custom_command(OUTPUT ${_moc}
+        COMMAND ${QT_MOC_EXECUTABLE}
+        ARGS ${_moc_INCS} ${_header} -o ${_moc}
+        MAIN_DEPENDENCY ${_header}
+     )
+               macro_add_file_dependencies(${_abs_FILE} ${_moc})
+
+            endforeach (_current_MOC_INC)
+         else(_match)
+               #message(STATUS "moc not found : ${_abs_FILE} ")
+         endif (_match)
+
+      endif (EXISTS ${_abs_FILE} AND NOT _skip)
+   endforeach (_current_FILE)
+endmacro (LYX_AUTOMOC)
+
diff --git a/development/cmake/modules/LyXPaths.cmake b/development/cmake/modules/LyXPaths.cmake
new file mode 100755 (executable)
index 0000000..cd2517a
--- /dev/null
@@ -0,0 +1,49 @@
+if(WIN32)\r
+\r
+file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _prog_path)\r
+\r
+set(_zlib_path ${_prog_path}/zlib)\r
+set(_iconv_path ${_prog_path}/iconv)\r
+set(_gnuwin32_dir ${_prog_path}/gnuwin32)\r
+\r
+set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} \r
+       ${_gnuwin32_dir}/include\r
+       ${_zlib_path}/include\r
+       ${_iconv_path}/include\r
+       )\r
+       \r
+set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} \r
+       ${_gnuwin32_dir}/lib\r
+       ${_zlib_path}/lib\r
+       ${_iconv_path}/lib\r
+       )\r
+\r
+#chek_include_files path\r
+set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${_gnuwin32_dir}/include)\r
+\r
+\r
+else(WIN32)\r
+\r
+       set(_prog_path ~/bin)\r
+       \r
+endif(WIN32)\r
+\r
+\r
+GET_FILENAME_COMPONENT(lyx_dir_readme ${CMAKE_SOURCE_DIR}/../../README ABSOLUTE)\r
+GET_FILENAME_COMPONENT(TOP_SRC_DIR ${lyx_dir_readme} PATH)\r
+\r
+if(WIN32)\r
+       set(locale_dir Resources/locale)\r
+else(WIN32)    \r
+       set(locale_dir share/locale)\r
+endif(WIN32)\r
+\r
+set(PREFIX ${_prog_path}/LyX)\r
+set(LOCAL_DIR ${PREFIX}/${locale_dir})\r
+\r
+#message(" PREFIX : ${PREFIX}")\r
+#message(" LOCAL_DIR : ${LOCAL_DIR}")\r
+#message(" TOP_SRC_DIR : ${TOP_SRC_DIR}")\r
+\r
+\r
+\r
diff --git a/development/cmake/modules/LyXuic.cmake b/development/cmake/modules/LyXuic.cmake
new file mode 100755 (executable)
index 0000000..c7cc00a
--- /dev/null
@@ -0,0 +1,12 @@
+
+
+EXECUTE_PROCESS(COMMAND ${KDE_UIC_EXECUTABLE}
+${KDE_UIC_FILE}
+OUTPUT_VARIABLE _uic_CONTENTS
+ERROR_QUIET
+)
+set(KDE_UIC_CPP_FILE ${KDE_UIC_H_FILE})
+
+
+FILE(WRITE ${KDE_UIC_CPP_FILE} "${_uic_CONTENTS}\n")
+
diff --git a/development/cmake/modules/MacroAddFileDependencies.cmake b/development/cmake/modules/MacroAddFileDependencies.cmake
new file mode 100755 (executable)
index 0000000..1359691
--- /dev/null
@@ -0,0 +1,15 @@
+# - MACRO_ADD_FILE_DEPENDENCIES(<_file> depend_files...)
+# MACRO_OPTIONAL_FIND_PACKAGE( <name> [QUIT] )
+
+MACRO (MACRO_ADD_FILE_DEPENDENCIES _file)
+
+   GET_SOURCE_FILE_PROPERTY(_deps ${_file} OBJECT_DEPENDS)
+   if (_deps)
+      set(_deps ${_deps} ${ARGN})
+   else (_deps)
+      set(_deps ${ARGN})
+   endif (_deps)
+
+   SET_SOURCE_FILES_PROPERTIES(${_file} PROPERTIES OBJECT_DEPENDS "${_deps}")
+
+ENDMACRO (MACRO_ADD_FILE_DEPENDENCIES)
diff --git a/development/cmake/src/CMakeLists.txt b/development/cmake/src/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..d498e60
--- /dev/null
@@ -0,0 +1,269 @@
+project(lyx-qt4)
+
+include_directories(${TOP_SRC_DIR}/src)
+
+add_subdirectory(frontends) 
+add_subdirectory(graphics) 
+add_subdirectory(insets) 
+add_subdirectory(mathed) 
+add_subdirectory(support) 
+#add_subdirectory(tex2lyx) 
+
+
+configure_file(version.C.cmake ${CMAKE_CURRENT_BINARY_DIR}/version.C)
+
+set(lyx_sources
+       Bidi.C
+       Bidi.h
+       BufferView.C
+       BufferView.h
+       BufferView_pimpl.C
+       BufferView_pimpl.h
+       Bullet.C
+       Bullet.h
+       BranchList.C
+       BranchList.h
+       Chktex.C
+       Chktex.h
+       Color.C
+       Color.h
+       CutAndPaste.C
+       CutAndPaste.h
+       DepTable.C
+       DepTable.h
+       FloatList.C
+       FloatList.h
+       Floating.C
+       Floating.h
+       FontIterator.C
+       FontIterator.h
+       FuncStatus.C
+       FuncStatus.h
+       InsetList.C
+       InsetList.h
+       LColor.C
+       LColor.h
+       LaTeX.C
+       LaTeX.h
+       LaTeXFeatures.C
+       LaTeXFeatures.h
+       LyXAction.C
+       LyXAction.h
+       MenuBackend.C
+       MenuBackend.h
+       ParagraphList.h
+       ParagraphList_fwd.h
+       ParagraphParameters.C
+       ParagraphParameters.h
+       PrinterParams.C
+       PrinterParams.h
+       RowList_fwd.h
+       Spacing.C
+       Spacing.h
+       Thesaurus.C
+       Thesaurus.h
+       ToolbarBackend.C
+       ToolbarBackend.h
+       WordLangTuple.h
+       author.C
+       author.h
+       boost.C
+       box.h
+       box.C
+       buffer.C
+       buffer.h
+       buffer_funcs.C
+       buffer_funcs.h
+       bufferlist.C
+       bufferlist.h
+       bufferparams.C
+       bufferparams.h
+       bufferview_funcs.C
+       bufferview_funcs.h
+       changes.C
+       changes.h
+       chset.C
+       chset.h
+       converter.C
+       converter.h
+       counters.C
+       counters.h
+       coordcache.C
+       coordcache.h
+       cursor.C
+       cursor.h
+       cursor_slice.C
+       cursor_slice.h
+       debug.C
+       debug.h
+       dimension.C
+       dimension.h
+       dociterator.C
+       dociterator.h
+       dispatchresult.h
+       encoding.C
+       encoding.h
+       errorlist.C
+       errorlist.h
+       exporter.C
+       exporter.h
+       gettext.C
+       gettext.h
+       factory.h
+       factory.C
+       format.C
+       format.h
+       funcrequest.h
+       funcrequest.C
+       graph.C
+       graph.h
+       importer.C
+       importer.h
+       intl.C
+       intl.h
+       insetiterator.C
+       insetiterator.h
+       kbmap.C
+       kbmap.h
+       kbsequence.C
+       kbsequence.h
+       language.C
+       language.h
+       session.C
+       session.h
+       layout.h
+       lengthcommon.C
+       lengthcommon.h
+       lfuns.h
+       lyx_cb.C
+       lyx_cb.h
+       lyx_main.C
+       lyx_main.h
+       lyx_sty.C
+       lyx_sty.h
+       lyxfont.C
+       lyxfont.h
+       lyxfind.C
+       lyxfind.h
+       lyxfunc.C
+       lyxfunc.h
+       lyxgluelength.C
+       lyxgluelength.h
+       lyxlayout.C
+       lyxlayout.h
+       lyxlayout_ptr_fwd.h
+       lyxlength.C
+       lyxlength.h
+       lyxlex.C
+       lyxlex.h
+       lyxlex_pimpl.C
+       lyxlex_pimpl.h
+       lyxrc.C
+       lyxrc.h
+       lyxrow.C
+       lyxrow.h
+       lyxrow_funcs.C
+       lyxrow_funcs.h
+       lyxserver.C
+       lyxserver.h
+       lyxsocket.C
+       lyxsocket.h
+       lyxtext.h
+       lyxtextclass.C
+       lyxtextclass.h
+       lyxtextclasslist.C
+       lyxtextclasslist.h
+       lyxvc.C
+       lyxvc.h
+       main.C
+       messages.C
+       messages.h
+       metricsinfo.C
+       metricsinfo.h
+       mover.C
+       mover.h
+       output.C
+       output.h
+       outputparams.C
+       outputparams.h
+       output_docbook.C
+       output_docbook.h
+       output_latex.C
+       output_latex.h
+       output_linuxdoc.C
+       output_linuxdoc.h
+       output_plaintext.C
+       output_plaintext.h
+       paper.h
+       paragraph.C
+       paragraph.h
+       paragraph_funcs.C
+       paragraph_funcs.h
+       paragraph_pimpl.C
+       paragraph_pimpl.h
+       pariterator.C
+       pariterator.h
+       #$(PSPELL) 
+       #$(ISPELL) 
+       SpellBase.C
+       SpellBase.h
+       rowpainter.C
+       rowpainter.h
+       sgml.C
+       sgml.h
+       tabular.C
+       tabular.h
+       tex-accent.C
+       tex-accent.h
+       tex-strings.C
+       tex-strings.h
+       texrow.C
+       texrow.h
+       text.C
+       text2.C
+       text3.C
+       TocBackend.C
+       TocBackend.h
+       toc.C
+       toc.h
+       trans.C
+       trans.h
+       trans_decl.h
+       trans_mgr.C
+       trans_mgr.h
+       undo.C
+       undo.h
+       vc-backend.C
+       vc-backend.h
+       version.h
+       vspace.C
+       vspace.h
+)
+
+if(ASPELL_FOUND)
+       include_directories(${ASPELL_INCLUDE_DIR})
+       set(lyx_sources ${lyx_sources} aspell.C)
+endif(ASPELL_FOUND)
+
+
+lyx_add_path(lyx_sources ${TOP_SRC_DIR}/src)
+
+include_directories(${CMAKE_CURRENT_BINARY_DIR})
+
+add_executable(lyx-qt4 ${lyx_sources} ${CMAKE_CURRENT_BINARY_DIR}/version.C)
+
+target_link_libraries(lyx-qt4 
+       mathed
+       insets
+       frontends
+       frontend_qt4
+       graphics
+       support
+       intl
+       ${QT_QTMAIN_LIBRARY}
+       boost_iostreams
+)
+
+if(ASPELL_FOUND)
+       target_link_libraries(lyx-qt4 ${ASPELL_LIBRARIES})
+endif(ASPELL_FOUND)
diff --git a/development/cmake/src/dummy.cpp b/development/cmake/src/dummy.cpp
new file mode 100755 (executable)
index 0000000..fb0a97b
--- /dev/null
@@ -0,0 +1 @@
+//autogenerated file by cmake\r
diff --git a/development/cmake/src/frontends/CMakeLists.txt b/development/cmake/src/frontends/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..590d381
--- /dev/null
@@ -0,0 +1,46 @@
+project(frontends)
+
+include_directories(${TOP_SRC_DIR}/src/frontends)
+
+add_subdirectory(controllers) 
+add_subdirectory(qt4) 
+
+set(frontends_sources
+       Alert.C
+       Alert.h
+       Alert_pimpl.h
+       Dialogs.C
+       Dialogs.h
+       FileDialog.h
+       LyXKeySym.h
+       LyXKeySymFactory.h
+       LyXScreenFactory.h
+       LyXView.C
+       LyXView.h
+       Menubar.h
+       Painter.C
+       Painter.h
+       Timeout.C
+       Timeout.h
+       Toolbars.C
+       Toolbars.h
+       WorkArea.h
+       WorkAreaFactory.h
+       font_metrics.h
+       guiapi.h
+       guiapi.C
+       key_state.h
+       lyx_gui.h
+       mouse_state.h
+       nullpainter.C
+       nullpainter.h
+       screen.C
+       screen.h
+)
+
+lyx_add_path(frontends_sources ${TOP_SRC_DIR}/src/frontends)
+
+add_library(frontends STATIC ${frontends_sources})
+
+
+
diff --git a/development/cmake/src/frontends/controllers/CMakeLists.txt b/development/cmake/src/frontends/controllers/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..8bd60d6
--- /dev/null
@@ -0,0 +1,110 @@
+project(controllers)
+
+set(controllers_sources
+       Dialog.C
+       Dialog.h
+       Kernel.C
+       Kernel.h
+       biblio.C
+       biblio.h
+       character.C
+       character.h
+       frnt_lang.C
+       frnt_lang.h
+       tex_helpers.C
+       tex_helpers.h
+       BCView.h
+       BCView.C
+       ButtonController.C
+       ButtonController.h
+       ButtonPolicies.C
+       ButtonPolicies.h
+       ControlAboutlyx.C
+       ControlAboutlyx.h
+       ControlBibtex.C
+       ControlBibtex.h
+       ControlBox.C
+       ControlBox.h
+       ControlBranch.C
+       ControlBranch.h
+       ControlCharacter.C
+       ControlCharacter.h
+       ControlChanges.C
+       ControlChanges.h
+       ControlCitation.C
+       ControlCitation.h
+       ControlCommand.C
+       ControlCommand.h
+       ControlCommandBuffer.C
+       ControlCommandBuffer.h
+       ControlDocument.C
+       ControlDocument.h
+       ControlErrorList.C
+       ControlErrorList.h
+       ControlERT.C
+       ControlERT.h
+       ControlExternal.C
+       ControlExternal.h
+       ControlFloat.C
+       ControlFloat.h
+       ControlGraphics.C
+       ControlGraphics.h
+       ControlInclude.C
+       ControlInclude.h
+       ControlLog.C
+       ControlLog.h
+       ControlViewSource.C
+       ControlViewSource.h
+       ControlMath.C
+       ControlMath.h
+       ControlNote.C
+       ControlNote.h
+       ControlParagraph.C
+       ControlParagraph.h
+       ControlPreamble.C
+       ControlPreamble.h
+       ControlPrefs.C
+       ControlPrefs.h
+       ControlPrint.C
+       ControlPrint.h
+       ControlRef.C
+       ControlRef.h
+       ControlSearch.C
+       ControlSearch.h
+       ControlSendto.C
+       ControlSendto.h
+       ControlShowFile.C
+       ControlShowFile.h
+       ControlSpellchecker.C
+       ControlSpellchecker.h
+       ControlTabular.C
+       ControlTabular.h
+       ControlTabularCreate.C
+       ControlTabularCreate.h
+       ControlTexinfo.C
+       ControlTexinfo.h
+       ControlThesaurus.C
+       ControlThesaurus.h
+       ControlToc.C
+       ControlToc.h
+       ControlVSpace.C
+       ControlVSpace.h
+       ControlWrap.C
+       ControlWrap.h
+       helper_funcs.C
+       helper_funcs.h
+)
+
+lyx_add_path(controllers_sources ${TOP_SRC_DIR}/src/frontends/controllers)
+
+include_directories(${TOP_SRC_DIR}/src/frontends/controllers)
+
+add_library(controllers STATIC ${controllers_sources})
+
+target_link_libraries(controllers boost_regex boost_filesystem)
+
+
+
+
+
+
diff --git a/development/cmake/src/frontends/qt4/CMakeLists.txt b/development/cmake/src/frontends/qt4/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..12e11f9
--- /dev/null
@@ -0,0 +1,218 @@
+project(frontend_qt4)
+
+set(frontends_qt4_dialog_sources
+       BulletsModule.C
+       emptytable.C
+       FileDialog_private.C
+       floatplacement.C
+       iconpalette.C
+       InsertTableWidget.C
+       lengthcombo.C
+       QAboutDialog.C
+       QBibitemDialog.C
+       QBibtexDialog.C
+       QBoxDialog.C
+       QBranchDialog.C
+       QChangesDialog.C
+       QCharacterDialog.C
+       QCitationDialog.C
+       QCommandBuffer.C
+       QCommandEdit.C
+       QDelimiterDialog.C
+       QDocumentDialog.C
+       QErrorListDialog.C
+       QERTDialog.C
+       QExternalDialog.C
+       QFloatDialog.C
+       QGraphicsDialog.C
+       QIncludeDialog.C
+       QIndexDialog.C
+       QLogDialog.C
+       QViewSourceDialog.C
+       QLPopupMenu.C
+       QLPrintDialog.C
+       QMathDialog.C
+       QMathMatrixDialog.C
+       QNoteDialog.C
+       QParagraphDialog.C
+       QPrefsDialog.C
+       QRefDialog.C
+       QSearchDialog.C
+       QSendtoDialog.C
+       qsetborder.C
+       QShowFileDialog.C
+       QSpellcheckerDialog.C
+       QDialogView.C
+       QTabularCreateDialog.C
+       QTabularDialog.C
+       QTexinfoDialog.C
+       QThesaurusDialog.C
+       TocModel.C
+       QTocDialog.C
+       QtView.C
+       QURLDialog.C
+       QVSpaceDialog.C
+       QWrapDialog.C
+       QLToolbar.C
+       socket_callback.C
+       validators.C
+       #Profile.C
+)
+
+set(frontends_qt4_sources
+       Alert_pimpl.C
+       Dialogs.C
+       FileDialog.C
+       LyXKeySymFactory.C
+       LyXScreenFactory.C
+       QLMenubar.C 
+       qtTimeout.C 
+       QAbout.C 
+       QBibitem.C 
+       QBibtex.C 
+       QBox.C 
+       QBranch.C 
+       QBranches.C 
+       QChanges.C 
+       QCharacter.C 
+       QCitation.C 
+       QDocument.C 
+       QErrorList.C 
+       QERT.C 
+       QExternal.C 
+       QFloat.C 
+       QGraphics.C 
+       QInclude.C 
+       QIndex.C 
+       QLAction.C 
+       QLImage.C 
+       QLog.C 
+       QViewSource.C 
+       QLPainter.C 
+       QLyXKeySym.C 
+       QMath.C 
+       QNote.C 
+       QParagraph.C
+       QPrefs.C 
+       QPrint.C 
+       QRef.C 
+       QSearch.C 
+       QSendto.C 
+       QShowFile.C 
+       QSpellchecker.C
+       QTabular.C 
+       QTabularCreate.C 
+       QTexinfo.C 
+       QThesaurus.C 
+       QToc.C 
+       QURL.C 
+       QVSpace.C 
+       QWorkArea.C 
+       QWrap.C 
+       Qt2BC.C 
+       WorkAreaFactory.C
+       checkedwidgets.C 
+       lyx_gui.C
+       lcolorcache.C
+       panelstack.C
+       qfontexample.C
+       qfont_loader.C
+       qfont_metrics.C
+       qt_helpers.C
+       ${frontends_qt4_dialog_sources}
+)      
+
+set(frontend_qt4_UI
+       ui/BiblioUi.ui
+       ui/BranchesUi.ui
+       ui/BulletsUi.ui
+       ui/LaTeXUi.ui
+       ui/LanguageUi.ui
+       ui/MarginsUi.ui
+       ui/MathsUi.ui
+       ui/NumberingUi.ui
+       ui/PageLayoutUi.ui
+       ui/PreambleUi.ui
+       ui/QAboutUi.ui
+       ui/QAskForTextUi.ui
+       ui/QBibitemUi.ui
+       ui/QBibtexAddUi.ui
+       ui/QBibtexUi.ui
+       ui/QBoxUi.ui
+       ui/QBranchUi.ui
+       ui/QChangesUi.ui
+       ui/QCharacterUi.ui
+       ui/QCitationFindUi.ui
+       ui/QCitationUi.ui
+       ui/QDelimiterUi.ui
+       ui/QDocumentUi.ui
+       ui/QERTUi.ui
+       ui/QErrorListUi.ui
+       ui/QExternalUi.ui
+       ui/QFloatUi.ui
+       ui/QGraphicsUi.ui
+       ui/QIncludeUi.ui
+       ui/QIndexUi.ui
+       ui/QLogUi.ui
+       ui/QMathMatrixUi.ui
+       ui/QMathUi.ui
+       ui/QNoteUi.ui
+       ui/QParagraphUi.ui
+       ui/QPrefAsciiUi.ui
+       ui/QPrefColorsUi.ui
+       ui/QPrefConvertersUi.ui
+       ui/QPrefCopiersUi.ui
+       ui/QPrefCygwinPathUi.ui
+       ui/QPrefDateUi.ui
+       ui/QPrefDisplayUi.ui
+       ui/QPrefFileformatsUi.ui
+       ui/QPrefIdentityUi.ui
+       ui/QPrefKeyboardUi.ui
+       ui/QPrefLanguageUi.ui
+       ui/QPrefLatexUi.ui
+       ui/QPrefPathsUi.ui
+       ui/QPrefPrinterUi.ui
+       ui/QPrefScreenFontsUi.ui
+       ui/QPrefSpellcheckerUi.ui
+       ui/QPrefUi.ui
+       ui/QPrefsUi.ui
+       ui/QPrintUi.ui
+       ui/QRefUi.ui
+       ui/QSearchUi.ui
+       ui/QSendtoUi.ui
+       ui/QShowFileUi.ui
+       ui/QSpellcheckerUi.ui
+       ui/QTabularCreateUi.ui
+       ui/QTabularUi.ui
+       ui/QTexinfoUi.ui
+       ui/QThesaurusUi.ui
+       ui/QTocUi.ui
+       ui/QURLUi.ui
+       ui/QVSpaceUi.ui
+       ui/QViewSourceUi.ui
+       ui/QWrapUi.ui
+       ui/TextLayoutUi.ui
+)
+
+
+lyx_add_path(frontends_qt4_sources ${TOP_SRC_DIR}/src/frontends/qt4)
+lyx_add_path(frontend_qt4_UI ${TOP_SRC_DIR}/src/frontends/qt4)
+
+lyx_automoc(${frontends_qt4_sources})
+
+lyx_add_qt4_ui_files(frontends_qt4_sources ${frontend_qt4_UI})
+
+add_definitions(-DQT3_SUPPORT -DQT_NO_STL)
+
+include_directories(   ${TOP_SRC_DIR}/src/frontends/qt4 
+                       ${TOP_SRC_DIR}/src/frontends/controllers
+                       ${CMAKE_CURRENT_BINARY_DIR})
+
+add_library(frontend_qt4 STATIC ${frontends_qt4_sources})
+
+target_link_libraries(frontend_qt4 ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} controllers)
+
+if(WIN32)
+       target_link_libraries(frontend_qt4 Gdi32)
+endif(WIN32)
+
diff --git a/development/cmake/src/graphics/CMakeLists.txt b/development/cmake/src/graphics/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..19dcc5d
--- /dev/null
@@ -0,0 +1,33 @@
+project(graphics)
+
+set(graphics_sources
+       GraphicsCache.h
+       GraphicsCache.C
+       GraphicsCacheItem.h
+       GraphicsCacheItem.C
+       GraphicsConverter.h
+       GraphicsConverter.C
+       GraphicsImage.h
+       GraphicsImage.C
+       GraphicsLoader.h
+       GraphicsLoader.C
+       GraphicsParams.C
+       GraphicsParams.h
+       LoaderQueue.h
+       LoaderQueue.C
+       GraphicsTypes.h
+       GraphicsTypes.C
+       PreviewImage.h
+       PreviewImage.C
+       PreviewLoader.h
+       PreviewLoader.C
+       Previews.h
+       Previews.C
+)
+
+lyx_add_path(graphics_sources ${TOP_SRC_DIR}/src/graphics)
+
+include_directories(${TOP_SRC_DIR}/src/graphics)
+
+add_library(graphics STATIC ${graphics_sources})
+
diff --git a/development/cmake/src/insets/CMakeLists.txt b/development/cmake/src/insets/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..75b9ab2
--- /dev/null
@@ -0,0 +1,110 @@
+project(insets)
+
+set(insets_sources
+       mailinset.C
+       mailinset.h
+       ExternalSupport.C
+       ExternalSupport.h
+       ExternalTemplate.C
+       ExternalTemplate.h
+       ExternalTransforms.C
+       ExternalTransforms.h
+       render_base.h
+       render_button.C
+       render_button.h
+       render_graphic.C
+       render_graphic.h
+       render_preview.C
+       render_preview.h
+       inset.C
+       inset.h
+       insetbase.h
+       insetbase.C
+       insetbibitem.C
+       insetbibitem.h
+       insetbibtex.C
+       insetbibtex.h
+       insetbox.C
+       insetbox.h
+       insetbranch.C
+       insetbranch.h
+       insetcaption.C
+       insetcaption.h
+       insetcharstyle.C
+       insetcharstyle.h
+       insetcite.C
+       insetcite.h
+       insetcollapsable.C
+       insetcollapsable.h
+       insetcommand.C
+       insetcommand.h
+       insetcommandparams.C
+       insetcommandparams.h
+       insetenv.C
+       insetenv.h
+       insetert.C
+       insetert.h
+       insetexternal.C
+       insetexternal.h
+       insetfloat.h
+       insetfloat.C
+       insetfloatlist.C
+       insetfloatlist.h
+       insetfoot.C
+       insetfoot.h
+       insetfootlike.C
+       insetfootlike.h
+       insetgraphicsParams.h
+       insetgraphicsParams.C
+       insetgraphics.C
+       insetgraphics.h
+       insethfill.C
+       insethfill.h
+       insetinclude.C
+       insetinclude.h
+       insetindex.C
+       insetindex.h
+       insetlabel.C
+       insetlabel.h
+       insetlatexaccent.C
+       insetlatexaccent.h
+       insetline.C
+       insetline.h
+       insetmarginal.h
+       insetmarginal.C
+       insetnewline.C
+       insetnewline.h
+       insetnote.C
+       insetnote.h
+       insetoptarg.C
+       insetoptarg.h
+       insetpagebreak.C
+       insetpagebreak.h
+       insetquotes.C
+       insetquotes.h
+       insetref.C
+       insetref.h
+       insetspace.C
+       insetspace.h
+       insetspecialchar.C
+       insetspecialchar.h
+       insettabular.C
+       insettabular.h
+       insettext.C
+       insettext.h
+       insettoc.C
+       insettoc.h
+       inseturl.C
+       inseturl.h
+       insetvspace.C
+       insetvspace.h
+       insetwrap.h
+       insetwrap.C 
+)      
+
+lyx_add_path(insets_sources ${TOP_SRC_DIR}/src/insets)
+
+include_directories(${TOP_SRC_DIR}/src/insets)
+
+add_library(insets STATIC ${insets_sources})
+
diff --git a/development/cmake/src/mathed/CMakeLists.txt b/development/cmake/src/mathed/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..fb06c6d
--- /dev/null
@@ -0,0 +1,162 @@
+project(mathed)
+
+set(mathed_sources
+       textpainter.C
+       textpainter.h
+       math_amsarrayinset.C
+       math_amsarrayinset.h
+       math_arrayinset.C
+       math_arrayinset.h
+       math_atom.C
+       math_atom.h
+       math_autocorrect.C
+       math_autocorrect.h
+       math_biginset.C
+       math_biginset.h
+       math_binominset.C
+       math_binominset.h
+       math_boldsymbolinset.C
+       math_boldsymbolinset.h
+       math_boxinset.C
+       math_boxinset.h
+       math_boxedinset.C
+       math_boxedinset.h
+       math_braceinset.C
+       math_braceinset.h
+       math_casesinset.C
+       math_casesinset.h
+       math_charinset.C
+       math_charinset.h
+       math_colorinset.C
+       math_colorinset.h
+       math_commentinset.C
+       math_commentinset.h
+       math_data.C
+       math_data.h
+       math_decorationinset.C
+       math_decorationinset.h
+       math_deliminset.C
+       math_deliminset.h
+       math_dfracinset.C
+       math_dfracinset.h
+       math_diffinset.C
+       math_diffinset.h
+       math_diminset.C
+       math_diminset.h
+       math_dotsinset.C
+       math_dotsinset.h
+       math_envinset.C
+       math_envinset.h
+       math_extern.C
+       math_extern.h
+       math_exfuncinset.C
+       math_exfuncinset.h
+       math_exintinset.C
+       math_exintinset.h
+       math_factory.C
+       math_factory.h
+       math_fboxinset.C
+       math_fboxinset.h
+       math_frameboxinset.C
+       math_frameboxinset.h
+       math_fontinset.C
+       math_fontinset.h
+       math_fontoldinset.C
+       math_fontoldinset.h
+       math_fracinset.C
+       math_fracinset.h
+       math_fracbase.C
+       math_fracbase.h
+       math_gridinfo.h
+       math_gridinset.C
+       math_gridinset.h
+       math_hullinset.C
+       math_hullinset.h
+       math_inset.C
+       math_inset.h
+       math_kerninset.C
+       math_kerninset.h
+       math_lefteqninset.C
+       math_lefteqninset.h
+       math_liminset.C
+       math_liminset.h
+       math_macro.C
+       math_macro.h
+       math_macroarg.C
+       math_macroarg.h
+       math_macrotemplate.C
+       math_macrotemplate.h
+       math_macrotable.C
+       math_macrotable.h
+       math_makeboxinset.C
+       math_makeboxinset.h
+       math_mathmlstream.C
+       math_mathmlstream.h
+       math_matrixinset.C
+       math_matrixinset.h
+       math_nestinset.C
+       math_nestinset.h
+       math_numberinset.C
+       math_numberinset.h
+       math_oversetinset.C
+       math_oversetinset.h
+       math_parinset.C
+       math_parinset.h
+       math_parser.C
+       math_parser.h
+       math_phantominset.C
+       math_phantominset.h
+       math_replace.h
+       math_rootinset.C
+       math_rootinset.h
+       math_scriptinset.C
+       math_scriptinset.h
+       math_sizeinset.C
+       math_sizeinset.h
+       math_spaceinset.C
+       math_spaceinset.h
+       math_splitinset.C
+       math_splitinset.h
+       math_sqrtinset.C
+       math_sqrtinset.h
+       math_stackrelinset.C
+       math_stackrelinset.h
+       math_streamstr.C
+       math_streamstr.h
+       math_stringinset.C
+       math_stringinset.h
+       math_substackinset.C
+       math_substackinset.h
+       math_support.C
+       math_support.h
+       math_symbolinset.C
+       math_symbolinset.h
+       math_tabularinset.C
+       math_tabularinset.h
+       math_tfracinset.C
+       math_tfracinset.h
+       math_unknowninset.C
+       math_unknowninset.h
+       math_undersetinset.C
+       math_undersetinset.h
+       math_xarrowinset.C
+       math_xarrowinset.h
+       math_xymatrixinset.C
+       math_xymatrixinset.h
+       command_inset.h
+       command_inset.C
+       ref_inset.h
+       ref_inset.C
+       #formulamacro.C
+)
+#      math_mboxinset.C
+#      math_mboxinset.h
+
+
+lyx_add_path(mathed_sources ${TOP_SRC_DIR}/src/mathed)
+
+include_directories(${TOP_SRC_DIR}/src/mathed)
+
+add_library(mathed STATIC ${mathed_sources})
+
+
diff --git a/development/cmake/src/support/CMakeLists.txt b/development/cmake/src/support/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..6aad4f9
--- /dev/null
@@ -0,0 +1,81 @@
+project(support)
+
+configure_file(package.C.cmake ${CMAKE_CURRENT_BINARY_DIR}/package.C)
+
+set(support_sources
+       FileMonitor.h
+       FileMonitor.C
+       RandomAccessList.h
+       abort.C
+       chdir.C
+       convert.C
+       convert.h
+       copy.C
+       copied_ptr.h
+       cow_ptr.h
+       debugstream.h
+       environment.h
+       environment.C
+       filefilterlist.C
+       filefilterlist.h
+       filename.C
+       filename.h
+       filetools.C
+       filetools.h
+       forkedcall.C
+       forkedcall.h
+       forkedcallqueue.C
+       forkedcallqueue.h
+       forkedcontr.C
+       forkedcontr.h
+       fs_extras.C
+       fs_extras.h
+       getcwd.C
+       kill.C
+       limited_stack.h
+       lstrings.C
+       lstrings.h
+       lyxalgo.h
+       lyxlib.h
+       lyxmanip.h
+       lyxtime.C
+       lyxtime.h
+       lyxsum.C
+       mkdir.C
+       os.C
+       os.h
+       path.C
+       path.h
+       package.h
+       rename.C
+       socktools.C
+       socktools.h
+       std_istream.h
+       std_ostream.h
+       systemcall.C
+       systemcall.h
+       tempname.C
+       textutils.h
+       translator.h
+       types.h
+       userinfo.C
+       userinfo.h
+       unlink.C
+)
+
+
+
+lyx_add_path(support_sources ${TOP_SRC_DIR}/src/support)
+
+include_directories(${TOP_SRC_DIR}/src/support)
+
+add_library(support STATIC ${support_sources} ${CMAKE_CURRENT_BINARY_DIR}/package.C)
+
+target_link_libraries(support boost_signals)
+
+if(WIN32)
+       target_link_libraries(support shlwapi)
+endif(WIN32)
+
+
+
diff --git a/development/cmake/src/support/package.C.cmake b/development/cmake/src/support/package.C.cmake
new file mode 100755 (executable)
index 0000000..6810a55
--- /dev/null
@@ -0,0 +1,732 @@
+// -*- C++ -*-
+/**
+ * \file package.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Angus Leeming
+ *
+ * Full author contact details are available in file CREDITS.
+ *
+ * Warning! This file is autogenerated from package.C.in.
+ * All changes to this file will be lost.
+ */
+
+#include <config.h>
+
+#include "support/package.h"
+
+#include "debug.h"
+#include "gettext.h"
+
+#include "support/environment.h"
+#include "support/filetools.h"
+#include "support/lstrings.h"
+#include "support/os.h"
+
+#if defined (USE_WINDOWS_PACKAGING)
+# include "support/os_win32.h"
+#endif
+
+#include <boost/filesystem/operations.hpp>
+#include <boost/tuple/tuple.hpp>
+
+#include <list>
+#include <utility>
+
+#if !defined (USE_WINDOWS_PACKAGING) && \
+    !defined (USE_MACOSX_PACKAGING) && \
+    !defined (USE_POSIX_PACKAGING)
+#error USE_FOO_PACKAGING must be defined for FOO = WINDOWS, MACOSX or POSIX.
+#endif
+
+#if defined (USE_MACOSX_PACKAGING)
+# include <CoreServices/CoreServices.h> // FSFindFolder, FSRefMakePath
+#endif
+
+using std::string;
+
+namespace fs = boost::filesystem;
+
+namespace lyx {
+namespace support {
+
+namespace {
+
+Package package_;
+bool initialised_ = false;
+
+} // namespace anon
+
+
+void init_package(string const & command_line_arg0,
+                 string const & command_line_system_support_dir,
+                 string const & command_line_user_support_dir,
+                 exe_build_dir_to_top_build_dir top_build_dir_location)
+{
+       // Can do so only once.
+       if (initialised_)
+               return;
+
+       package_ = Package(command_line_arg0,
+                          command_line_system_support_dir,
+                          command_line_user_support_dir,
+                          top_build_dir_location);
+       initialised_ = true;
+}
+
+
+Package const & package()
+{
+       // Commented out because package().locale_dir() can be called
+       // from the message translation code in messages.C before
+       // init_package() is called. Lars is on the case...
+       // BOOST_ASSERT(initialised_);
+       return package_;
+}
+
+
+namespace {
+
+string const abs_path_from_binary_name(string const & exe);
+
+std::pair<string, string> const
+get_build_dirs(string const & abs_binary,
+              exe_build_dir_to_top_build_dir top_build_dir_location);
+
+string const get_document_dir(string const & home_dir);
+
+string const get_home_dir();
+
+string const get_locale_dir(string const & system_support_dir);
+
+string const get_system_support_dir(string const & abs_binary,
+                                   string const & command_line_system_support_dir);
+
+string const get_temp_dir();
+
+string const get_default_user_support_dir(string const & home_dir);
+
+std::pair<string, bool> const
+get_user_support_dir(string const & default_user_support_dir,
+                    string const & command_line_user_support_dir);
+
+
+string const & with_version_suffix();
+
+} // namespace anon
+
+
+Package::Package(string const & command_line_arg0,
+                string const & command_line_system_support_dir,
+                string const & command_line_user_support_dir,
+                exe_build_dir_to_top_build_dir top_build_dir_location)
+       : explicit_user_support_dir_(false)
+{
+       home_dir_ = get_home_dir();
+       temp_dir_ = get_temp_dir();
+       document_dir_ = get_document_dir(home_dir_);
+
+       string const abs_binary = abs_path_from_binary_name(command_line_arg0);
+       binary_dir_ = onlyPath(abs_binary);
+
+       // Is LyX being run in-place from the build tree?
+       boost::tie(build_support_dir_, system_support_dir_) =
+               get_build_dirs(abs_binary, top_build_dir_location);
+
+       if (build_support_dir_.empty())
+               system_support_dir_ =
+                       get_system_support_dir(abs_binary,
+                                              command_line_system_support_dir);
+
+       locale_dir_ = get_locale_dir(system_support_dir_);
+
+       string const default_user_support_dir =
+               get_default_user_support_dir(home_dir_);
+       boost::tie(user_support_dir_, explicit_user_support_dir_) =
+               get_user_support_dir(default_user_support_dir,
+                                    command_line_user_support_dir);
+
+       string const configure_script = addName(system_support(), "configure.py");
+       configure_command_ = "python " + quoteName(configure_script)
+                                      + with_version_suffix();
+
+       lyxerr[Debug::INIT]
+               << "<package>\n"
+               << "\tbinary_dir " << binary_dir() << '\n'
+               << "\tsystem_support " << system_support() << '\n'
+               << "\tbuild_support " << build_support() << '\n'
+               << "\tuser_support " << user_support() << '\n'
+               << "\tlocale_dir " << locale_dir() << '\n'
+               << "\tdocument_dir " << document_dir() << '\n'
+               << "\ttemp_dir " << temp_dir() << '\n'
+               << "\thome_dir " << home_dir() << '\n'
+               << "</package>\n" << std::endl;
+}
+
+
+namespace {
+
+// These next three functions contain the stuff that is substituted at
+// configuration-time.
+string const top_srcdir()
+{
+       static string const dir("%TOP_SRCDIR%");
+       return dir;
+}
+
+
+string const hardcoded_localedir()
+{
+       return string("%LOCALEDIR%");
+}
+
+
+string const hardcoded_system_support_dir()
+{
+       return string("%LYX_DIR%");
+}
+
+
+string const & with_version_suffix()
+{
+       static string const program_suffix("%PROGRAM_SUFFIX%");
+       static string const
+               with_version_suffix(" --with-version-suffix=%PROGRAM_SUFFIX%");
+       return program_suffix.empty() ? program_suffix : with_version_suffix;
+}
+
+} // namespace anon
+
+
+string const & Package::top_srcdir() const
+{
+       static string const dir("%TOP_SRCDIR%");
+       return dir;
+}
+
+
+namespace {
+
+bool check_command_line_dir(string const & dir,
+                           string const & file,
+                           string const & command_line_switch);
+
+string const extract_env_var_dir(string const & env_var);
+
+bool check_env_var_dir(string const & dir,
+                      string const & env_var);
+
+bool check_env_var_dir(string const & dir,
+                      string const & file,
+                      string const & env_var);
+
+string const relative_locale_dir();
+
+string const relative_system_support_dir();
+
+
+std::string const
+get_build_support_dir(std::string const & binary_dir,
+                     exe_build_dir_to_top_build_dir top_build_dir_location)
+{
+       string indirection;
+       switch (top_build_dir_location) {
+       case top_build_dir_is_one_level_up:
+               indirection = "../lib";
+               break;
+       case top_build_dir_is_two_levels_up:
+               indirection = "../../lib";
+               break;
+       }
+
+       return normalizePath(addPath(binary_dir, indirection));
+}
+
+
+std::pair<string, string> const
+get_build_dirs(string const & abs_binary,
+              exe_build_dir_to_top_build_dir top_build_dir_location)
+{
+       string const check_text = "Checking whether LyX is run in place...";
+
+       // We're looking for "Makefile" in a directory
+       //   binary_dir/../lib
+       // We're also looking for "chkconfig.ltx" in a directory
+       //   top_srcdir()/lib
+       // If both are found, then we're running LyX in-place.
+
+       // Note that the name of the lyx binary may be a symbolic link.
+       // If that is the case, then we follow the links too.
+       string binary = abs_binary;
+       while (true) {
+               // Try and find "lyxrc.defaults".
+               string const binary_dir = onlyPath(binary);
+               string const build_support_dir =
+                       get_build_support_dir(binary_dir, top_build_dir_location);
+
+               if (!fileSearch(build_support_dir, "Makefile").empty()) {
+                       // Try and find "chkconfig.ltx".
+                       string const system_support_dir =
+                               addPath(top_srcdir(), "lib");
+
+                       if (!fileSearch(system_support_dir, "chkconfig.ltx").empty()) {
+                               lyxerr[Debug::INIT] << check_text << " yes"
+                                                   << std::endl;
+                               return std::make_pair(build_support_dir, system_support_dir);
+                       }
+               }
+
+               // Check whether binary is a symbolic link.
+               // If so, resolve it and repeat the exercise.
+               if (!fs::symbolic_link_exists(binary))
+                       break;
+
+               string link;
+               if (readLink(binary, link, true)) {
+                       binary = link;
+               } else {
+                       // Unable to resolve the link.
+                       break;
+               }
+       }
+
+       lyxerr[Debug::INIT] << check_text << " no" << std::endl;
+       return std::make_pair(string(), string());
+}
+
+
+// Specification of document_dir_ may be reset by LyXRC,
+// but the default is fixed for a given OS.
+string const get_document_dir(string const & home_dir)
+{
+#if defined (USE_WINDOWS_PACKAGING)
+       (void)home_dir; // Silence warning about unused variable.
+       os::GetFolderPath win32_folder_path;
+       return win32_folder_path(os::GetFolderPath::PERSONAL);
+#else // Posix-like.
+       return home_dir;
+#endif
+}
+
+
+// The specification of home_dir_ is fixed for a given OS.
+// A typical example on Windows: "C:/Documents and Settings/USERNAME"
+// and on a Posix-like machine: "/home/USERNAME".
+string const get_home_dir()
+{
+#if defined (USE_WINDOWS_PACKAGING)
+       string const home_dir = getEnv("USERPROFILE");
+#else // Posix-like.
+       string const home_dir = getEnv("HOME");
+#endif
+
+       return os::internal_path(home_dir);
+}
+
+
+// Several sources are probed to ascertain the locale directory.
+// The only requirement is that the result is indeed a directory.
+string const get_locale_dir(string const & system_support_dir)
+{
+       // 1. Use the "LYX_LOCALEDIR" environment variable.
+       string path = extract_env_var_dir("LYX_LOCALEDIR");
+       if (!path.empty() && check_env_var_dir(path, "LYX_LOCALEDIR"))
+               return path;
+
+       // 2. Search for system_support_dir / <relative locale dir>
+       // The <relative locale dir> is OS-dependent. (On Unix, it will
+       // be "../locale/".)
+       path = normalizePath(addPath(system_support_dir, relative_locale_dir()));
+
+       if (fs::exists(path) && fs::is_directory(path))
+               return path;
+
+       // 3. Fall back to the hard-coded LOCALEDIR.
+       path = hardcoded_localedir();
+       if (fs::exists(path) && fs::is_directory(path))
+               return path;
+
+       return string();
+}
+
+
+// Specification of temp_dir_ may be reset by LyXRC,
+// but the default is fixed for a given OS.
+string const get_temp_dir()
+{
+#if defined (USE_WINDOWS_PACKAGING)
+       // Typical example: C:/TEMP/.
+       char path[PATH_MAX];
+       GetTempPath(PATH_MAX, path);
+       return os::internal_path(path);
+#else // Posix-like.
+       return "/tmp";
+#endif
+}
+
+
+void bail_out()
+{
+#ifndef CXX_GLOBAL_CSTD
+       using std::exit;
+#endif
+       exit(1);
+}
+
+
+// Extracts the absolute path from the foo of "-sysdir foo" or "-userdir foo"
+string const abs_path_from_command_line(string const & command_line)
+{
+       if (command_line.empty())
+               return string();
+
+       string const path = os::internal_path(command_line);
+       return os::is_absolute_path(path) ? path : makeAbsPath(path);
+}
+
+
+// Does the grunt work for abs_path_from_binary_name()
+string const get_binary_path(string const & exe)
+{
+#if defined (USE_WINDOWS_PACKAGING)
+       // The executable may have been invoked either with or
+       // without the .exe extension.
+       // Ensure that it is present.
+       string const as_internal_path = os::internal_path(exe);
+       string const exe_path = suffixIs(as_internal_path, ".exe") ?
+               as_internal_path : as_internal_path + ".exe";
+#else
+       string const exe_path = os::internal_path(exe);
+#endif
+       if (os::is_absolute_path(exe_path))
+               return exe_path;
+
+       // Two possibilities present themselves.
+       // 1. The binary is relative to the CWD.
+       string const abs_exe_path = makeAbsPath(exe_path);
+       if (fs::exists(abs_exe_path))
+               return abs_exe_path;
+
+       // 2. exe must be the name of the binary only and it
+       // can be found on the PATH.
+       string const exe_name = onlyFilename(exe_path);
+       if (exe_name != exe_path)
+               return string();
+
+       std::vector<string> const path = getEnvPath("PATH");
+       std::vector<string>::const_iterator it = path.begin();
+       std::vector<string>::const_iterator const end = path.end();
+       for (; it != end; ++it) {
+               // This will do nothing if *it is already absolute.
+               string const exe_dir = makeAbsPath(*it);
+
+               string const exe_path = addName(exe_dir, exe_name);
+               if (fs::exists(exe_path))
+                       return exe_path;
+       }
+
+       // Didn't find anything.
+       return string();
+}
+
+
+// Extracts the absolute path to the binary name received as argv[0].
+string const abs_path_from_binary_name(string const & exe)
+{
+       string const abs_binary = get_binary_path(exe);
+       if (abs_binary.empty()) {
+               lyxerr << bformat(_("Unable to determine the path to the "
+                                   "LyX binary from the command line %1$s"),
+                                 exe)
+                      << std::endl;
+               bail_out();
+       }
+       return abs_binary;
+}
+
+
+// A plethora of directories is searched to ascertain the system
+// lyxdir which is defined as the first directory to contain
+// "chkconfig.ltx".
+string const
+get_system_support_dir(string const & abs_binary,
+                 string const & command_line_system_support_dir)
+{
+       string const chkconfig_ltx = "chkconfig.ltx";
+
+       // searched_dirs is used for diagnostic purposes only in the case
+       // that "chkconfig.ltx" is not found.
+       std::list<string> searched_dirs;
+
+       // 1. Use the -sysdir command line parameter.
+       string path = abs_path_from_command_line(command_line_system_support_dir);
+       if (!path.empty()) {
+               searched_dirs.push_back(path);
+               if (check_command_line_dir(path, chkconfig_ltx, "-sysdir"))
+                       return path;
+       }
+
+       // 2. Use the "LYX_DIR_14x" environment variable.
+       path = extract_env_var_dir("LYX_DIR_14x");
+       if (!path.empty()) {
+               searched_dirs.push_back(path);
+               if (check_env_var_dir(path, chkconfig_ltx, "LYX_DIR_14x"))
+                       return path;
+       }
+
+       // 3. Search relative to the lyx binary.
+       // We're looking for "chkconfig.ltx" in a directory
+       //   OnlyPath(abs_binary) / <relative dir> / PACKAGE /
+       // PACKAGE is hardcoded in config.h. Eg "lyx" or "lyx-1.3.6cvs".
+       // <relative dir> is OS-dependent; on Unix, it will be "../share/".
+       string const relative_lyxdir = relative_system_support_dir();
+
+       // One subtlety to be aware of. The name of the lyx binary may be
+       // a symbolic link. If that is the case, then we follow the links too.
+       string binary = abs_binary;
+       while (true) {
+               // Try and find "chkconfig.ltx".
+               string const binary_dir = onlyPath(binary);
+
+               string const lyxdir =
+                       normalizePath(addPath(binary_dir, relative_lyxdir));
+               searched_dirs.push_back(lyxdir);
+
+               if (!fileSearch(lyxdir, chkconfig_ltx).empty()) {
+                       // Success! "chkconfig.ltx" has been found.
+                       return lyxdir;
+               }
+
+               // Check whether binary is a symbolic link.
+               // If so, resolve it and repeat the exercise.
+               if (!fs::symbolic_link_exists(binary))
+                       break;
+
+               string link;
+               if (readLink(binary, link, true)) {
+                       binary = link;
+               } else {
+                       // Unable to resolve the link.
+                       break;
+               }
+       }
+
+       // 4. Repeat the exercise on the directory itself.
+       string binary_dir = onlyPath(abs_binary);
+       while (true) {
+               // This time test whether the directory is a symbolic link
+               // *before* looking for "chkconfig.ltx".
+               // (We've looked relative to the original already.)
+               if (!fs::symbolic_link_exists(binary))
+                       break;
+
+               string link;
+               if (readLink(binary_dir, link, true)) {
+                       binary_dir = link;
+               } else {
+                       // Unable to resolve the link.
+                       break;
+               }
+
+               // Try and find "chkconfig.ltx".
+               string const lyxdir =
+                       normalizePath(addPath(binary_dir, relative_lyxdir));
+               searched_dirs.push_back(lyxdir);
+
+               if (!fileSearch(lyxdir, chkconfig_ltx).empty()) {
+                       // Success! "chkconfig.ltx" has been found.
+                       return lyxdir;
+               }
+       }
+
+       // 5. In desparation, try the hard-coded system support dir.
+       path = hardcoded_system_support_dir();
+       if (!fileSearch(path, chkconfig_ltx).empty())
+               return path;
+
+       // Everything has failed :-(
+       // So inform the user and exit.
+       string searched_dirs_str;
+       typedef std::list<string>::const_iterator iterator;
+       iterator const begin = searched_dirs.begin();
+       iterator const end = searched_dirs.end();
+       for (iterator it = begin; it != end; ++it) {
+               if (it != begin)
+                       searched_dirs_str += "\n\t";
+               searched_dirs_str += *it;
+       }
+
+       lyxerr << bformat(_("Unable to determine the system directory "
+                           "having searched\n"
+                           "\t%1$s\n"
+                           "Use the '-sysdir' command line parameter or "
+                           "set the environment variable LYX_DIR_14x to "
+                           "the LyX system directory containing the file "
+                           "`chkconfig.ltx'."),
+                         searched_dirs_str)
+              << std::endl;
+
+       bail_out();
+       // Keep the compiler happy.
+       return string();
+}
+
+
+// Returns the absolute path to the user lyxdir, together with a flag
+// indicating whether this directory was specified explicitly (as -userdir
+// or through an environment variable) or whether it was deduced.
+std::pair<string, bool> const
+get_user_support_dir(string const & default_user_support_dir,
+                    string const & command_line_user_support_dir)
+{
+       bool explicit_userdir = true;
+
+       // 1. Use the -userdir command line parameter.
+       string path =
+               abs_path_from_command_line(command_line_user_support_dir);
+       if (!path.empty())
+               return std::make_pair(path, explicit_userdir);
+
+       // 2. Use the LYX_USERDIR_14x environment variable.
+       path = extract_env_var_dir("LYX_USERDIR_14x");
+       if (!path.empty())
+               return std::make_pair(path, explicit_userdir);
+
+       // 3. Use the OS-dependent default_user_support_dir
+       explicit_userdir = false;
+       return std::make_pair(default_user_support_dir, explicit_userdir);
+}
+
+
+// $HOME/.lyx on POSIX but on Win32 it will be something like
+// "C:/Documents and Settings/USERNAME/Application Data/LyX"
+string const get_default_user_support_dir(string const & home_dir)
+{
+#if defined (USE_WINDOWS_PACKAGING)
+       (void)home_dir; // Silence warning about unused variable.
+
+       os::GetFolderPath win32_folder_path;
+       return addPath(win32_folder_path(os::GetFolderPath::APPDATA), PACKAGE);
+
+#elif defined (USE_MACOSX_PACKAGING)
+       (void)home_dir; // Silence warning about unused variable.
+
+       FSRef fsref;
+       OSErr const error_code =
+               FSFindFolder(kUserDomain, kApplicationSupportFolderType,
+                            kDontCreateFolder, &fsref);
+       if (error_code != 0)
+               return string();
+
+       char store[PATH_MAX + 1];
+       OSStatus const status_code =
+               FSRefMakePath(&fsref,
+                             reinterpret_cast<UInt8*>(store), PATH_MAX);
+       if (status_code != 0)
+               return string();
+
+       return addPath(reinterpret_cast<char const *>(store), PACKAGE);
+
+#else // USE_POSIX_PACKAGING
+       return addPath(home_dir, string(".") + PACKAGE);
+#endif
+}
+
+
+// Check that directory @c dir contains @c file.
+// Else emit a warning about an invalid @c command_line_switch.
+bool check_command_line_dir(string const & dir,
+                           string const & file,
+                           string const & command_line_switch)
+{
+       string const abs_path = fileSearch(dir, file);
+       if (abs_path.empty()) {
+               lyxerr << bformat(_("Invalid %1$s switch.\n"
+                                   "Directory %2$s does not contain %3$s."),
+                                 command_line_switch, dir, file)
+                      << std::endl;
+       }
+
+       return !abs_path.empty();
+}
+
+
+// The environment variable @c env_var expands to a (single) file path.
+string const extract_env_var_dir(string const & env_var)
+{
+       string const dir = os::internal_path(getEnv(env_var));
+       return dir.empty() ? dir : makeAbsPath(dir);
+}
+
+
+// Check that directory @c dir contains @c file.
+// Else emit a warning about an invalid @c env_var.
+bool check_env_var_dir(string const & dir,
+                      string const & file,
+                      string const & env_var)
+{
+       string const abs_path = fileSearch(dir, file);
+       if (abs_path.empty()) {
+               lyxerr << bformat(_("Invalid %1$s environment variable.\n"
+                                   "Directory %2$s does not contain %3$s."),
+                                 env_var, dir, file)
+                      << std::endl;
+       }
+
+       return !abs_path.empty();
+}
+
+
+// Check that directory @c dir is indeed a directory.
+// Else emit a warning about an invalid @c env_var.
+bool check_env_var_dir(string const & dir,
+                      string const & env_var)
+{
+       bool const success = (fs::exists(dir) && fs::is_directory(dir));
+
+       if (!success) {
+               // Put this string on a single line so that the gettext
+               // search mechanism in po/Makefile.in.in will register
+               // package.C.in as a file containing strings that need
+               // translation.
+               string const fmt =
+               _("Invalid %1$s environment variable.\n%2$s is not a directory.");
+
+               lyxerr << bformat(fmt, env_var, dir)
+                      << std::endl;
+       }
+
+       return success;
+}
+
+
+// The locale directory relative to the LyX system directory.
+string const relative_locale_dir()
+{
+#if defined (USE_WINDOWS_PACKAGING) || defined (USE_MACOSX_PACKAGING)
+       return "locale/";
+#else
+       return "../locale/";
+#endif
+}
+
+
+// The system lyxdir is relative to the directory containing the LyX binary.
+string const relative_system_support_dir()
+{
+       string result;
+
+#if defined (USE_WINDOWS_PACKAGING) || defined (USE_MACOSX_PACKAGING)
+       result = "../Resources/";
+#else // Posix-like.
+       result = addPath("../share/", PACKAGE);
+#endif
+
+       return result;
+}
+
+} // namespace anon
+
+} // namespace support
+} // namespace lyx
diff --git a/development/cmake/src/tex2lyx/CMakeLists.txt b/development/cmake/src/tex2lyx/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..897ea37
--- /dev/null
@@ -0,0 +1,41 @@
+project(tex2lyx)
+
+
+set(LINKED_FILES
+       ../FloatList.C
+       ../Floating.C
+       ../counters.C
+       ../lyxlayout.h
+       ../lyxlayout.C
+       ../lyxtextclass.C
+       ../lyxtextclass.h
+       ../lyxlex.C
+       ../lyxlex_pimpl.C
+)
+
+set(tex2lyx_SRCS 
+       ${LINKED_FILES}
+       Spacing.h 
+       boost.C 
+       context.C 
+       context.h 
+       gettext.C 
+       gettext.h 
+       lengthcommon.C 
+       lyxfont.C 
+       lyxfont.h 
+       texparser.C 
+       texparser.h 
+       tex2lyx.C 
+       tex2lyx.h 
+       preamble.C 
+       math.C 
+       table.C 
+       text.C 
+)
+
+add_executable(tex2lyx ${tex2lyx_SRCS})
+
+target_link_libraries(tex2lyx  support )
+
+
diff --git a/development/cmake/src/version.C.cmake b/development/cmake/src/version.C.cmake
new file mode 100755 (executable)
index 0000000..7e5e469
--- /dev/null
@@ -0,0 +1,21 @@
+/* -*- C++ -*- */
+/**
+ * \file version.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Jean-Marc Lasgouttes
+ *
+ * Full author contact details are available in file CREDITS.
+ *
+ * Warning! This file is autogenerated from version.C.in.
+ * All changes to this file will be lost.
+ */
+
+///
+char const * lyx_version = "@PACKAGE_VERSION@";
+///
+char const * lyx_release_date = "Thu, Jan 30, 2003";
+
+/// This is the version information shown by 'lyx -version'
+char const * lyx_version_info = "@VERSION_INFO@";