summaryrefslogtreecommitdiffstats
path: root/cmake/modules
diff options
context:
space:
mode:
authorRalf Habacker <ralf.habacker@freenet.de>2007-03-03 14:32:17 +0000
committerRalf Habacker <ralf.habacker@freenet.de>2007-03-03 14:32:17 +0000
commit36ebfd411b358fb4797d31d23f945e8f6844d15a (patch)
tree9c8982d1da82fdffea8d2a741dba82e927874869 /cmake/modules
parent4ceb86d29a68ebe52b20c8c090bc90c68a58f8c8 (diff)
* cmake: new directory, contains cmake build support.
See http://www.cmake.org for more informations. Currently only unix will be buildable because some win32 required files are still missing.
Diffstat (limited to 'cmake/modules')
-rw-r--r--cmake/modules/CPackInstallConfig.cmake44
-rw-r--r--cmake/modules/CheckPrototypeExists.cmake35
-rw-r--r--cmake/modules/CheckStructMember.cmake36
-rw-r--r--cmake/modules/FindGLIB.cmake42
-rw-r--r--cmake/modules/FindGNUWIN32.cmake42
-rw-r--r--cmake/modules/FindKDEWIN32.cmake84
-rw-r--r--cmake/modules/FindLibExpat.cmake51
-rw-r--r--cmake/modules/FindLibIconv.cmake52
-rw-r--r--cmake/modules/FindQt4.cmake1036
-rw-r--r--cmake/modules/MacroGetenvWinPath.cmake5
-rw-r--r--cmake/modules/MacroLibrary.cmake9
-rw-r--r--cmake/modules/MacroOptionalFindPackage.cmake22
-rw-r--r--cmake/modules/ProjectSourceGroup.cmake18
13 files changed, 1476 insertions, 0 deletions
diff --git a/cmake/modules/CPackInstallConfig.cmake b/cmake/modules/CPackInstallConfig.cmake
new file mode 100644
index 00000000..f8073a25
--- /dev/null
+++ b/cmake/modules/CPackInstallConfig.cmake
@@ -0,0 +1,44 @@
+
+if (DBUS_INSTALL_SYSTEM_LIBS)
+ if (MINGW)
+ if (DBUS_USE_EXPAT)
+ # expat
+ install_files(/bin FILES ${LIBEXPAT_LIBRARIES})
+ else (DBUS_USE_EXPAT)
+ # xml2
+ install_files(/bin FILES ${LIBXML2_LIBRARIES})
+ install_files(/bin FILES ${LIBICONV_LIBRARIES})
+ endif (DBUS_USE_EXPAT)
+ else (MINGW)
+ INCLUDE(InstallRequiredSystemLibraries)
+ endif (MINGW)
+endif (DBUS_INSTALL_SYSTEM_LIBS)
+
+SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "D-BUS For Windows")
+SET(CPACK_PACKAGE_VENDOR "D-BUS Windows Team")
+SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/../README")
+SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/../COPYING")
+# duplicated from VERSION
+SET(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
+SET(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR})
+SET(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH})
+#SET(CPACK_PACKAGE_INSTALL_DIRECTORY "dbus ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}")
+SET(CPACK_PACKAGE_INSTALL_DIRECTORY "dbus")
+IF(WIN32 AND NOT UNIX)
+ SET(CPACK_GENERATOR NSIS ZIP) # can be NSIS, STGZ, TBZ2, TGZ, TZ and ZIP
+ SET(CPACK_NSIS_COMPRESSOR "/SOLID lzma")
+ # There is a bug in NSI that does not handle full unix paths properly. Make
+ # sure there is at least one set of four (4) backlasshes.
+# SET(CPACK_PACKAGE_ICON "${CMake_SOURCE_DIR}/Utilities/Release\\\\InstallIcon.bmp")
+ SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\dbus-launch.bat")
+ SET(CPACK_NSIS_DISPLAY_NAME "D-Bus for Windows")
+ SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\sourceforge.net/projects/windbus")
+ SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\sourceforge.net/projects/windbus")
+ SET(CPACK_NSIS_CONTACT "me@my-personal-home-page.com")
+ SET(CPACK_NSIS_MODIFY_PATH ON)
+ELSE(WIN32 AND NOT UNIX)
+ SET(CPACK_STRIP_FILES "bin/MyExecutable")
+ SET(CPACK_SOURCE_STRIP_FILES "")
+ENDIF(WIN32 AND NOT UNIX)
+SET(CPACK_PACKAGE_EXECUTABLES "dbus-launch" "D-Bus Daemon")
+INCLUDE(CPack)
diff --git a/cmake/modules/CheckPrototypeExists.cmake b/cmake/modules/CheckPrototypeExists.cmake
new file mode 100644
index 00000000..da319f13
--- /dev/null
+++ b/cmake/modules/CheckPrototypeExists.cmake
@@ -0,0 +1,35 @@
+# - Check if the prototype for a function exists.
+# CHECK_PROTOTYPE_EXISTS (FUNCTION HEADER VARIABLE)
+#
+# FUNCTION - the name of the function you are looking for
+# HEADER - the header(s) where the prototype should be declared
+# VARIABLE - variable to store the result
+#
+# The following variables may be set before calling this macro to
+# modify the way the check is run:
+#
+# CMAKE_REQUIRED_FLAGS = string of compile command line flags
+# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
+# CMAKE_REQUIRED_INCLUDES = list of include directories
+
+INCLUDE(CheckCXXSourceCompiles)
+
+MACRO (CHECK_PROTOTYPE_EXISTS _SYMBOL _HEADER _RESULT)
+ SET(_INCLUDE_FILES)
+ FOREACH (it ${_HEADER})
+ SET(_INCLUDE_FILES "${_INCLUDE_FILES}#include <${it}>\n")
+ ENDFOREACH (it)
+
+ SET(_CHECK_PROTO_EXISTS_SOURCE_CODE "
+${_INCLUDE_FILES}
+int main()
+{
+#ifndef ${_SYMBOL}
+ int i = sizeof(&${_SYMBOL});
+#endif
+ return 0;
+}
+")
+ CHECK_CXX_SOURCE_COMPILES("${_CHECK_PROTO_EXISTS_SOURCE_CODE}" ${_RESULT})
+ENDMACRO (CHECK_PROTOTYPE_EXISTS _SYMBOL _HEADER _RESULT)
+
diff --git a/cmake/modules/CheckStructMember.cmake b/cmake/modules/CheckStructMember.cmake
new file mode 100644
index 00000000..fd5d3461
--- /dev/null
+++ b/cmake/modules/CheckStructMember.cmake
@@ -0,0 +1,36 @@
+# - Check if the given struct or class has the specified member variable
+# CHECK_STRUCT_MEMBER (STRUCT MEMBER HEADER VARIABLE)
+#
+# STRUCT - the name of the struct or class you are interested in
+# MEMBER - the member which existence you want to check
+# HEADER - the header(s) where the prototype should be declared
+# VARIABLE - variable to store the result
+#
+# The following variables may be set before calling this macro to
+# modify the way the check is run:
+#
+# CMAKE_REQUIRED_FLAGS = string of compile command line flags
+# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
+# CMAKE_REQUIRED_INCLUDES = list of include directories
+
+INCLUDE(CheckCXXSourceCompiles)
+
+MACRO (CHECK_STRUCT_MEMBER _STRUCT _MEMBER _HEADER _RESULT)
+ SET(_INCLUDE_FILES)
+ FOREACH (it ${_HEADER})
+ SET(_INCLUDE_FILES "${_INCLUDE_FILES}#include <${it}>\n")
+ ENDFOREACH (it)
+
+ SET(_CHECK_STRUCT_MEMBER_SOURCE_CODE "
+${_INCLUDE_FILES}
+int main()
+{
+ ${_STRUCT}* tmp;
+ tmp->${_MEMBER};
+ return 0;
+}
+")
+ CHECK_CXX_SOURCE_COMPILES("${_CHECK_STRUCT_MEMBER_SOURCE_CODE}" ${_RESULT})
+
+ENDMACRO (CHECK_STRUCT_MEMBER)
+
diff --git a/cmake/modules/FindGLIB.cmake b/cmake/modules/FindGLIB.cmake
new file mode 100644
index 00000000..1fdaee95
--- /dev/null
+++ b/cmake/modules/FindGLIB.cmake
@@ -0,0 +1,42 @@
+# - Try to find the GLIB library
+# Once done this will define
+#
+# GLIB_FOUND - system has GLIB
+# GLIB_INCLUDES - the GLIB include directories
+# GLIB_LIBRARIES - The libraries needed to use GLIB
+
+if (WIN32)
+
+INCLUDE(MacroGetenvWinPath)
+
+MACRO_GETENV_WIN_PATH(_program_FILES_DIR PROGRAMFILES)
+
+FIND_PATH(GLIB_INCLUDE_DIR glib.h
+ ${_program_FILES_DIR}/glib/include/glib-2.0
+)
+
+
+# search for GLIB in the default install directory for applications (default of (n)make install)
+FIND_LIBRARY(GLIB_LIBRARY NAMES glib-2.0
+ PATHS
+ ${_program_FILES_DIR}/glib/lib
+)
+
+if (GLIB_LIBRARY AND GLIB_INCLUDE_DIR)
+ set(GLIB_FOUND TRUE)
+ set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} ${GLIB_INCLUDES})
+ set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ${GLIB_LIBRARIES})
+
+endif (GLIB_LIBRARY AND GLIB_INCLUDE_DIR)
+
+if (GLIB_FOUND)
+ if (NOT GLIB_FIND_QUIETLY)
+ message(STATUS "Found GLIB: ${GLIB_LIBRARY}")
+ endif (NOT GLIB_FIND_QUIETLY)
+else (GLIB_FOUND)
+ if (GLIB_FIND_REQUIRED)
+ message(FATAL_ERROR "Could NOT find GLIB library")
+ endif (GLIB_FIND_REQUIRED)
+endif (GLIB_FOUND)
+
+endif (WIN32)
diff --git a/cmake/modules/FindGNUWIN32.cmake b/cmake/modules/FindGNUWIN32.cmake
new file mode 100644
index 00000000..4a2c6adc
--- /dev/null
+++ b/cmake/modules/FindGNUWIN32.cmake
@@ -0,0 +1,42 @@
+if (WIN32)
+
+# check if GNUWIN32_DIR is already set
+# (e.g. by command line argument or the calling script)
+if(NOT GNUWIN32_DIR)
+ # check for enviroment variable
+ file(TO_CMAKE_PATH "$ENV{GNUWIN32_DIR}" GNUWIN32_DIR)
+ if(NOT GNUWIN32_DIR)
+ # search in the default program install folder
+ file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _progFiles)
+ find_file(GNUWIN32_DIR_tmp gnuwin32 win32libs
+ PATHS
+ "${_progFiles}"
+ "C:/" "D:/" "E:/" "F:/" "G:/"
+ )
+ set(GNUWIN32_DIR ${GNUWIN32_DIR_tmp})
+ endif(NOT GNUWIN32_DIR)
+endif(NOT GNUWIN32_DIR)
+
+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/cmake/modules/FindKDEWIN32.cmake b/cmake/modules/FindKDEWIN32.cmake
new file mode 100644
index 00000000..eb0bfbbf
--- /dev/null
+++ b/cmake/modules/FindKDEWIN32.cmake
@@ -0,0 +1,84 @@
+# - Try to find the KDEWIN32 library
+# Once done this will define
+#
+# KDEWIN32_FOUND - system has KDEWIN32
+# KDEWIN32_INCLUDES - the KDEWIN32 include directories
+# KDEWIN32_LIBRARIES - The libraries needed to use KDEWIN32
+
+if (WIN32)
+
+INCLUDE(MacroGetenvWinPath)
+
+MACRO_GETENV_WIN_PATH(_program_FILES_DIR PROGRAMFILES)
+
+IF(NOT QT4_FOUND)
+FIND_PACKAGE(Qt4 REQUIRED)
+ENDIF(NOT QT4_FOUND)
+
+FIND_PATH(KDEWIN32_INCLUDE_DIR winposix_export.h
+ ${_program_FILES_DIR}/kdewin32/include
+)
+
+
+# at first find the kdewin32 library, this has to be compiled and installed before kdelibs/
+# search for kdewin32 in the default install directory for applications (default of (n)make install)
+
+FIND_LIBRARY(KDEWIN32_LIBRARY_RELEASE NAMES kdewin32
+ PATHS
+ ${_program_FILES_DIR}/kdewin32/lib
+)
+
+# msvc makes a difference between debug and release
+if(MSVC)
+ FIND_LIBRARY(KDEWIN32_LIBRARY_DEBUG NAMES kdewin32d
+ PATHS
+ ${_program_FILES_DIR}/kdewin32/lib
+ )
+ if(MSVC_IDE)
+ # the ide needs the debug and release version
+ if( NOT KDEWIN32_LIBRARY_DEBUG OR NOT KDEWIN32_LIBRARY_RELEASE)
+ message(FATAL_ERROR "\nCould NOT find the debug AND release version of the KDEWIN32 library.\nYou need to have both to use MSVC projects.\nPlease build and install both kdelibs/win/ libraries first.\n")
+ endif( NOT KDEWIN32_LIBRARY_DEBUG OR NOT KDEWIN32_LIBRARY_RELEASE)
+ SET(KDEWIN32_LIBRARY optimized ${KDEWIN32_LIBRARY_RELEASE} debug ${KDEWIN32_LIBRARY_DEBUG})
+ else(MSVC_IDE)
+ STRING(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_TOLOWER)
+ if(CMAKE_BUILD_TYPE_TOLOWER MATCHES debug)
+ set(KDEWIN32_LIBRARY ${KDEWIN32_LIBRARY_DEBUG})
+ else(CMAKE_BUILD_TYPE_TOLOWER MATCHES debug)
+ set(KDEWIN32_LIBRARY ${KDEWIN32_LIBRARY_RELEASE})
+ endif(CMAKE_BUILD_TYPE_TOLOWER MATCHES debug)
+ endif(MSVC_IDE)
+else(MSVC)
+ set(KDEWIN32_LIBRARY ${KDEWIN32_LIBRARY_RELEASE})
+endif(MSVC)
+
+# kdelibs/win/ has to be built before the rest of kdelibs/
+# eventually it will be moved out from kdelibs/
+if (KDEWIN32_LIBRARY AND KDEWIN32_INCLUDE_DIR)
+ set(KDEWIN32_FOUND TRUE)
+ # add the winsock2 library, using find_library or something like this would probably be better
+ set(KDEWIN32_LIBRARIES ${KDEWIN32_LIBRARY} user32 shell32 ws2_32)
+
+ if (MINGW)
+ #mingw compiler
+ set(KDEWIN32_INCLUDES ${KDEWIN32_INCLUDE_DIR} ${KDEWIN32_INCLUDE_DIR}/mingw ${QT_INCLUDES})
+ else (MINGW)
+ # msvc compiler
+ # add the MS SDK include directory if available
+ MACRO_GETENV_WIN_PATH(MSSDK_DIR MSSDK)
+ set(KDEWIN32_INCLUDES ${KDEWIN32_INCLUDE_DIR} ${KDEWIN32_INCLUDE_DIR}/msvc ${QT_INCLUDES} ${MSSDK_DIR})
+ endif (MINGW)
+
+endif (KDEWIN32_LIBRARY AND KDEWIN32_INCLUDE_DIR)
+
+if (KDEWIN32_FOUND)
+ if (NOT KDEWIN32_FIND_QUIETLY)
+ message(STATUS "Found KDEWIN32: ${KDEWIN32_LIBRARY}")
+ endif (NOT KDEWIN32_FIND_QUIETLY)
+else (KDEWIN32_FOUND)
+ if (KDEWIN32_FIND_REQUIRED)
+ message(FATAL_ERROR "Could NOT find KDEWIN32 library\nPlease build and install kdelibs/win/ first")
+ endif (KDEWIN32_FIND_REQUIRED)
+endif (KDEWIN32_FOUND)
+
+endif (WIN32)
diff --git a/cmake/modules/FindLibExpat.cmake b/cmake/modules/FindLibExpat.cmake
new file mode 100644
index 00000000..155083b5
--- /dev/null
+++ b/cmake/modules/FindLibExpat.cmake
@@ -0,0 +1,51 @@
+# - Try to find LIBEXPAT
+# Once done this will define
+#
+# LIBEXPAT_FOUND - system has LIBEXPAT
+# LIBEXPAT_INCLUDE_DIR - the LIBEXPAT include directory
+# LIBEXPAT_LIBRARIES - the libraries needed to use LIBEXPAT
+# LIBEXPAT_DEFINITIONS - Compiler switches required for using LIBEXPAT
+
+if (LIBEXPAT_INCLUDE_DIR AND LIBEXPAT_LIBRARIES)
+
+ # in cache already
+ SET(LIBEXPAT_FOUND TRUE)
+
+else (LIBEXPAT_INCLUDE_DIR AND LIBEXPAT_LIBRARIES)
+
+ IF (NOT WIN32)
+ # use pkg-config to get the directories and then use these values
+ # in the FIND_PATH() and FIND_LIBRARY() calls
+ INCLUDE(UsePkgConfig)
+ PKGCONFIG(LIBEXPAT-2.0 _LIBEXPATIncDir _LIBEXPATLinkDir _LIBEXPATLinkFlags _LiIconvCflags)
+ SET(LIBEXPAT_DEFINITIONS ${_LIBEXPATCflags})
+ ENDIF (NOT WIN32)
+
+ FIND_PATH(LIBEXPAT_INCLUDE_DIR expat.h
+ PATHS
+ ${_LIBEXPATIncDir}
+ PATH_SUFFIXES LIBEXPAT
+ )
+
+ FIND_LIBRARY(LIBEXPAT_LIBRARIES NAMES expat libexpat
+ PATHS
+ ${_LIBEXPATLinkDir}
+ )
+
+ if (LIBEXPAT_INCLUDE_DIR AND LIBEXPAT_LIBRARIES)
+ set(LIBEXPAT_FOUND TRUE)
+ endif (LIBEXPAT_INCLUDE_DIR AND LIBEXPAT_LIBRARIES)
+
+ if (LIBEXPAT_FOUND)
+ if (NOT LIBEXPAT_FIND_QUIETLY)
+ message(STATUS "Found libexpat: ${LIBEXPAT_LIBRARIES}")
+ endif (NOT LIBEXPAT_FIND_QUIETLY)
+ else (LIBEXPAT_FOUND)
+ if (LIBEXPAT_FIND_REQUIRED)
+ message(SEND_ERROR "Could NOT find libexpat")
+ endif (LIBEXPAT_FIND_REQUIRED)
+ endif (LIBEXPAT_FOUND)
+
+ MARK_AS_ADVANCED(LIBEXPAT_INCLUDE_DIR LIBEXPAT_LIBRARIES)
+
+endif (LIBEXPAT_INCLUDE_DIR AND LIBEXPAT_LIBRARIES)
diff --git a/cmake/modules/FindLibIconv.cmake b/cmake/modules/FindLibIconv.cmake
new file mode 100644
index 00000000..dac63449
--- /dev/null
+++ b/cmake/modules/FindLibIconv.cmake
@@ -0,0 +1,52 @@
+# - Try to find LibIconv
+# Once done this will define
+#
+# LIBICONV_FOUND - system has LibIconv
+# LIBICONV_INCLUDE_DIR - the LibIconv include directory
+# LIBICONV_LIBRARIES - the libraries needed to use LibIconv
+# LIBICONV_DEFINITIONS - Compiler switches required for using LibIconv
+
+if (LIBICONV_INCLUDE_DIR AND LIBICONV_LIBRARIES)
+
+ # in cache already
+ SET(LIBICONV_FOUND TRUE)
+
+else (LIBICONV_INCLUDE_DIR AND LIBICONV_LIBRARIES)
+
+ IF (NOT WIN32)
+ MESSAGE(FATAL_ERROR "Please set this to the correct values!")
+ # use pkg-config to get the directories and then use these values
+ # in the FIND_PATH() and FIND_LIBRARY() calls
+ INCLUDE(UsePkgConfig)
+ PKGCONFIG(libiconv-1.9 _LibIconvIncDir _LibIconvLinkDir _LibIconvLinkFlags _LiIconvCflags)
+ SET(LIBICONV_DEFINITIONS ${_LibIconvCflags})
+ ENDIF (NOT WIN32)
+
+ FIND_PATH(LIBICONV_INCLUDE_DIR iconv.h
+ PATHS
+ ${_LibIconvIncDir}
+ PATH_SUFFIXES libiconv
+ )
+
+ FIND_LIBRARY(LIBICONV_LIBRARIES NAMES iconv libiconv
+ PATHS
+ ${_LibIconvLinkDir}
+ )
+
+ if (LIBICONV_INCLUDE_DIR AND LIBICONV_LIBRARIES)
+ set(LIBICONV_FOUND TRUE)
+ endif (LIBICONV_INCLUDE_DIR AND LIBICONV_LIBRARIES)
+
+ if (LIBICONV_FOUND)
+ if (NOT LibIconv_FIND_QUIETLY)
+ message(STATUS "Found LibIconv: ${LIBICONV_LIBRARIES}")
+ endif (NOT LibIconv_FIND_QUIETLY)
+ else (LIBICONV_FOUND)
+ if (LibIconv_FIND_REQUIRED)
+ message(SEND_ERROR "Could NOT find LibIconv")
+ endif (LibIconv_FIND_REQUIRED)
+ endif (LIBICONV_FOUND)
+
+ MARK_AS_ADVANCED(LIBICONV_INCLUDE_DIR LIBICONV_LIBRARIES)
+
+endif (LIBICONV_INCLUDE_DIR AND LIBICONV_LIBRARIES)
diff --git a/cmake/modules/FindQt4.cmake b/cmake/modules/FindQt4.cmake
new file mode 100644
index 00000000..17d19a03
--- /dev/null
+++ b/cmake/modules/FindQt4.cmake
@@ -0,0 +1,1036 @@
+# - 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 )
+#
+# macro QT4_ADD_DBUS_INTERFACE(outfiles interface basename)
+# create a the interface header and implementation files with the
+# given basename from the given interface xml file and add it to
+# the list of sources
+#
+# macro QT4_ADD_DBUS_INTERFACES(outfiles inputfile ... )
+# create the interface header and implementation files
+# for all listed interface xml files
+# the name will be automatically determined from the name of the xml file
+#
+# macro QT4_ADD_DBUS_ADAPTOR(outfiles xmlfile parentheader parentclassname [basename] )
+# create a dbus adaptor (header and implementation file) from the xml file
+# describing the interface, and add it to the list of sources. The adaptor
+# forwards the calls to a parent class, defined in parentheader and named
+# parentclassname. The name of the generated files will be
+# <basename>adaptor.{cpp,h} where basename is the basename of the xml file.
+#
+# macro QT4_GENERATE_DBUS_INTERFACE( header)
+# generate the xml interface file from the given header
+#
+# 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_QTDBUS_FOUND True if QtDBus 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_QTDBUS_INCLUDE_DIR Path to "include/QtDBus"
+# 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 QtDBus library: QT_QTDBUS_LIBRARY
+# QT_QTDBUS_LIBRARY_RELEASE
+# QT_QTDBUS_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_DBUSCPP2XML_EXECUTABLE Where to find the dbuscpp2xml tool.
+# QT_DBUSXML2CPP_EXECUTABLE Where to find the dbusxml2cpp 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 QtUiTools
+ 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
+ )
+
+ # Set QT_QTDBUS_INCLUDE_DIR
+ FIND_PATH(QT_QTDBUS_INCLUDE_DIR QtDBus
+ PATHS
+ ${QT_INCLUDE_DIR}/QtDBus
+ ${QT_HEADERS_DIR}/QtDBus
+ 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_QTDBUS_LIBRARY_RELEASE "-framework QtDBus" CACHE STRING "The QtDBus library.")
+ SET(QT_QTDBUS_LIBRARY_DEBUG "-framework QtDBus" CACHE STRING "The QtDBus library.")
+
+
+ # WTF? why don't we have frameworks? :P
+ SET(QT_QTUITOOLS_LIBRARY_RELEASE "-L${QT_LIBRARY_DIR} -lQtUiTools" CACHE STRING "The QtUiTools library.")
+ SET(QT_QTUITOOLS_LIBRARY_DEBUG "-L${QT_LIBRARY_DIR} -lQtUiTools" CACHE STRING "The QtUiTools library.")
+ 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)
+
+ FIND_LIBRARY(QT_QTDBUS_LIBRARY_RELEASE NAMES QtDBus QtDBus4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
+ FIND_LIBRARY(QT_QTDBUS_LIBRARY_DEBUG NAMES QtDBus_debug QtDBus_debug4 QtDBusd4 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)
+ _QT4_ADJUST_LIB_VARS(QTDBUS)
+
+ #######################################
+ #
+ # 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_INTERNAL "${_moc_OUTPUT}" )
+ STRING(REGEX REPLACE ".*UIC<([^>]+).*" "\\1" QT_UIC_EXECUTABLE_INTERNAL "${_moc_OUTPUT}" )
+
+ FILE(TO_CMAKE_PATH "${QT_MOC_EXECUTABLE_INTERNAL}" QT_MOC_EXECUTABLE_INTERNAL)
+ FILE(TO_CMAKE_PATH "${QT_UIC_EXECUTABLE_INTERNAL}" QT_UIC_EXECUTABLE_INTERNAL)
+
+ SET(QT_MOC_EXECUTABLE ${QT_MOC_EXECUTABLE_INTERNAL} CACHE FILEPATH "The moc executable")
+ SET(QT_UIC_EXECUTABLE ${QT_UIC_EXECUTABLE_INTERNAL} CACHE FILEPATH "The uic executable")
+
+ FIND_PROGRAM(QT_UIC3_EXECUTABLE
+ NAMES uic3
+ PATHS ${QT_BINARY_DIR}
+ NO_DEFAULT_PATH
+ )
+
+ FIND_PROGRAM(QT_RCC_EXECUTABLE
+ NAMES rcc
+ PATHS ${QT_BINARY_DIR}
+ NO_DEFAULT_PATH
+ )
+
+ FIND_PROGRAM(QT_DBUSCPP2XML_EXECUTABLE
+ NAMES dbuscpp2xml
+ PATHS ${QT_BINARY_DIR}
+ NO_DEFAULT_PATH
+ )
+
+ FIND_PROGRAM(QT_DBUSXML2CPP_EXECUTABLE
+ NAMES dbusxml2cpp
+ 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(abs_infile ${infile} ABSOLUTE)
+
+ ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
+ COMMAND ${QT_MOC_EXECUTABLE}
+ ARGS ${moc_includes} -o ${outfile} ${abs_infile}
+ DEPENDS ${abs_infile})
+
+ MACRO_ADD_FILE_DEPENDENCIES(${abs_infile} ${outfile})
+ ENDMACRO (QT4_GENERATE_MOC)
+
+
+ # QT4_WRAP_CPP(outfiles inputfile ... )
+ # TODO perhaps add support for -D, -U and other minor options
+
+ MACRO (QT4_WRAP_CPP outfiles )
+ # get include dirs
+ QT4_GET_MOC_INC_DIRS(moc_includes)
+
+ 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)
+ GET_FILENAME_COMPONENT(infile ${it} ABSOLUTE)
+ 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)
+ GET_FILENAME_COMPONENT(infile ${it} ABSOLUTE)
+ 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_ADD_DBUS_INTERFACE _sources _interface _basename)
+ GET_FILENAME_COMPONENT(_infile ${_interface} ABSOLUTE)
+ SET(_header ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h)
+ SET(_impl ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp)
+ SET(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc)
+
+ ADD_CUSTOM_COMMAND(OUTPUT ${_impl} ${_header}
+ COMMAND ${QT_DBUSXML2CPP_EXECUTABLE} -m -p ${_basename} ${_infile}
+ DEPENDS ${_infile})
+
+ SET_SOURCE_FILES_PROPERTIES(${_impl} PROPERTIES SKIP_AUTOMOC TRUE)
+
+ QT4_GENERATE_MOC(${_header} ${_moc})
+
+ SET(${_sources} ${${_sources}} ${_impl} ${_header} ${_moc})
+ MACRO_ADD_FILE_DEPENDENCIES(${_impl} ${_moc})
+
+ ENDMACRO(QT4_ADD_DBUS_INTERFACE)
+
+
+ MACRO(QT4_ADD_DBUS_INTERFACES _sources)
+ FOREACH (_current_FILE ${ARGN})
+ GET_FILENAME_COMPONENT(_infile ${_current_FILE} ABSOLUTE)
+
+ # get the part before the ".xml" suffix
+ STRING(REGEX REPLACE "(.*[/\\.])?([^\\.]+)\\.xml" "\\2" _basename ${_current_FILE})
+ STRING(TOLOWER ${_basename} _basename)
+
+ QT4_ADD_DBUS_INTERFACE(${_sources} ${_infile} ${_basename}interface)
+ ENDFOREACH (_current_FILE)
+ ENDMACRO(QT4_ADD_DBUS_INTERFACES)
+
+
+ MACRO(QT4_GENERATE_DBUS_INTERFACE _header)
+ GET_FILENAME_COMPONENT(_in_file ${_header} ABSOLUTE)
+ GET_FILENAME_COMPONENT(_basename ${_header} NAME_WE)
+ SET(_target ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.xml)
+
+ ADD_CUSTOM_COMMAND(OUTPUT ${_target}
+ COMMAND ${QT_DBUSCPP2XML_EXECUTABLE} ${_in_file} > ${_target}
+ DEPENDS ${_in_file}
+ )
+ ENDMACRO(QT4_GENERATE_DBUS_INTERFACE)
+
+
+ MACRO(QT4_ADD_DBUS_ADAPTOR _sources _xml_file _include _parentClass)
+ GET_FILENAME_COMPONENT(_infile ${_xml_file} ABSOLUTE)
+
+ SET(_optionalBasename "${ARGV4}")
+ IF (_optionalBasename)
+ SET(_basename ${_optionalBasename} )
+ ELSE (_optionalBasename)
+ STRING(REGEX REPLACE "(.*[/\\.])?([^\\.]+)\\.xml" "\\2adaptor" _basename ${_infile})
+ STRING(TOLOWER ${_basename} _basename)
+ ENDIF (_optionalBasename)
+
+ SET(_optionalClassName "${ARGV5}")
+ SET(_header ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h)
+ SET(_impl ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp)
+ SET(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc)
+
+ IF(_optionalClassName)
+ ADD_CUSTOM_COMMAND(OUTPUT ${_impl} ${_header}
+ COMMAND ${QT_DBUSXML2CPP_EXECUTABLE} -m -a ${_basename} -c ${_optionalClassName} -i ${_include} -l ${_parentClass} ${_infile}
+ DEPENDS ${_infile}
+ )
+ ELSE(_optionalClassName)
+ ADD_CUSTOM_COMMAND(OUTPUT ${_impl} ${_header}
+ COMMAND ${QT_DBUSXML2CPP_EXECUTABLE} -m -a ${_basename} -i ${_include} -l ${_parentClass} ${_infile}
+ DEPENDS ${_infile}
+ )
+ ENDIF(_optionalClassName)
+
+ QT4_GENERATE_MOC(${_header} ${_moc})
+ SET_SOURCE_FILES_PROPERTIES(${_impl} PROPERTIES SKIP_AUTOMOC TRUE)
+ MACRO_ADD_FILE_DEPENDENCIES(${_impl} ${_moc})
+
+ SET(${_sources} ${${_sources}} ${_impl} ${_header} ${_moc})
+ ENDMACRO(QT4_ADD_DBUS_ADAPTOR)
+
+ MACRO(QT4_ADD_DBUS_ADAPTORS _sources)
+ message(FATAL_ERROR "There is a call to QT4_ADD_DBUS_ADAPTORS() in the CMakeLists.txt for '${ARGV0}', but this macro has been removed, please use QT4_ADD_DBUS_ADAPTOR and specify the include file and classname for the parent object implementing the code")
+ ENDMACRO(QT4_ADD_DBUS_ADAPTORS _sources)
+
+ 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")
+ SET(QT_QMAKE_EXECUTABLE "${QT_QMAKE_EXECUTABLE}-NOTFOUND" CACHE FILEPATH "Invalid qmake found" FORCE)
+ 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)
+
+ SET(QT_QMAKE_EXECUTABLE "${QT_QMAKE_EXECUTABLE}-NOTFOUND" CACHE FILEPATH "Invalid qmake found" FORCE)
+ IF(Qt4_FIND_REQUIRED)
+ IF(QT4_INSTALLED_VERSION_TOO_OLD)
+ MESSAGE(FATAL_ERROR "The installed Qt version ${QTVERSION} is too old, at least version ${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/cmake/modules/MacroGetenvWinPath.cmake b/cmake/modules/MacroGetenvWinPath.cmake
new file mode 100644
index 00000000..b18f7f63
--- /dev/null
+++ b/cmake/modules/MacroGetenvWinPath.cmake
@@ -0,0 +1,5 @@
+
+MACRO (MACRO_GETENV_WIN_PATH var name)
+ set(${var} $ENV{${name}})
+ STRING(REGEX REPLACE "\\\\" "/" ${var} "${${var}}")
+ENDMACRO (MACRO_GETENV_WIN_PATH var name)
diff --git a/cmake/modules/MacroLibrary.cmake b/cmake/modules/MacroLibrary.cmake
new file mode 100644
index 00000000..6523530c
--- /dev/null
+++ b/cmake/modules/MacroLibrary.cmake
@@ -0,0 +1,9 @@
+# - include MacroLibrary offers a collection of macros which extend the built-in cmake commands
+# OPTIONAL_FIND_PACKAGE( <name> [QUIT] )
+
+INCLUDE(MacroOptionalFindPackage)
+#INCLUDE(MacroAdditionalCleanFiles)
+#INCLUDE(MacroAddFileDependencies)
+#INCLUDE(MacroGetenvWinPath)
+#INCLUDE(MacroEnsureOutOfSourceBuild)
+
diff --git a/cmake/modules/MacroOptionalFindPackage.cmake b/cmake/modules/MacroOptionalFindPackage.cmake
new file mode 100644
index 00000000..70681312
--- /dev/null
+++ b/cmake/modules/MacroOptionalFindPackage.cmake
@@ -0,0 +1,22 @@
+# - MACRO_OPTIONAL_FIND_PACKAGE() combines FIND_PACKAGE() with an OPTION()
+# MACRO_OPTIONAL_FIND_PACKAGE( <name> [QUIT] )
+# This macro is a combination of OPTION() and FIND_PACKAGE(), it
+# works like FIND_PACKAGE(), but additionally it automatically creates
+# an option name WITH_<name>, which can be disabled via the cmake GUI.
+# or via -DWITH_<name>=OFF
+# The standard <name>_FOUND variables can be used in the same way
+# as when using the normal FIND_PACKAGE()
+
+MACRO (MACRO_OPTIONAL_FIND_PACKAGE _name )
+ OPTION(WITH_${_name} "Search for ${_name} package" ON)
+ if (WITH_${_name})
+ FIND_PACKAGE(${_name} ${ARGN})
+ else (WITH_${_name})
+ set(${_name}_FOUND)
+ set(${_name}_INCLUDE_DIR)
+ set(${_name}_INCLUDES)
+ set(${_name}_LIBRARY)
+ set(${_name}_LIBRARIES)
+ endif (WITH_${_name})
+ENDMACRO (MACRO_OPTIONAL_FIND_PACKAGE)
+
diff --git a/cmake/modules/ProjectSourceGroup.cmake b/cmake/modules/ProjectSourceGroup.cmake
new file mode 100644
index 00000000..713a67a1
--- /dev/null
+++ b/cmake/modules/ProjectSourceGroup.cmake
@@ -0,0 +1,18 @@
+# folders in the msvc projects
+# mode==flat : headers and ourses in no folders
+# mode==split : standard behavior of cmake, split headers and sources
+# mode== <other values" : code is in this folder
+macro(project_source_group mode sources headers)
+ #message(STATUS ${mode})
+ #message(STATUS ${sources} ${headers})
+ if(${mode} MATCHES "flat")
+ source_group("Source Files" Files)
+ source_group("Header Files" Files)
+ source_group("cmake" FILES CMakeLists.txt)
+ else(${mode} MATCHES "flat")
+ if(NOT ${mode} MATCHES "split")
+ source_group("${mode}" FILES ${${sources}} ${${headers}})
+ endif(NOT ${mode} MATCHES "split")
+ endif(${mode} MATCHES "flat")
+endmacro(project_source_group mode sources headers)
+