diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-02-17 00:43:50 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-02-17 00:43:50 +0000 |
commit | ceea23677c61f20759ae986bd77b0d5c4d673edb (patch) | |
tree | 3fcec1702eaf9c14d1dd736e594f5df08dab4001 /cmakemodules | |
download | kbfx-ceea23677c61f20759ae986bd77b0d5c4d673edb.tar.gz kbfx-ceea23677c61f20759ae986bd77b0d5c4d673edb.zip |
Added old KDE3 version of kbfx
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kbfx@1091549 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'cmakemodules')
30 files changed, 4721 insertions, 0 deletions
diff --git a/cmakemodules/COPYING-CMAKE-SCRIPTS b/cmakemodules/COPYING-CMAKE-SCRIPTS new file mode 100644 index 0000000..4b41776 --- /dev/null +++ b/cmakemodules/COPYING-CMAKE-SCRIPTS @@ -0,0 +1,22 @@ +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/cmakemodules/CheckCXXCompilerFlag.cmake b/cmakemodules/CheckCXXCompilerFlag.cmake new file mode 100644 index 0000000..43ea9a6 --- /dev/null +++ b/cmakemodules/CheckCXXCompilerFlag.cmake @@ -0,0 +1,21 @@ +# - Check whether the CXX compiler supports a given flag. +# CHECK_CXX_COMPILER_FLAG(FLAG VARIABLE) +# +# FLAG - the compiler flag +# VARIABLE - variable to store the result + +# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org> +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + + +INCLUDE(CheckCXXSourceCompiles) + +MACRO (CHECK_CXX_COMPILER_FLAG _FLAG _RESULT) + SET(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}") + SET(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}") + CHECK_CXX_SOURCE_COMPILES("int main() { return 0;}" ${_RESULT}) + SET (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}") +ENDMACRO (CHECK_CXX_COMPILER_FLAG) + diff --git a/cmakemodules/FindGNUWIN32.cmake b/cmakemodules/FindGNUWIN32.cmake new file mode 100644 index 0000000..8b999d9 --- /dev/null +++ b/cmakemodules/FindGNUWIN32.cmake @@ -0,0 +1,49 @@ + +# Copyright (c) 2006, Peter Kuemmel, <syntheticpp@yahoo.com> +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + + +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(FATAL_ERROR "Could NOT find GNUWIN32") + endif (GNUWIN32_FIND_REQUIRED) +endif (GNUWIN32_FOUND) + +endif (WIN32) + diff --git a/cmakemodules/FindKBFX.cmake b/cmakemodules/FindKBFX.cmake new file mode 100644 index 0000000..b865018 --- /dev/null +++ b/cmakemodules/FindKBFX.cmake @@ -0,0 +1,32 @@ +# - Try to find the KBFX package - +# If found the following will be defined +# +# KBFX_FOUND - KBFX package found on the system +# KBFX_INCLUDE_DIR - Directory of the KBFX package include files +# KBFX_LIBRARY - Where libkbfxplasma.so resides +# + +FIND_PATH(KBFX_INCLUDE_DIR kbfx/kbfxconfig.h + PATHS + ${INCLUDE_SEARCH_PATHES} +) + +FIND_LIBRARY(KBFX_LIBRARY NAMES kbfxplasma + PATHS + ${LIB_SEARCH_PATHES} +) + +IF(KBFX_INCLUDE_DIR AND KBFX_LIBRARY) + SET(KBFX_FOUND TRUE) +ENDIF(KBFX_INCLUDE_DIR AND KBFX_LIBRARY) + +IF(KBFX_FOUND) + IF(NOT KBFX_FIND_QUIETLY) + MESSAGE(STATUS "Found KBFX package: ${KBFX_LIBRARY}") + ENDIF(NOT KBFX_FIND_QUIETLY) +ELSE(KBFX_FOUND) + IF(KBFX_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could not find KBFX package! Please download and install KBFX from http://www.kbfx.org") + ENDIF(KBFX_FIND_REQUIRED) +ENDIF(KBFX_FOUND) + diff --git a/cmakemodules/FindKDE4.cmake b/cmakemodules/FindKDE4.cmake new file mode 100644 index 0000000..bbcd8d5 --- /dev/null +++ b/cmakemodules/FindKDE4.cmake @@ -0,0 +1,40 @@ +# Find KDE4 and provide all necessary variables and macros to compile software for it. +# It looks for KDE 4 in the following directories in the given order: +# - CMAKE_INSTALL_PREFIX +# - KDEDIR +# - /opt/kde4 +# - /opt/kde +# +# Please look in FindKDE4Internal.cmake and KDE4Macros.cmake for more information. +# They are installed with the KDE 4 libraries in $KDEDIR/share/apps/cmake/modules/. +# +# Author: Alexander Neundorf <neundorf@kde.org> +# Modified by PhobosK <phobosk@mail.kbfx.org> + +# For KDE4 kde-config has been renamed to kde4-config +FIND_PROGRAM(KDE4_KDECONFIG_EXECUTABLE NAMES kde4-config + PATHS + ${BIN_SEARCH_PATHES} + NO_DEFAULT_PATH) + +IF (NOT KDE4_KDECONFIG_EXECUTABLE) + FIND_PROGRAM(KDE4_KDECONFIG_EXECUTABLE NAMES kde4-config ) +ENDIF (NOT KDE4_KDECONFIG_EXECUTABLE) + +IF (KDE4_KDECONFIG_EXECUTABLE) + IF (KDE4_FIND_QUIETLY) + SET(_quiet QUIET) + ENDIF (KDE4_FIND_QUIETLY) + + IF (KDE4_FIND_REQUIRED) + SET(_req REQUIRED) + ENDIF (KDE4_FIND_REQUIRED) + + # use FindKDE4Internal.cmake to do the rest + FIND_PACKAGE(KDE4Internal ${_req} ${_quiet}) +ELSE (KDE4_KDECONFIG_EXECUTABLE) + IF (KDE4_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "ERROR: Could not find KDE4 kde4-config") + ENDIF (KDE4_FIND_REQUIRED) +ENDIF (KDE4_KDECONFIG_EXECUTABLE) + diff --git a/cmakemodules/FindKDE4Internal.cmake b/cmakemodules/FindKDE4Internal.cmake new file mode 100644 index 0000000..3747468 --- /dev/null +++ b/cmakemodules/FindKDE4Internal.cmake @@ -0,0 +1,839 @@ +# - Find the KDE4 include and library dirs, KDE preprocessors and define a some macros +# +# This module defines the following variables: +# +# KDE4_FOUND - set to TRUE if everything required for building KDE software has been found +# +# KDE4_DEFINITIONS - compiler definitions required for compiling KDE software +# KDE4_INCLUDE_DIR - the KDE 4 include directory +# KDE4_INCLUDES - all include directories required for KDE, i.e. +# KDE4_INCLUDE_DIR, but also the Qt4 include directories +# and other platform specific include directories +# KDE4_LIB_DIR - the directory where the KDE libraries are installed, +# intended to be used with LINK_DIRECTORIES() +# +# The following variables are defined for the various tools required to +# compile KDE software: +# +# KDE4_KCFGC_EXECUTABLE - the kconfig_compiler executable +# KDE4_MEINPROC_EXECUTABLE - the meinproc executable +# KDE4_MAKEKDEWIDGETS_EXECUTABLE - the makekdewidgets executable +# +# The following variables point to the location of the KDE libraries, +# but shouldn't be used directly: +# +# KDE4_KDECORE_LIBRARY - the kdecore library +# KDE4_KDEUI_LIBRARY - the kdeui library +# KDE4_KIO_LIBRARY - the kio library +# KDE4_KPARTS_LIBRARY - the kparts library +# KDE4_KUTILS_LIBRARY - the kutils library +# KDE4_KDE3SUPPORT_LIBRARY - the kde3support library +# KDE4_KXMLCORE_LIBRARY - the kxmlcore library +# KDE4_KHTML_LIBRARY - the khtml library +# KDE4_KJS_LIBRARY - the kjs library +# KDE4_KNEWSTUFF_LIBRARY - the knewstuff library +# KDE4_KDEPRINT_LIBRARY - the kdeprint library +# KDE4_KSPELL2_LIBRARY - the kspell2 library +# KDE4_KDNSSD_LIBRARY - the kdnssd library +# KDE4_PHONONCORE_LIBRARY - the phononcore library +# KDE4_PHONONUI_LIBRARY - the phononui library +# KDE4_KAUDIODEVICELIST_LIBRARY - the kaudiodevicelist library +# KDE4_KDEFX_LIBRARY - the kdefx library +# KDE4_THREADWEAVER_LIBRARY- the threadweaver library +# KDE4_SOLID_LIBRARY - the solid library +# KDE4_SOLIDIFACES_LIBRARY - the solidiface library +# KDE4_KNOTIFYCONFIG_LIBRARY- the knotifyconfig library +# KDE4_KROSSCORE_LIBRARY- the krosscore library +# KDE4_KTEXTEDITOR_LIBRARY - the ktexteditor library +# KDE4_KWALLETCLIENT_LIBRARY - the kwalletclient library +# +# Compared to the variables above, the following variables +# also contain all of the depending libraries, so the variables below +# should be used instead of the ones above: +# +# KDE4_KDECORE_LIBS - the kdecore library and all depending libraries +# KDE4_KDEUI_LIBS - the kdeui library and all depending libraries +# KDE4_KIO_LIBS - the kio library and all depending libraries +# KDE4_KPARTS_LIBS - the kparts library and all depending libraries +# KDE4_KUTILS_LIBS - the kutils library and all depending libraries +# KDE4_KDE3SUPPORT_LIBS - the kde3support library and all depending libraries +# KDE4_KXMLCORE_LIBS - the kxmlcore library and all depending libraries +# KDE4_KHTML_LIBS - the khtml library and all depending libraries +# KDE4_KJS_LIBS - the kjs library and all depending libraries +# KDE4_KNEWSTUFF_LIBS - the knewstuff library and all depending libraries +# KDE4_KDEPRINT_LIBS - the kdeprint library and all depending libraries +# KDE4_KSPELL2_LIBS - the kspell2 library and all depending libraries +# KDE4_KDNSSD_LIBS - the kdnssd library and all depending libraries +# KDE4_KDESU_LIBS - the kdesu library and all depending libraries +# KDE4_PHONONCORE_LIBS - the phononcore library and all depending librairies +# KDE4_PHONONUI_LIBRARIES - the phononui library and all depending librairies +# KDE4_KDEFX_LIBS - the kdefx library and all depending librairies +# KDE4_THREADWEAVER_LIBRARIES- the threadweaver library and all depending libraries +# KDE4_SOLID_LIBS - the solid library and all depending libraries +# KDE4_SOLIDIFACES_LIBS - the solid iface library and all depending libraries +# KDE4_KNOTIFYCONFIG_LIBS - the knotify config library and all depending libraries +# KDE4_KROSSCORE_LIBS - the kross core library and all depending libraries +# KDE4_KTEXTEDITOR_LIBS - the ktexteditor library and all depending libraries +# KDE4_KWALLETCLIENT_LIBS - the kwallet client library and all depending libraries +# +# This module defines a bunch of variables used as locations +# for install directories. They are all interpreted relative +# to CMAKE_INSTALL_PREFIX +# +# BIN_INSTALL_DIR - the directory where executables be installed (default is prefix/bin) +# SBIN_INSTALL_DIR - the directory where system executables will be installed (default is prefix/sbin) +# LIB_INSTALL_DIR - the directory where libraries will be installed (default is prefix/lib) +# CONFIG_INSTALL_DIR - the config file install dir +# DATA_INSTALL_DIR - the parent directory where applications can install their data +# HTML_INSTALL_DIR - the HTML install dir for documentation +# ICON_INSTALL_DIR - the icon install dir (default prefix/share/icons/) +# INFO_INSTALL_DIR - the kde info install dir (default prefix/info) +# KCFG_INSTALL_DIR - the install dir for kconfig files +# LOCALE_INSTALL_DIR - the install dir for translations +# MAN_INSTALL_DIR - the kde man page install dir (default prefix/man/) +# MIME_INSTALL_DIR - the install dir for the mimetype desktop files +# PLUGIN_INSTALL_DIR - the subdirectory relative to the install prefix where plugins will be installed (default is ${KDE4_LIB_INSTALL_DIR}/kde4) +# SERVICES_INSTALL_DIR - the install dir for service (desktop, protocol, ...) files +# SERVICETYPES_INSTALL_DIR - the install dir for servicestypes desktop files +# SOUND_INSTALL_DIR - the install dir for sound files +# TEMPLATES_INSTALL_DIR - the install dir for templates (Create new file...) +# WALLPAPER_INSTALL_DIR - the install dir for wallpapers +# KCONF_UPDATE_INSTALL_DIR - the kconf_update install dir +# XDG_APPS_DIR - the XDG apps dir +# XDG_DIRECTORY_DIR - the XDG directory +# DBUS_INTERFACES_DIR - the directory where dbus interfaces be installed (default is prefix/share/dbus-1/interfaces +# +# The following variables are provided, but are seem to be unused: +# LIBS_HTML_INSTALL_DIR /share/doc/HTML CACHE STRING "Is this still used ?") +# APPLNK_INSTALL_DIR /share/applnk CACHE STRING "Is this still used ?") +# +# The following user adjustable options are provided: +# +# KDE4_ENABLE_FINAL - enable KDE-style enable-final all-in-one-compilation +# KDE4_BUILD_TESTS - enable this to build the testcases +# KDE4_ENABLE_FPIE - enable it to use gcc Position Independent Executables feature +# +# It also adds the following macros (from KDE4Macros.cmake) +# KDE4_ADD_UI_FILES (SRCS_VAR file1.ui ... fileN.ui) +# Use this to add Qt designer ui files to your application/library. +# +# KDE4_ADD_UI3_FILES (SRCS_VAR file1.ui ... fileN.ui) +# Use this to add Qt designer ui files from Qt version 3 to your application/library. +# +# KDE4_ADD_KCFG_FILES (SRCS_VAR [GENERATE_MOC] file1.kcfgc ... fileN.kcfgc) +# Use this to add KDE config compiler files to your application/library. +# Use optional GENERATE_MOC to generate moc if you use signals in your kcfg files. +# +# KDE4_ADD_WIDGET_FILES (SRCS_VAR file1.widgets ... fileN.widgets) +# Use this to add widget description files for the makekdewidgets code generator +# for Qt Designer plugins. +# +# KDE4_AUTOMOC(file1 ... fileN) +# Call this if you want to have automatic moc file handling. +# This means if you include "foo.moc" in the source file foo.cpp +# a moc file for the header foo.h will be created automatically. +# You can set the property SKIP_AUTOMAKE using SET_SOURCE_FILES_PROPERTIES() +# to exclude some files in the list from being processed. +# If you don't want automoc, you can also use QT4_WRAP_CPP() or QT4_GENERATE_MOC() +# from FindQt4.cmake to have the moc files generated. This will be faster +# but require more manual work. +# +# KDE4_INSTALL_LIBTOOL_FILE ( subdir target ) +# This will create and install a simple libtool file for the +# given target. This might be required for other software. +# The libtool file will be install in subdir, relative to CMAKE_INSTALL_PREFIX . +# +# KDE4_CREATE_FINAL_FILES (filename_CXX filename_C file1 ... fileN) +# This macro is intended mainly for internal uses. +# It is used for enable-final. It will generate two source files, +# one for the C files and one for the C++ files. +# These files will have the names given in filename_CXX and filename_C. +# +# KDE4_ADD_PLUGIN ( name [WITH_PREFIX] file1 ... fileN ) +# Create a KDE plugin (KPart, kioslave, etc.) from the given source files. +# It supports KDE4_ENABLE_FINAL. +# If WITH_PREFIX is given, the resulting plugin will have the prefix "lib", otherwise it won't. +# It creates and installs an appropriate libtool la-file. +# +# KDE4_ADD_KDEINIT_EXECUTABLE (name [NOGUI] [RUN_UNINSTALLED] file1 ... fileN) +# Create a KDE application in the form of a module loadable via kdeinit. +# A library named kdeinit_<name> will be created and a small executable which links to it. +# It supports KDE4_ENABLE_FINAL +# If the executable has to be run from the buildtree (e.g. unit tests and code generators +# used later on when compiling), set the option RUN_UNINSTALLED. +# If the executable doesn't have a GUI, use the option NOGUI. By default on OS X +# application bundles are created, with the NOGUI option no bundles but simple executables +# are created. Currently it doesn't have any effect on other platforms. +# +# KDE4_ADD_EXECUTABLE (name [NOGUI] [RUN_UNINSTALLED] file1 ... fileN) +# Equivalent to ADD_EXECUTABLE(), but additionally adds support for KDE4_ENABLE_FINAL. +# If you don't need support for KDE4_ENABLE_FINAL, you can just use the +# normal ADD_EXECUTABLE(). +# If the executable has to be run from the buildtree (e.g. unit tests and code generators +# used later on when compiling), set the option RUN_UNINSTALLED. +# If the executable doesn't have a GUI, use the option NOGUI. By default on OS X +# application bundles are created, with the NOGUI option no bundles but simple executables +# are created. Currently it doesn't have any effect on other platforms. +# +# KDE4_ADD_LIBRARY (name [STATIC | SHARED | MODULE ] file1 ... fileN) +# Equivalent to ADD_LIBRARY(), but additionally it supports KDE4_ENABLE_FINAL +# and under Windows it adds a -DMAKE_<name>_LIB definition to the compilation. +# +# KDE4_INSTALL_ICONS( path theme) +# Installs all png and svgz files in the current directory to the icon +# directoy given in path, in the subdirectory for the given icon theme. +# +# KDE4_CREATE_HANDBOOK( docbookfile ) +# Create the handbook from the docbookfile (using meinproc) +# +# KDE4_INSTALL_HANDBOOK() +# Install the handbook documentation +# +# KDE4_CREATE_HTML_HANDBOOK( docbookfile ) +# Create HTML version of the handbook from the docbookfile (using meinproc) +# +# _KDE4_PLATFORM_INCLUDE_DIRS is used only internally +# _KDE4_PLATFORM_DEFINITIONS is used only internally +# +# +# Copyright (c) 2006, Alexander Neundorf <neundorf@kde.org> +# Copyright (c) 2006, Laurent Montel, <montel@kde.org> +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# +# Modified by PhobosK <phobosk@mail.kbfx.org> + + +INCLUDE (MacroEnsureVersion) + +cmake_minimum_required(VERSION 2.4.3 FATAL_ERROR) + +set(QT_MIN_VERSION "4.2.0") +#this line includes FindQt4.cmake, which searches the Qt library and headers +find_package(Qt4 REQUIRED) + +if (NOT QT_DBUSXML2CPP_EXECUTABLE) + message(FATAL_ERROR "Qt4 qdbusxml2cpp was not found. Make sure it has been built and installed by Qt") +endif (NOT QT_DBUSXML2CPP_EXECUTABLE) + + +# Perl is required for building KDE software, +find_package(Perl REQUIRED) + +# remove once we require cmake >= 2.4.4, then the REQUIRED flag is honored by FindPerl.cmake, Alex +if(NOT PERL_FOUND) + message(FATAL_ERROR "Perl was not found. Make sure it has installed on your system") +endif(NOT PERL_FOUND) + +include (MacroLibrary) +include (CheckCXXCompilerFlag) + +#add some KDE specific stuff + +# the following are directories where stuff will be installed to +set(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" ) + + +# this macro implements some very special logic how to deal with the cache +# by default the various install locations inherit their value from theit "parent" variable +# so if you set CMAKE_INSTALL_PREFIX, then EXEC_INSTALL_PREFIX, PLUGIN_INSTALL_DIR will +# calculate their value by appending subdirs to CMAKE_INSTALL_PREFIX +# this would work completely without using the cache. +# but if somebody wants e.g. a different EXEC_INSTALL_PREFIX this value has to go into +# the cache, otherwise it will be forgotten on the next cmake run. +# Once a variable is in the cache, it doesn't depend on its "parent" variables +# anymore and you can only change it by editing it directly. +# this macro helps in this regard, because as long as you don't set one of the +# variables explicitely to some location, it will always calculate its value from its +# parents. So modifying CMAKE_INSTALL_PREFIX later on will have the desired effect. +# But once you decide to set e.g. EXEC_INSTALL_PREFIX to some special location +# this will go into the cache and it will no longer depend on CMAKE_INSTALL_PREFIX. +macro(_SET_FANCY _var _value _comment) + if (NOT DEFINED ${_var}) + set(${_var} ${_value}) + else (NOT DEFINED ${_var}) + set(${_var} "${${_var}}" CACHE PATH "${_comment}") + endif (NOT DEFINED ${_var}) +endmacro(_SET_FANCY) + + +_set_fancy(SHARE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/share "Base directory for files which go to share/") +_set_fancy(EXEC_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} "Base directory for executables and libraries") + +_set_fancy(BIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/bin" "The install dir for executables (default ${EXEC_INSTALL_PREFIX}/bin)") +_set_fancy(SBIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/sbin" "The install dir for system executables (default ${EXEC_INSTALL_PREFIX}/sbin)") +_set_fancy(LIB_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX}" "The subdirectory relative to the install prefix where libraries will be installed (default is ${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX})") + +_set_fancy(LIBEXEC_INSTALL_DIR "${LIB_INSTALL_DIR}/kde4/libexec" "The subdirectory relative to the install prefix where libraries will be installed (default is ${LIB_INSTALL_DIR}/kde4/libexec)") +_set_fancy(PLUGIN_INSTALL_DIR "${LIB_INSTALL_DIR}/kde4" "The subdirectory relative to the install prefix where plugins will be installed (default is ${LIB_INSTALL_DIR}/kde4)") + +_set_fancy(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" "The subdirectory to the header prefix") +_set_fancy(CONFIG_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/config" "The config file install dir") +_set_fancy(DATA_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/apps" "The parent directory where applications can install their data") +_set_fancy(HTML_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/doc/HTML" "The HTML install dir for documentation") +_set_fancy(ICON_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/icons" "The icon install dir (default ${SHARE_INSTALL_PREFIX}/share/icons/)") +_set_fancy(KCFG_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/config.kcfg" "The install dir for kconfig files") +_set_fancy(LOCALE_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/locale" "The install dir for translations") +_set_fancy(MIME_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/mimelnk" "The install dir for the mimetype desktop files") +_set_fancy(SERVICES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/services" "The install dir for service (desktop, protocol, ...) files") +_set_fancy(SERVICETYPES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/servicetypes" "The install dir for servicestypes desktop files") +_set_fancy(SOUND_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/sounds" "The install dir for sound files") +_set_fancy(TEMPLATES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/templates" "The install dir for templates (Create new file...)") +_set_fancy(WALLPAPER_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/wallpapers" "The install dir for wallpapers") +_set_fancy(KCONF_UPDATE_INSTALL_DIR "${DATA_INSTALL_DIR}/kconf_update" "The kconf_update install dir") + # this one shouldn't be used anymore +_set_fancy(APPLNK_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/applnk" "Is this still used ?") +_set_fancy(AUTOSTART_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/autostart" "The install dir for autostart files") + +_set_fancy(XDG_APPS_DIR "${SHARE_INSTALL_PREFIX}/applications/kde" "The XDG apps dir") +_set_fancy(XDG_DIRECTORY_DIR "${SHARE_INSTALL_PREFIX}/desktop-directories" "The XDG directory") + +_set_fancy(SYSCONF_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/etc" "The kde sysconfig install dir (default /etc)") +_set_fancy(MAN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/man" "The kde man install dir (default ${CMAKE_INSTALL_PREFIX}/man/)") +_set_fancy(INFO_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/info" "The kde info install dir (default ${CMAKE_INSTALL_PREFIX}/info)") +_set_fancy(DBUS_INTERFACES_DIR "${SHARE_INSTALL_PREFIX}/dbus-1/interfaces" "The kde dbus interfaces install dir (default ${SHARE_INSTALL_PREFIX}/dbus-1/interfaces)") +# _set_fancy(LIBEXEC_INSTALL_DIR "${LIB_INSTALL_DIR}/kde4/libexec" "The subdirectory relative to the install prefix where libraries will be installed (default is /lib)") +# _set_fancy(PLUGIN_INSTALL_DIR "${LIB_INSTALL_DIR}/kde4/modules" "The subdirectory relative to the install prefix where plugins will be installed (default is ${KDE4_LIB_INSTALL_DIR}/kde4)") + + +################################# + + +# get the directory of the current file, used later on in the file +get_filename_component( kde_cmake_module_dir ${CMAKE_CURRENT_LIST_FILE} PATH) + +# the following are directories where stuff will be installed to + + +option(KDE4_ENABLE_FINAL "Enable final all-in-one compilation") +option(KDE4_BUILD_TESTS "Build the tests") + +if( KDE4_ENABLE_FINAL) + add_definitions(-DKDE_USE_FINAL) +endif(KDE4_ENABLE_FINAL) + +#Position-Independent-Executable is a feature of Binutils, Libc, and GCC that creates an executable +#which is something between a shared library and a normal executable. +#Programs compiled with these features appear as ?shared object? with the file command. +#info from "http://www.linuxfromscratch.org/hlfs/view/unstable/glibc/chapter02/pie.html" +option(KDE4_ENABLE_FPIE "Enable platform supports PIE linking") + +#now try to find some kde stuff + +#are we trying to compile kdelibs ? +#then enter bootstrap mode +if(EXISTS ${CMAKE_SOURCE_DIR}/kdecore/kernel/kglobal.h) + + message(STATUS "Building kdelibs...") + + set(KDE4_INCLUDE_DIR ${CMAKE_SOURCE_DIR}) + set(KDE4_KDECORE_LIBS ${QT_QTCORE_LIBRARY} kdecore) + set(KDE4_KDEUI_LIBS ${KDE4_KDECORE_LIBS} kdeui) + set(KDE4_KIO_LIBS ${KDE4_KDEUI_LIBS} kio) + set(KDE4_KPARTS_LIBS ${KDE4_KIO_LIBS} kparts) + set(KDE4_KUTILS_LIBS ${KDE4_KIO_LIBS} kutils) + set(KDE4_KDEFX_LIBS ${KDE4_KDEFX_LIBS} kdefx) + + + set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin ) + + if (WIN32) + set(LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH} ) + # CMAKE_CFG_INTDIR is the output subdirectory created e.g. by XCode and MSVC + set(KDE4_KCFGC_EXECUTABLE ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/kconfig_compiler ) + set(KDE4_MEINPROC_EXECUTABLE ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/meinproc ) + set(KDE4_MAKEKDEWIDGETS_EXECUTABLE ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/makekdewidgets ) + else (WIN32) + set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib ) + set(KDE4_KCFGC_EXECUTABLE ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/kconfig_compiler.shell ) + set(KDE4_MEINPROC_EXECUTABLE ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/meinproc.shell ) + set(KDE4_MAKEKDEWIDGETS_EXECUTABLE ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/makekdewidgets.shell ) + endif (WIN32) + + set(KDE4_LIB_DIR ${LIBRARY_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}) + + # when building kdelibs, make the kcfg rules depend on the binaries... + set( _KDE4_KCONFIG_COMPILER_DEP kconfig_compiler) + set( _KDE4_MAKEKDEWIDGETS_DEP makekdewidgets) + set( _KDE4_MEINPROC_EXECUTABLE_DEP meinproc) + + set(KDE4_INSTALLED_VERSION_OK TRUE) + +else(EXISTS ${CMAKE_SOURCE_DIR}/kdecore/kernel/kglobal.h) + + # ... but NOT otherwise + set( _KDE4_KCONFIG_COMPILER_DEP) + set( _KDE4_MAKEKDEWIDGETS_DEP) + set( _KDE4_MEINPROC_EXECUTABLE_DEP) + + # Check the version of kde. KDE4_KDECONFIG_EXECUTABLE was set by FindKDE4 + exec_program(${KDE4_KDECONFIG_EXECUTABLE} ARGS "--version" OUTPUT_VARIABLE kdeconfig_output ) + + string(REGEX MATCH "KDE: [0-9]+\\.[0-9]+\\.[0-9]+" KDEVERSION "${kdeconfig_output}") + if (KDEVERSION) + + string(REGEX REPLACE "^KDE: " "" KDEVERSION "${KDEVERSION}") + + # we need at least this version: + if (NOT KDE_MIN_VERSION) + set(KDE_MIN_VERSION "3.9.0") + endif (NOT KDE_MIN_VERSION) + + #message(STATUS "KDE_MIN_VERSION=${KDE_MIN_VERSION} found ${KDEVERSION}") + + macro_ensure_version( ${KDE_MIN_VERSION} ${KDEVERSION} KDE4_INSTALLED_VERSION_OK ) + + else (KDEVERSION) + message(FATAL_ERROR "Couldn't parse KDE version string from the kde4-config output:\n${kdeconfig_output}") + endif (KDEVERSION) + + + set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib ) + + # this file contains all dependencies of all libraries of kdelibs, Alex + include(${kde_cmake_module_dir}/KDELibsDependencies.cmake) + + find_library(KDE4_KDECORE_LIBRARY NAMES kdecore PATHS ${KDE4_LIB_INSTALL_DIR} NO_DEFAULT_PATH ) + set(KDE4_KDECORE_LIBS ${kdecore_LIB_DEPENDS} ${KDE4_KDECORE_LIBRARY} ) + + find_library(KDE4_KDEFX_LIBRARY NAMES kdefx PATHS ${KDE4_LIB_INSTALL_DIR} NO_DEFAULT_PATH ) + set(KDE4_KDEFX_LIBS ${kdefx_LIB_DEPENDS} ${KDE4_KDEFX_LIBRARY} ) + + find_library(KDE4_KDEUI_LIBRARY NAMES kdeui PATHS ${KDE4_LIB_INSTALL_DIR} NO_DEFAULT_PATH ) + set(KDE4_KDEUI_LIBS ${kdeui_LIB_DEPENDS} ${KDE4_KDEUI_LIBRARY} ) + + find_library(KDE4_KIO_LIBRARY NAMES kio PATHS ${KDE4_LIB_INSTALL_DIR} NO_DEFAULT_PATH ) + set(KDE4_KIO_LIBS ${kio_LIB_DEPENDS} ${KDE4_KIO_LIBRARY} ) + + find_library(KDE4_KPARTS_LIBRARY NAMES kparts PATHS ${KDE4_LIB_INSTALL_DIR} NO_DEFAULT_PATH ) + set(KDE4_KPARTS_LIBS ${kparts_LIB_DEPENDS} ${KDE4_KPARTS_LIBRARY} ) + + find_library(KDE4_KUTILS_LIBRARY NAMES kutils PATHS ${KDE4_LIB_INSTALL_DIR} NO_DEFAULT_PATH ) + set(KDE4_KUTILS_LIBS ${kutils_LIB_DEPENDS} ${KDE4_KUTILS_LIBRARY} ) + + find_library(KDE4_KDE3SUPPORT_LIBRARY NAMES kde3support PATHS ${KDE4_LIB_INSTALL_DIR} NO_DEFAULT_PATH ) + set(KDE4_KDE3SUPPORT_LIBS ${kde3support_LIB_DEPENDS} ${KDE4_KDE3SUPPORT_LIBRARY} ) + + find_library(KDE4_KHTML_LIBRARY NAMES khtml PATHS ${KDE4_LIB_INSTALL_DIR} NO_DEFAULT_PATH ) + set(KDE4_KHTML_LIBS ${khtml_LIB_DEPENDS} ${KDE4_KHTML_LIBRARY} ) + + find_library(KDE4_KJS_LIBRARY NAMES kjs PATHS ${KDE4_LIB_INSTALL_DIR} NO_DEFAULT_PATH ) + set(KDE4_KJS_LIBS ${kjs_LIB_DEPENDS} ${KDE4_KJS_LIBRARY} ) + + find_library(KDE4_KNEWSTUFF_LIBRARY NAMES knewstuff PATHS ${KDE4_LIB_INSTALL_DIR} NO_DEFAULT_PATH ) + set(KDE4_KNEWSTUFF_LIBS ${knewstuff_LIB_DEPENDS} ${KDE4_KNEWSTUFF_LIBRARY} ) + + find_library(KDE4_KDEPRINT_LIBRARY NAMES kdeprint PATHS ${KDE4_LIB_INSTALL_DIR} NO_DEFAULT_PATH ) + set(KDE4_KDEPRINT_LIBS ${kdeprint_LIB_DEPENDS} ${KDE4_KDEPRINT_LIBRARY} ) + + find_library(KDE4_KSPELL2_LIBRARY NAMES kspell2 PATHS ${KDE4_LIB_INSTALL_DIR} NO_DEFAULT_PATH ) + set(KDE4_KSPELL2_LIBS ${kspell2_LIB_DEPENDS} ${KDE4_KSPELL2_LIBRARY} ) + + if (UNIX) + find_library(KDE4_KDESU_LIBRARY NAMES kdesu PATHS ${KDE4_LIB_INSTALL_DIR} NO_DEFAULT_PATH ) + set(KDE4_KDESU_LIBS ${kdesu_LIB_DEPENDS} ${KDE4_KDESU_LIBRARY} ) + endif (UNIX) + + find_library(KDE4_KDNSSD_LIBRARY NAMES kdnssd PATHS ${KDE4_LIB_INSTALL_DIR} NO_DEFAULT_PATH ) + set(KDE4_KDNSSD_LIBS ${kdnssd_LIB_DEPENDS} ${KDE4_KDNSSD_LIBRARY} ) + + # now the KDE library directory, kxmlcore is new with KDE4 + find_library(KDE4_KXMLCORE_LIBRARY NAMES kxmlcore PATHS ${KDE4_LIB_INSTALL_DIR} ) + set(KDE4_KXMLCORE_LIBRARIES ${kxmlcore_LIB_DEPENDS} ${KDE4_KXMLCORE_LIBRARY} ) + + find_library(KDE4_PHONONCORE_LIBRARY NAMES phononcore PATHS ${KDE4_LIB_INSTALL_DIR} NO_DEFAULT_PATH ) + set(KDE4_PHONONCORE_LIBS ${phononcore_LIB_DEPENDS} ${KDE4_PHONONCORE_LIBRARY} ) + + find_library(KDE4_PHONONUI_LIBRARY NAMES phononui PATHS ${KDE4_LIB_INSTALL_DIR} NO_DEFAULT_PATH ) + set(KDE4_PHONONUI_LIBS ${phononui_LIB_DEPENDS} ${KDE4_PHONONUI_LIBRARY} ) + + find_library(KDE4_KAUDIODEVICELIST_LIBRARY NAMES kaudiodevicelist PATHS ${KDE4_LIB_INSTALL_DIR} NO_DEFAULT_PATH ) + set(KDE4_KAUDIODEVICELIST_LIBS ${kaudiodevicelist_LIB_DEPENDS} ${KDE4_KAUDIODEVICELIST_LIBRARY} ) + + find_library(KDE4_SOLID_LIBRARY NAMES solid PATHS ${KDE4_LIB_INSTALL_DIR} ) + set(KDE4_SOLID_LIBS ${solid_LIB_DEPENDS} ${KDE4_SOLID_LIBRARY} ) + + find_library(KDE4_SOLIDIFACES_LIBRARY NAMES solidifaces PATHS ${KDE4_LIB_INSTALL_DIR} ) + set(KDE4_SOLIDIFACES_LIBS ${solidifaces_LIB_DEPENDS} ${KDE4_SOLIDIFACES_LIBRARY} ) + + find_library(KDE4_THREADWEAVER_LIBRARY NAMES threadweaver PATHS ${KDE4_LIB_INSTALL_DIR} ) + set(KDE4_THREADWEAVER_LIBRARIES ${threadweaver_LIB_DEPENDS} ${KDE4_THREADWEAVER_LIBRARY} ) + + find_library(KDE4_KNOTIFYCONFIG_LIBRARY NAMES knotifyconfig PATHS ${KDE4_LIB_INSTALL_DIR} ) + set(KDE4_KNOTIFYCONFIG_LIBS ${knotifyconfig_LIB_DEPENDS} ${KDE4_KNOTIFYCONFIG_LIBRARY} ) + + find_library(KDE4_KROSSCORE_LIBRARY NAMES krosscore PATHS ${KDE4_LIB_INSTALL_DIR} ) + set(KDE4_KROSSCORE_LIBS ${krosscore_LIB_DEPENDS} ${KDE4_KROSSCORE_LIBRARY} ) + + find_library(KDE4_KTEXTEDITOR_LIBRARY NAMES ktexteditor PATHS ${KDE4_LIB_INSTALL_DIR} ) + set(KDE4_KTEXTEDITOR_LIBS ${ktexteditor_LIB_DEPENDS} ${KDE4_KTEXTEDITOR_LIBRARY} ) + + find_library(KDE4_KWALLETCLIENT_LIBRARY NAMES kwalletclient PATHS ${KDE4_LIB_INSTALL_DIR} ) + set(KDE4_KWALLETCLIENT_LIBS ${kwalletclient_LIB_DEPENDS} ${KDE4_KWALLETCLIENT_LIBRARY} ) + + get_filename_component(KDE4_LIB_DIR ${KDE4_KDECORE_LIBRARY} PATH ) + + + # at first the KDE include direcory + # kpassworddialog.h is new with KDE4 + find_path(KDE4_INCLUDE_DIR kpassworddialog.h + ${KDE4_INCLUDE_INSTALL_DIR} + $ENV{KDEDIR}/include + /opt/kde/include + /opt/kde4/include + /usr/local/include + /usr/include/ + /usr/include/kde + /usr/local/include/kde + ) + + find_program(KDE4_KCFGC_EXECUTABLE NAME kconfig_compiler PATHS + ${KDE4_BIN_INSTALL_DIR} + $ENV{KDEDIR}/bin + /opt/kde/bin + /opt/kde4/bin + NO_DEFAULT_PATH + ) + find_program(KDE4_KCFGC_EXECUTABLE NAME kconfig_compiler ) + + find_program(KDE4_MEINPROC_EXECUTABLE NAME meinproc PATHS + ${KDE4_BIN_INSTALL_DIR} + $ENV{KDEDIR}/bin + /opt/kde/bin + /opt/kde4/bin + NO_DEFAULT_PATH + ) + find_program(KDE4_MEINPROC_EXECUTABLE NAME meinproc ) + + find_program(KDE4_MAKEKDEWIDGETS_EXECUTABLE NAME makekdewidgets PATHS + ${KDE4_BIN_INSTALL_DIR} + $ENV{KDEDIR}/bin + /opt/kde/bin + /opt/kde4/bin + NO_DEFAULT_PATH + ) + find_program(KDE4_MAKEKDEWIDGETS_EXECUTABLE NAME makekdewidgets ) + +endif(EXISTS ${CMAKE_SOURCE_DIR}/kdecore/kernel/kglobal.h) + + +##################### and now the platform specific stuff ############################ + +# Set a default build type for single-configuration +# CMake generators if no build type is set. +if (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE RelWithDebInfo) +endif (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE) + + +if (WIN32) + + if(CYGWIN) + message(FATAL_ERROR "Support for Cygwin NOT yet implemented, please edit FindKDE4.cmake to enable it") + endif(CYGWIN) + + find_package(KDEWIN32 REQUIRED) + + # is GnuWin32 required or does e.g. Visual Studio provide an own implementation? + #find_package(GNUWIN32 REQUIRED) + find_package(GNUWIN32) + + set( _KDE4_PLATFORM_INCLUDE_DIRS ${KDEWIN32_INCLUDES} ${GNUWIN32_INCLUDE_DIR}) + + # if we are compiling kdelibs, add KDEWIN32_LIBRARIES explicitely, + # otherwise they come from KDELibsDependencies.cmake, Alex + if(EXISTS ${CMAKE_SOURCE_DIR}/kdecore/kernel/kglobal.h) + set( KDE4_KDECORE_LIBS ${KDE4_KDECORE_LIBS} ${KDEWIN32_LIBRARIES} ) + endif(EXISTS ${CMAKE_SOURCE_DIR}/kdecore/kernel/kglobal.h) + + # windows, mingw + if(MINGW) + #hmmm, something special to do here ? + endif(MINGW) + + # windows, microsoft compiler + if(MSVC) + set( _KDE4_PLATFORM_DEFINITIONS -DKDE_FULL_TEMPLATE_EXPORT_INSTANTIATION -DWIN32_LEAN_AND_MEAN -DUNICODE ) + # C4250: 'class1' : inherits 'class2::member' via dominance + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd4250" ) + # C4251: 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2' + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd4251" ) + if(CMAKE_COMPILER_2005) + # to avoid a lot of deprecated warnings + add_definitions( -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE ) + # 'identifier' : no suitable definition provided for explicit template instantiation request + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd4661" ) + endif(CMAKE_COMPILER_2005) + endif(MSVC) + + + # for visual studio IDE set the path correctly for custom commands + # maybe under windows bat-files should be generated for running apps during the build + if(MSVC_IDE) + get_filename_component(PERL_LOCATION "${PERL_EXECUTABLE}" PATH) + file(TO_NATIVE_PATH "${PERL_LOCATION}" PERL_PATH_WINDOWS) + file(TO_NATIVE_PATH "${QT_BINARY_DIR}" QT_BIN_DIR_WINDOWS) + set(CMAKE_MSVCIDE_RUN_PATH "${PERL_PATH_WINDOWS}\;${QT_BIN_DIR_WINDOWS}" + CACHE STATIC "MSVC IDE Run path" FORCE) + endif(MSVC_IDE) + +endif (WIN32) + + +# also use /usr/local by default under UNIX, including Mac OS X +if (UNIX) + option(KDE4_USE_ALWAYS_FULL_RPATH "If set to TRUE, also libs and plugins will be linked with the full RPATH, which will usually make them work better, but make install will take longer." OFF) + + link_directories(/usr/local/lib) + set( _KDE4_PLATFORM_INCLUDE_DIRS /usr/local/include ) + + # the rest is RPATH handling + # here the defaults are set + # which are partly overwritten in kde4_handle_rpath_for_library() + # and kde4_handle_rpath_for_executable(), both located in KDE4Macros.cmake, Alex + if (APPLE) + set(CMAKE_INSTALL_NAME_DIR ${LIB_INSTALL_DIR}) + else (APPLE) + # add our LIB_INSTALL_DIR to the RPATH and use the RPATH figured out by cmake when compiling + set(CMAKE_INSTALL_RPATH ${LIB_INSTALL_DIR} ) + set(CMAKE_SKIP_BUILD_RPATH TRUE) + set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) + set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + endif (APPLE) +endif (UNIX) + + +# UNIX, except OS X +if (UNIX AND NOT APPLE) + # Done by FindQt4.cmake already + #find_package(X11 REQUIRED) + # UNIX has already set _KDE4_PLATFORM_INCLUDE_DIRS, so append + set(_KDE4_PLATFORM_INCLUDE_DIRS ${_KDE4_PLATFORM_INCLUDE_DIRS} ${X11_INCLUDE_DIR} ) +endif (UNIX AND NOT APPLE) + + +# This will need to be modified later to support either Qt/X11 or Qt/Mac builds +if (APPLE) + + set ( _KDE4_PLATFORM_DEFINITIONS -D__APPLE_KDE__ ) + + # we need to set MACOSX_DEPLOYMENT_TARGET to (I believe) at least 10.2 or maybe 10.3 to allow + # -undefined dynamic_lookup; in the future we should do this programmatically + # hmm... why doesn't this work? + set (ENV{MACOSX_DEPLOYMENT_TARGET} 10.3) + + # "-undefined dynamic_lookup" means we don't care about missing symbols at link-time by default + # this is bad, but unavoidable until there is the equivalent of libtool -no-undefined implemented + # or perhaps it already is, and I just don't know where to look ;) + + set (CMAKE_SHARED_LINKER_FLAGS "-single_module -multiply_defined suppress ${CMAKE_SHARED_LINKER_FLAGS}") + set (CMAKE_MODULE_LINKER_FLAGS "-multiply_defined suppress ${CMAKE_MODULE_LINKER_FLAGS}") + #set(CMAKE_SHARED_LINKER_FLAGS "-single_module -undefined dynamic_lookup -multiply_defined suppress") + #set(CMAKE_MODULE_LINKER_FLAGS "-undefined dynamic_lookup -multiply_defined suppress") + + # we profile... + if(CMAKE_BUILD_TYPE_TOLOWER MATCHES profile) + set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fprofile-arcs -ftest-coverage") + set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage") + endif(CMAKE_BUILD_TYPE_TOLOWER MATCHES profile) + + # removed -Os, was there a special reason for using -Os instead of -O2 ?, Alex + # optimization flags are set below for the various build types + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-common") + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-common") +endif (APPLE) + + +if (CMAKE_SYSTEM_NAME MATCHES Linux) + if (CMAKE_COMPILER_IS_GNUCXX) + set ( _KDE4_PLATFORM_DEFINITIONS -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_GNU_SOURCE) + set ( CMAKE_SHARED_LINKER_FLAGS "-Wl,--fatal-warnings -Wl,--no-undefined -lc ${CMAKE_SHARED_LINKER_FLAGS}") + set ( CMAKE_MODULE_LINKER_FLAGS "-Wl,--fatal-warnings -Wl,--no-undefined -lc ${CMAKE_MODULE_LINKER_FLAGS}") + # we profile... + if(CMAKE_BUILD_TYPE_TOLOWER MATCHES profile) + set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fprofile-arcs -ftest-coverage") + set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage") + endif(CMAKE_BUILD_TYPE_TOLOWER MATCHES profile) + endif (CMAKE_COMPILER_IS_GNUCXX) + if (CMAKE_C_COMPILER MATCHES "icc") + set ( _KDE4_PLATFORM_DEFINITIONS -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_GNU_SOURCE) + set ( CMAKE_SHARED_LINKER_FLAGS "-Wl,--fatal-warnings -Wl,--no-undefined -lc ${CMAKE_SHARED_LINKER_FLAGS}") + set ( CMAKE_MODULE_LINKER_FLAGS "-Wl,--fatal-warnings -Wl,--no-undefined -lc ${CMAKE_MODULE_LINKER_FLAGS}") + endif (CMAKE_C_COMPILER MATCHES "icc") +endif (CMAKE_SYSTEM_NAME MATCHES Linux) + +if (CMAKE_SYSTEM_NAME MATCHES BSD) + set ( _KDE4_PLATFORM_DEFINITIONS -D_GNU_SOURCE ) + set ( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -lc") + set ( CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -lc") +endif (CMAKE_SYSTEM_NAME MATCHES BSD) + +# compiler specific stuff, maybe this should be done differently, Alex + +if (MSVC) + set (KDE4_ENABLE_EXCEPTIONS -EHsc) +endif(MSVC) + +if (MINGW) + set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--export-all-symbols") + set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--export-all-symbols") +endif (MINGW) + +if (CMAKE_COMPILER_IS_GNUCXX) + set (KDE4_ENABLE_EXCEPTIONS -fexceptions) + # Select flags. + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g") + set(CMAKE_CXX_FLAGS_RELEASE "-O2") + set(CMAKE_CXX_FLAGS_DEBUG "-g -O2 -fno-reorder-blocks -fno-schedule-insns -fno-inline") + set(CMAKE_CXX_FLAGS_DEBUGFULL "-g3 -fno-inline") + set(CMAKE_CXX_FLAGS_PROFILE "-g3 -fno-inline -ftest-coverage -fprofile-arcs") + set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g") + set(CMAKE_C_FLAGS_RELEASE "-O2") + set(CMAKE_C_FLAGS_DEBUG "-g -O2 -fno-reorder-blocks -fno-schedule-insns -fno-inline") + set(CMAKE_C_FLAGS_DEBUGFULL "-g3 -fno-inline") + set(CMAKE_C_FLAGS_PROFILE "-g3 -fno-inline -ftest-coverage -fprofile-arcs") + + if (CMAKE_SYSTEM_NAME MATCHES Linux) + set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-long-long -ansi -Wundef -Wcast-align -Werror-implicit-function-declaration -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-common") + set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -Wformat-security -fno-exceptions -fno-check-new -fno-common") + endif (CMAKE_SYSTEM_NAME MATCHES Linux) + + + check_cxx_compiler_flag(-fPIE HAVE_FPIE_SUPPORT) + if(KDE4_ENABLE_FPIE) + if(HAVE_FPIE_SUPPORT) + set (KDE4_CXX_FPIE_FLAGS "-fPIE") + set (KDE4_PIE_LDFLAGS "-pie") + else(HAVE_FPIE_SUPPORT) + MESSAGE(STATUS "Your compiler doesn't support PIE flag") + endif(HAVE_FPIE_SUPPORT) + endif(KDE4_ENABLE_FPIE) + # visibility support + check_cxx_compiler_flag(-fvisibility=hidden __KDE_HAVE_GCC_VISIBILITY) + + # get the gcc version + exec_program(${CMAKE_C_COMPILER} ARGS --version OUTPUT_VARIABLE _gcc_version_info) + + string (REGEX MATCH "[345]\\.[0-9]\\.[0-9]" _gcc_version "${_gcc_version_info}") + # gcc on mac just reports: "gcc (GCC) 3.3 20030304 ..." without the patch level, handle this here: + if (NOT _gcc_version) + string (REGEX REPLACE ".*\\(GCC\\).* ([34]\\.[0-9]) .*" "\\1.0" _gcc_version "${_gcc_version_info}") + endif (NOT _gcc_version) + + macro_ensure_version("4.1.0" "${_gcc_version}" GCC_IS_NEWER_THAN_4_1) + + set(_GCC_COMPILED_WITH_BAD_ALLOCATOR FALSE) + if (GCC_IS_NEWER_THAN_4_1) + exec_program(${CMAKE_C_COMPILER} ARGS -v OUTPUT_VARIABLE _gcc_alloc_info) + string(REGEX MATCH "(--enable-libstdcxx-allocator=mt)" _GCC_COMPILED_WITH_BAD_ALLOCATOR "${_gcc_alloc_info}") + endif (GCC_IS_NEWER_THAN_4_1) + + if (__KDE_HAVE_GCC_VISIBILITY AND GCC_IS_NEWER_THAN_4_1 AND NOT _GCC_COMPILED_WITH_BAD_ALLOCATOR) + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden") + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden") + else (__KDE_HAVE_GCC_VISIBILITY AND GCC_IS_NEWER_THAN_4_1 AND NOT _GCC_COMPILED_WITH_BAD_ALLOCATOR) + set (__KDE_HAVE_GCC_VISIBILITY 0) + endif (__KDE_HAVE_GCC_VISIBILITY AND GCC_IS_NEWER_THAN_4_1 AND NOT _GCC_COMPILED_WITH_BAD_ALLOCATOR) + +endif (CMAKE_COMPILER_IS_GNUCXX) + +if (CMAKE_C_COMPILER MATCHES "icc") + set (KDE4_ENABLE_EXCEPTIONS -fexceptions) + # Select flags. + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g") + set(CMAKE_CXX_FLAGS_RELEASE "-O2") + set(CMAKE_CXX_FLAGS_DEBUG "-O2 -g -0b0 -noalign") + set(CMAKE_CXX_FLAGS_DEBUGFULL "-g -Ob0 -noalign") + set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g") + set(CMAKE_C_FLAGS_RELEASE "-O2") + set(CMAKE_C_FLAGS_DEBUG "-O2 -g -Ob0 -noalign") + set(CMAKE_C_FLAGS_DEBUGFULL "-g -Ob0 -noalign") + + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ansi -Wpointer-arith -fno-common") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ansi -Wpointer-arith -fno-exceptions -fno-common") + + # visibility support + set(__KDE_HAVE_ICC_VISIBILITY) +# check_cxx_compiler_flag(-fvisibility=hidden __KDE_HAVE_ICC_VISIBILITY) +# if (__KDE_HAVE_ICC_VISIBILITY) +# set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden") +# endif (__KDE_HAVE_ICC_VISIBILITY) + +endif (CMAKE_C_COMPILER MATCHES "icc") + +# we prefer to use a different postfix for debug libs only on Windows +# does not work atm +if (WIN32) + SET(CMAKE_DEBUG_POSTFIX "") +endif (WIN32) + +########### end of platform specific stuff ########################## + + +# KDE4Macros.cmake contains all the KDE specific macros +#include(${kde_cmake_module_dir}/KDE4Macros.cmake) +include(KDE4Macros) + + +# decide whether KDE4 has been found +set(KDE4_FOUND FALSE) +if (KDE4_INCLUDE_DIR AND KDE4_LIB_DIR AND KDE4_KCFGC_EXECUTABLE AND KDE4_INSTALLED_VERSION_OK) + set(KDE4_FOUND TRUE) +endif (KDE4_INCLUDE_DIR AND KDE4_LIB_DIR AND KDE4_KCFGC_EXECUTABLE AND KDE4_INSTALLED_VERSION_OK) + + +macro (KDE4_PRINT_RESULTS) + + # inside kdelibs the include dir and lib dir are internal, not "found" + if(NOT EXISTS ${CMAKE_SOURCE_DIR}/kdecore/kernel/kglobal.h) + if(KDE4_INCLUDE_DIR) + message(STATUS "Found KDE4 include dir: ${KDE4_INCLUDE_DIR}") + else(KDE4_INCLUDE_DIR) + message(STATUS "Didn't find KDE4 headers") + endif(KDE4_INCLUDE_DIR) + + if(KDE4_LIB_DIR) + message(STATUS "Found KDE4 library dir: ${KDE4_LIB_DIR}") + else(KDE4_LIB_DIR) + message(STATUS "Didn't find KDE4 core library") + endif(KDE4_LIB_DIR) + endif(NOT EXISTS ${CMAKE_SOURCE_DIR}/kdecore/kernel/kglobal.h) + + if(KDE4_KCFGC_EXECUTABLE) + message(STATUS "Found KDE4 kconfig_compiler preprocessor: ${KDE4_KCFGC_EXECUTABLE}") + else(KDE4_KCFGC_EXECUTABLE) + message(STATUS "Didn't find the KDE4 kconfig_compiler preprocessor") + endif(KDE4_KCFGC_EXECUTABLE) +endmacro (KDE4_PRINT_RESULTS) + + +if (KDE4Internal_FIND_REQUIRED AND NOT KDE4_FOUND) + #bail out if something wasn't found + kde4_print_results() + if (NOT KDE4_INSTALLED_VERSION_OK) + message(FATAL_ERROR "ERROR: the installed kdelibs version ${KDEVERSION} is too old, at least version ${KDE_MIN_VERSION} is required") + else (NOT KDE4_INSTALLED_VERSION_OK) + message(FATAL_ERROR "ERROR: could NOT find everything required for compiling KDE 4 programs") + endif (NOT KDE4_INSTALLED_VERSION_OK) +endif (KDE4Internal_FIND_REQUIRED AND NOT KDE4_FOUND) + + +if (NOT KDE4Internal_FIND_QUIETLY) + kde4_print_results() +endif (NOT KDE4Internal_FIND_QUIETLY) + +#add the found Qt and KDE include directories to the current include path +#the ${KDE4_INCLUDE_DIR}/KDE directory is for forwarding includes, eg. #include <KMainWindow> +set(KDE4_INCLUDES ${QT_INCLUDES} ${KDE4_INCLUDE_DIR} ${KDE4_INCLUDE_DIR}/KDE ${_KDE4_PLATFORM_INCLUDE_DIRS} ) + +set(KDE4_DEFINITIONS ${_KDE4_PLATFORM_DEFINITIONS} -DQT_NO_STL -DQT_NO_CAST_TO_ASCII -D_REENTRANT -DKDE_DEPRECATED_WARNINGS ) + +if (NOT _kde4_uninstall_rule_created) + set(_kde4_uninstall_rule_created TRUE) + + configure_file("${kde_cmake_module_dir}/kde4_cmake_uninstall.cmake.in" "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake" @ONLY) + + add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake") + +endif (NOT _kde4_uninstall_rule_created) diff --git a/cmakemodules/FindKDEWIN32.cmake b/cmakemodules/FindKDEWIN32.cmake new file mode 100644 index 0000000..afa8ee9 --- /dev/null +++ b/cmakemodules/FindKDEWIN32.cmake @@ -0,0 +1,89 @@ +# - 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 +# +# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org> +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + + +if (WIN32) + +file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _program_FILES_DIR) + +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 ${CMAKE_INSTALL_PREFIX}/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) + +set(KDEWIN32_LIBRARY_PATH ${_program_FILES_DIR}/kdewin32/lib) +find_library(KDEWIN32_LIBRARY_RELEASE NAMES kdewin32 + PATHS + ${KDEWIN32_LIBRARY_PATH} ${CMAKE_INSTALL_PREFIX}/lib +) + +# msvc makes a difference between debug and release +if(MSVC) + find_library(KDEWIN32_LIBRARY_DEBUG NAMES kdewin32d + PATHS + ${_program_FILES_DIR}/kdewin32/lib ${CMAKE_INSTALL_PREFIX}/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 needed system libs + 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 + file(TO_CMAKE_PATH "$ENV{MSSDK}" MSSDK_DIR) + 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/cmakemodules/FindKdeLibs.cmake b/cmakemodules/FindKdeLibs.cmake new file mode 100644 index 0000000..1259480 --- /dev/null +++ b/cmakemodules/FindKdeLibs.cmake @@ -0,0 +1,316 @@ +#INCLUDE(FindQt3) +#INCLUDE(FindQt) +#INCLUDE(FindKDE3) +INCLUDE(kdesvnMacros) +INCLUDE(KDE3Macros) + +FILE(GLOB GLOB_PATHS_INCLUDE /usr/lib*/qt-3*/include/) +FIND_PROGRAM(PKG_CONFIG NAMES pkg-config) +EXECUTE_PROCESS(COMMAND ${PKG_CONFIG} "--variable=prefix" "qt-mt" + OUTPUT_VARIABLE _qt_mt_path + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) +SET(QT_MT_PATH ${_qt_mt_path} CACHE STRING "QT Path" FORCE) +FIND_PATH(QT_INCLUDE_DIR_PLUS qt.h + ${GLOB_PATHS_INCLUDE} + ${QT_MT_PATH}/include) +IF (NOT QT_INCLUDE_DIR) + SET(QT_INCLUDE_DIR ${QT_INCLUDE_DIR_PLUS}) +ENDIF (NOT QT_INCLUDE_DIR) + +FIND_PROGRAM(CMAKE_UNAME uname ${BIN_SEARCH_PATHES}) +IF(CMAKE_UNAME) + EXECUTE_PROCESS(COMMAND ${CMAKE_UNAME} "-m" + OUTPUT_VARIABLE CMAKE_SYSTEM_PROCESSOR + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + IF("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "64") + SET(LIB_SUFFIX "64" CACHE STRING "Define suffix of directory name (32/64)" FORCE) + ELSE("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "64") + SET(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" FORCE) + ENDIF("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "64") +ENDIF(CMAKE_UNAME) + +SET(INCLUDE_SEARCH_PATHES + ${INCLUDE_SEARCH_PATHES} + ${KDE3_INCLUDE_DIRS}) + +SET(LIB_SEARCH_PATHES + ${LIB_SEARCH_PATHES} + ${KDE3_LIB_DIR}) + +IF (LIB_SUFFIX) + SET(LIB_SEARCH_PATHES + $ENV{KDEDIR}/lib${LIB_SUFFIX} + $ENV{HOME}/lib${LIB_SUFFIX} + $ENV{HOME}/usr/lib${LIB_SUFFIX} + /opt/lib${LIB_SUFFIX} + /opt/kde/lib${LIB_SUFFIX} + /opt/kde3/lib${LIB_SUFFIX} + /usr/lib${LIB_SUFFIX} + /usr/kde/3.5/lib${LIB_SUFFIX} + /usr/local/lib${LIB_SUFFIX} + ${LIB_SEARCH_PATHES} + ) +ENDIF (LIB_SUFFIX) + + + +FIND_LIBRARY(M_LIBRARY NAMES m + PATHS + ${LIB_SEARCH_PATHES} +) + +FIND_LIBRARY(KDE3_UI_LIBRARY NAMES kdeui + PATHS + ${LIB_SEARCH_PATHES} +) + +FIND_LIBRARY(KDE3_PART_LIBRARY NAMES kparts + PATHS + ${LIB_SEARCH_PATHES} +) + +FIND_LIBRARY(KDE3_KIO_LIBRARY NAMES kio + PATHS + ${LIB_SEARCH_PATHES} +) + +FIND_LIBRARY(KDE3_KHTML_LIBRARY NAMES khtml + PATHS + ${LIB_SEARCH_PATHES} +) + +FIND_LIBRARY(KDE3_DCOP_LIBRARY NAMES DCOP + PATHS + ${LIB_SEARCH_PATHES} +) + +FIND_PROGRAM(KDE3_KDECONFIG_EXECUTABLE NAME kde-config + PATHS ${BIN_SEARCH_PATHES}) + +FIND_PROGRAM(MSGFMT + NAMES gmsgfmt msgfmt + PATHS ${BIN_SEARCH_PATHES}) + + +FIND_PROGRAM(STRIP + NAMES strip + PATHS ${BIN_SEARCH_PATHES}) + +FIND_PROGRAM(KDE3_MEINPROC_EXECUTABLE NAME meinproc + PATHS ${BIN_SEARCH_PATHES}) + +IF(KDE3_MEINPROC_EXECUTABLE) + MESSAGE(STATUS "Found meinproc: ${KDE3_MEINPROC_EXECUTABLE}") +ELSE(KDE3_MEINPROC_EXECUTABLE) + MESSAGE(FATAL_ERROR "Could NOT find meinproc program!") +ENDIF(KDE3_MEINPROC_EXECUTABLE) + +IF(MSGFMT) + EXECUTE_PROCESS(COMMAND ${MSGFMT} "--version" + OUTPUT_VARIABLE _msgout + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + STRING(REGEX MATCH "GNU[\t ]gettext" _isgnu "${_msgout}") + IF (NOT _isgnu) + MESSAGE(STATUS "No gnu msgfmt found!") + SET(MSGFMT ":" CACHE STRING "Msgfmt program") + ELSE(NOT _isgnu) + MESSAGE(STATUS "Found gnu msgfmt: ${MSGFMT}") + ENDIF (NOT _isgnu) +ELSE(MSGFMT) + SET(MSGFMT ":" CACHE STRING "Msgfmt program") + MESSAGE( FATAL_ERROR "Could NOT find msgfmt program") +ENDIF(MSGFMT) + +EXECUTE_PROCESS(COMMAND ${KDE3_KDECONFIG_EXECUTABLE} "--prefix" + COMMAND xargs "echo" "-n" + OUTPUT_VARIABLE _kde_prefix_path + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) +SET(KDE_HTML_COMMON_PATH ${_kde_prefix_path}/share/doc/HTML/en/common CACHE STRING "KDE HTML common Path" FORCE) + +# 'cause my own defines were not good I take them from kde4 trunk +#add some KDE specific stuff +SET(SHARE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/share CACHE PATH "Base directory for files which go to share/" FORCE) +SET(EXEC_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} CACHE PATH "Base directory for executables and libraries" FORCE) +# +## the following are directories where stuff will be installed to +SET(BIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/bin" CACHE PATH "The kde bin install dir (default prefix/bin)" FORCE) +SET(SBIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/sbin" CACHE PATH "The kde sbin install dir (default prefix/sbin)" FORCE) +SET(LIB_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX}" CACHE PATH "The subdirectory relative to the install prefix where libraries will be installed (default is /lib${LIB_SUFFIX})" FORCE) +SET(LIBEXEC_INSTALL_DIR "${LIB_INSTALL_DIR}/kde3/libexec" CACHE PATH "The subdirectory relative to the install prefix where libraries will be installed (default is /lib/kde3/libexec)" FORCE) +SET(PLUGIN_INSTALL_DIR "${LIB_INSTALL_DIR}/kde3" CACHE PATH "The subdirectory relative to the install prefix where plugins will be installed (default is ${LIB_INSTALL_DIR}/kde3)" FORCE) +SET(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "The subdirectory to the header prefix" FORCE) +SET(CONFIG_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/config" CACHE PATH "The config file install dir" FORCE) +SET(DATA_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/apps" CACHE PATH "The parent directory where applications can install their data" FORCE) +SET(HTML_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/doc/HTML" CACHE PATH "The HTML install dir for documentation" FORCE) +SET(ICON_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/icons" CACHE PATH "The icon install dir (default prefix/share/icons/)" FORCE) +SET(KCFG_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/config.kcfg" CACHE PATH "The install dir for kconfig files" FORCE) +SET(LOCALE_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/locale" CACHE PATH "The install dir for translations" FORCE) +SET(MIME_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/mimelnk" CACHE PATH "The install dir for the mimetype desktop files" FORCE) +SET(SERVICES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/services" CACHE PATH "The install dir for service (desktop, protocol, ...) files" FORCE) +SET(SERVICETYPES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/servicetypes" CACHE PATH "The install dir for servicestypes desktop files" FORCE) +SET(SOUND_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/sounds" CACHE PATH "The install dir for sound files" FORCE) +SET(TEMPLATES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/templates" CACHE PATH "The install dir for templates (Create new file...)" FORCE) +SET(WALLPAPER_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/wallpapers" CACHE PATH "The install dir for wallpapers" FORCE) +SET(KCONF_UPDATE_INSTALL_DIR "${DATA_INSTALL_DIR}/kconf_update" CACHE PATH "The kconf_update install dir" FORCE) +# this one shouldn't be used anymore +SET(APPLNK_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/applnk" CACHE PATH "Is this still used ?" FORCE) +SET(AUTOSTART_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/autostart" CACHE PATH "The install dir for autostart files" FORCE) +SET(XDG_APPS_DIR "${SHARE_INSTALL_PREFIX}/applications/kde" CACHE PATH "The XDG apps dir" FORCE) +SET(XDG_DIRECTORY_DIR "${SHARE_INSTALL_PREFIX}/desktop-directories" CACHE PATH "The XDG directory" FORCE) +SET(SYSCONF_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/etc" CACHE PATH "The kde sysconfig install dir (default/etc)" FORCE) +SET(MAN_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/man" CACHE PATH "The kde man install dir (default prefix/share/man/)" FORCE) +SET(INFO_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/info" CACHE PATH "The kde info install dir (default prefix/info)" FORCE) + +# linker flags - must get checked +SET(LINK_NO_UNDEFINED "") +SET(lundef "-Wl,--no-undefined") +KDESVN_CHECK_LINK_FLAG(${lundef} _NO_UNDEFINED) +IF (_NO_UNDEFINED) + SET(LINK_NO_UNDEFINED "${lundef}") +ENDIF (_NO_UNDEFINED) + +SET(lundef "-Wl,--allow-shlib-undefined") +KDESVN_CHECK_LINK_FLAG(${lundef} _ALLOW_SHLIB) +IF (_ALLOW_SHLIB) + SET(LINK_NO_UNDEFINED "${LINK_NO_UNDEFINED} ${lundef}") +ENDIF (_ALLOW_SHLIB) + + +# own macros +MACRO(KDESVN_INSTALL_ICONS _theme) + + FILE(GLOB _icons *.png) + FILE(GLOB _svg *svgz) + SET(_icons ${_icons} ${_svg}) + FOREACH(_current_ICON ${_icons} ) + GET_FILENAME_COMPONENT(_ctype ${_current_ICON} EXT) + + IF (${_ctype} STREQUAL ".png") + STRING(REGEX REPLACE "^.*/[a-zA-Z]+([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\1" _size "${_current_ICON}") + STRING(REGEX REPLACE "^.*/[a-zA-Z]+([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\2" _group "${_current_ICON}") + STRING(REGEX REPLACE "^.*/[a-zA-Z]+([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\3" _name "${_current_ICON}") + SET(_sizestring "${_size}x${_size}") + ENDIF (${_ctype} STREQUAL ".png") + + IF (${_ctype} STREQUAL ".svgz") + STRING(REGEX REPLACE "^.*/[a-zA-Z]+\\-([a-z]+)\\-(.+\\.svgz)$" "\\1" _group "${_current_ICON}") + STRING(REGEX REPLACE "^.*/[a-zA-Z]+\\-([a-z]+)\\-(.+\\.svgz)$" "\\2" _name "${_current_ICON}") + SET(_sizestring "scalable") + ENDIF (${_ctype} STREQUAL ".svgz") + + SET(_icon_GROUP "actions") + + IF(${_group} STREQUAL "mime") + SET(_icon_GROUP "mimetypes") + ENDIF(${_group} STREQUAL "mime") + + IF(${_group} STREQUAL "filesys") + SET(_icon_GROUP "filesystems") + ENDIF(${_group} STREQUAL "filesys") + + IF(${_group} STREQUAL "device") + SET(_icon_GROUP "devices") + ENDIF(${_group} STREQUAL "device") + + IF(${_group} STREQUAL "app") + SET(_icon_GROUP "apps") + ENDIF(${_group} STREQUAL "app") + + IF(${_group} STREQUAL "action") + SET(_icon_GROUP "actions") + ENDIF(${_group} STREQUAL "action") + + #message(STATUS "icon: ${_current_ICON} size: ${_sizestring} group: ${_group} name: ${_name}" ) + SET(_ICON_INSTALL_DIR ${ICON_INSTALL_DIR}/${_theme}/${_sizestring}/${_icon_GROUP}) + + INSTALL(FILES ${_current_ICON} DESTINATION ${_ICON_INSTALL_DIR} RENAME ${_name}) + + ENDFOREACH (_current_ICON) +ENDMACRO(KDESVN_INSTALL_ICONS) + +MACRO(ADD_POFILES packagename) + SET(_gmofiles) + FILE(GLOB _pofiles *.po) + + FOREACH(_current_po ${_pofiles}) + GET_FILENAME_COMPONENT(_name ${_current_po} NAME_WE) + STRING(REGEX REPLACE "^.*/([a-zA-Z]+)(\\.po)" "\\1" _lang "${_current_po}") + SET(_gmofile "${CMAKE_CURRENT_BINARY_DIR}/${_name}.gmo") + ADD_CUSTOM_COMMAND(OUTPUT ${_gmofile} + COMMAND ${MSGFMT} + ARGS "-o" "${_gmofile}" "${_current_po}" + DEPENDS ${_current_po} + ) + SET(_gmofiles ${_gmofiles} ${_gmofile}) + INSTALL(FILES ${_gmofile} + DESTINATION ${LOCALE_INSTALL_DIR}/${_lang}/LC_MESSAGES + RENAME ${packagename}.mo) + ENDFOREACH(_current_po ${_pofiles}) + + ADD_CUSTOM_TARGET(translations ALL + DEPENDS ${_gmofiles}) + +ENDMACRO(ADD_POFILES) + + +# KDE3_CREATE_HANDBOOK( docbookfile ) +# Create the handbook from the docbookfile (using meinproc) +MACRO (KDE3_CREATE_HANDBOOK _docbook ) + GET_FILENAME_COMPONENT(_tmp_src_FILE ${CMAKE_CURRENT_SOURCE_DIR} ABSOLUTE) + GET_FILENAME_COMPONENT(_tmp_bin_FILE ${CMAKE_CURRENT_BINARY_DIR} ABSOLUTE) + + IF(EXISTS ${_tmp_src_FILE}/${_docbook}) + get_filename_component(_input ${_tmp_src_FILE}/${_docbook} ABSOLUTE) + ENDIF(EXISTS ${_tmp_src_FILE}/${_docbook}) + IF(EXISTS ${_tmp_bin_FILE}/${_docbook}) + get_filename_component(_input ${_tmp_bin_FILE}/${_docbook} ABSOLUTE) + ENDIF(EXISTS ${_tmp_bin_FILE}/${_docbook}) + + SET(_doc ${CMAKE_CURRENT_BINARY_DIR}/index.cache.bz2) + ADD_CUSTOM_COMMAND(OUTPUT ${_doc} + COMMAND ${KDE3_MEINPROC_EXECUTABLE} --check --cache ${_doc} ${_input} + DEPENDS ${_input} ${KDE3_MEINPROC_EXECUTABLE} + ) + ADD_CUSTOM_TARGET(handbook ALL DEPENDS ${_doc}) +ENDMACRO (KDE3_CREATE_HANDBOOK) + + +# KDE3_INSTALL_HANDBOOK() +# Install the handbook documentation +MACRO (KDE3_INSTALL_HANDBOOK _appname ) + GET_FILENAME_COMPONENT(_tmp_src_FILE ${CMAKE_CURRENT_SOURCE_DIR} ABSOLUTE) + GET_FILENAME_COMPONENT(_tmp_bin_FILE ${CMAKE_CURRENT_BINARY_DIR} ABSOLUTE) + GET_FILENAME_COMPONENT(_basename ${_tmp_src_FILE} NAME_WE) + SET( dirname ${_basename}/${_appname}) + + FILE(GLOB _books_bin ${_tmp_bin_FILE}/*.docbook) + FILE(GLOB _images_bin ${_tmp_bin_FILE}/*.png) + FILE(GLOB _books_src ${_tmp_src_FILE}/*.docbook) + FILE(GLOB _images_src ${_tmp_src_FILE}/*.png) + + INSTALL( FILES ${CMAKE_CURRENT_BINARY_DIR}/index.cache.bz2 ${_books_src} ${_books_bin} ${_images_src} ${_images_bin} + DESTINATION ${HTML_INSTALL_DIR}/${dirname} ) + + INSTALL( CODE "EXECUTE_PROCESS ( COMMAND /bin/ln -s \"${KDE_HTML_COMMON_PATH}\" \"$ENV{DESTDIR}${HTML_INSTALL_DIR}/${dirname}/common\" ERROR_QUIET )" ) + INSTALL( CODE "MESSAGE(STATUS \"Installing $ENV{DESTDIR}${HTML_INSTALL_DIR}/${dirname}/common\")" ) + INSTALL( CODE "FILE(APPEND ${CMAKE_BINARY_DIR}/uninstall_plus.cmake \"IF(EXISTS \\\"$ENV{DESTDIR}${HTML_INSTALL_DIR}/${dirname}/common\\\")\\n\")" ) + INSTALL( CODE "FILE(APPEND ${CMAKE_BINARY_DIR}/uninstall_plus.cmake \"MESSAGE(STATUS \\\"Uninstalling \\\\\\\"$ENV{DESTDIR}${HTML_INSTALL_DIR}/${dirname}/common\\\\\\\"\\\")\\n\")" ) + INSTALL( CODE "FILE(APPEND ${CMAKE_BINARY_DIR}/uninstall_plus.cmake \"ENDIF(EXISTS \\\"$ENV{DESTDIR}${HTML_INSTALL_DIR}/${dirname}/common\\\")\\n\")" ) + INSTALL( CODE "FILE(APPEND ${CMAKE_BINARY_DIR}/uninstall_plus.cmake \"FILE(REMOVE \\\"$ENV{DESTDIR}${HTML_INSTALL_DIR}/${dirname}/common\\\")\\n\")" ) + + # Specific for KBFX code - remove for other installs + FILE(GLOB _docbook_PNGFILES ${CMAKE_SOURCE_DIR}/skin/raster/default/*.png) + FOREACH(_p ${_docbook_PNGFILES}) + GET_FILENAME_COMPONENT(_png_name ${_p} NAME) + INSTALL( CODE "EXECUTE_PROCESS ( COMMAND /bin/ln -s \"${DATA_INSTALL_DIR}/kbfx/skins/default/${_png_name}\" \"$ENV{DESTDIR}${HTML_INSTALL_DIR}/${dirname}\" ERROR_QUIET )" ) + INSTALL( CODE "MESSAGE(STATUS \"Installing $ENV{DESTDIR}${HTML_INSTALL_DIR}/${dirname}/${_png_name}\")" ) + INSTALL( CODE "FILE(APPEND ${CMAKE_BINARY_DIR}/uninstall_plus.cmake \"MESSAGE(STATUS \\\"Uninstalling \\\\\\\"$ENV{DESTDIR}${HTML_INSTALL_DIR}/${dirname}/${_png_name}\\\\\\\"\\\")\\n\")" ) + INSTALL( CODE "FILE(APPEND ${CMAKE_BINARY_DIR}/uninstall_plus.cmake \"FILE(REMOVE \\\"$ENV{DESTDIR}${HTML_INSTALL_DIR}/${dirname}/${_png_name}\\\")\\n\")" ) + ENDFOREACH(_p) + # End of specific for KBFX code +ENDMACRO (KDE3_INSTALL_HANDBOOK ) + diff --git a/cmakemodules/FindQt4.cmake b/cmakemodules/FindQt4.cmake new file mode 100644 index 0000000..8f3be9c --- /dev/null +++ b/cmakemodules/FindQt4.cmake @@ -0,0 +1,1081 @@ +# - Find QT 4 +# This module can be used to find Qt4. +# The most important issue is that the Qt4 qmake is available via the system path. +# This qmake is then used to detect basically everything else. +# This module defines a number of key variables and macros. First is +# QT_USE_FILE which is the path to a CMake file that can be included to compile +# Qt 4 applications and libraries. By default, the QtCore and QtGui +# libraries are loaded. This behavior can be changed by setting one or more +# of the following variables to true: +# QT_DONT_USE_QTCORE +# QT_DONT_USE_QTGUI +# QT_USE_QT3SUPPORT +# QT_USE_QTASSISTANT +# QT_USE_QTDESIGNER +# QT_USE_QTMOTIF +# QT_USE_QTMAIN +# QT_USE_QTNETWORK +# QT_USE_QTNSPLUGIN +# QT_USE_QTOPENGL +# QT_USE_QTSQL +# QT_USE_QTXML +# QT_USE_QTSVG +# QT_USE_QTTEST +# QT_USE_QTUITOOLS +# QT_USE_QTDBUS +# +# 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 [interfacename] ) +# generate the xml interface file from the given header. +# If the optional argument interfacename is omitted, the name of the +# interface file is constructed from the basename of the header with +# the suffix .xml appended. +# +# 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_QTDESIGNERCOMPONENTS True if QtDesignerComponents 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_QTUITOOLS_FOUND True if QtUiTools 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_QTDESIGNERCOMPONENTS_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 +# +# QT_PLUGINS_DIR Path to "plugins" for Qt4 +# +# For every library of Qt, a QT_QTFOO_LIBRARY variable is defined, with the full path to the library. +# +# So there are the following variables: +# The Qt3Support library: QT_QT3SUPPORT_LIBRARY +# +# The QtAssistant library: QT_QTASSISTANT_LIBRARY +# +# The QtCore library: QT_QTCORE_LIBRARY +# +# The QtDBus library: QT_QTDBUS_LIBRARY +# +# The QtDesigner library: QT_QTDESIGNER_LIBRARY +# +# The QtDesignerComponents library: QT_QTDESIGNERCOMPONENTS_LIBRARY +# +# The QtGui library: QT_QTGUI_LIBRARY +# +# The QtMotif library: QT_QTMOTIF_LIBRARY +# +# The QtNetwork library: QT_QTNETWORK_LIBRARY +# +# The QtNsPLugin library: QT_QTNSPLUGIN_LIBRARY +# +# The QtOpenGL library: QT_QTOPENGL_LIBRARY +# +# The QtSql library: QT_QTSQL_LIBRARY +# +# The QtXml library: QT_QTXML_LIBRARY +# +# The QtSvg library: QT_QTSVG_LIBRARY +# +# The QtTest library: QT_QTTEST_LIBRARY +# +# The qtmain library for Windows QT_QTMAIN_LIBRARY +# +# The QtUiTools library: QT_QTUITOOLS_LIBRARY +# +# 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 qdbuscpp2xml tool. +# QT_DBUSXML2CPP_EXECUTABLE Where to find the qdbusxml2cpp tool. +# +# QT_DOC_DIR Path to "doc" of Qt4 +# QT_MKSPECS_DIR Path to "mkspecs" of Qt4 +# +# +# These are around for backwards compatibility +# they will be set +# QT_WRAP_CPP Set true if 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 + +# Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. +# See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. + + +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) + +SET(QT4_INSTALLED_VERSION_TOO_OLD FALSE) + +# macro for asking qmake to process pro files +MACRO(QT_QUERY_QMAKE outvar invar) + FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmpQmake/tmp.pro + "message(CMAKE_MESSAGE<$$${invar}>)") + + EXECUTE_PROCESS(COMMAND ${QT_QMAKE_EXECUTABLE} + WORKING_DIRECTORY + ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmpQmake + OUTPUT_VARIABLE _qmake_query_output + ERROR_VARIABLE _qmake_query_output ) + + FILE(REMOVE_RECURSE + "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmpQmake") + + STRING(REGEX REPLACE ".*CMAKE_MESSAGE<([^>]*).*" "\\1" ${outvar} "${_qmake_query_output}") +ENDMACRO(QT_QUERY_QMAKE) + +# check for qmake +FIND_PROGRAM(QT_QMAKE_EXECUTABLE NAMES qmake qmake4 qmake-qt4 PATHS + "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\4.0.0;InstallDir]/bin" + "[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\4.0.0;InstallDir]/bin" + $ENV{QTDIR}/bin +) + +IF (QT_QMAKE_EXECUTABLE) + + SET(QT4_QMAKE_FOUND FALSE) + + EXEC_PROGRAM(${QT_QMAKE_EXECUTABLE} ARGS "-query QT_VERSION" OUTPUT_VARIABLE QTVERSION) + + # check for qt3 qmake and then try and find qmake4 or qmake-qt4 in the path + IF("${QTVERSION}" MATCHES "Unknown") + SET(QT_QMAKE_EXECUTABLE NOTFOUND CACHE FILEPATH "" FORCE) + FIND_PROGRAM(QT_QMAKE_EXECUTABLE NAMES qmake4 qmake-qt4 PATHS + "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\4.0.0;InstallDir]/bin" + "[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\4.0.0;InstallDir]/bin" + $ENV{QTDIR}/bin + ) + IF(QT_QMAKE_EXECUTABLE) + EXEC_PROGRAM(${QT_QMAKE_EXECUTABLE} + ARGS "-query QT_VERSION" OUTPUT_VARIABLE QTVERSION) + ENDIF(QT_QMAKE_EXECUTABLE) + ENDIF("${QTVERSION}" MATCHES "Unknown") + + # check that we found the Qt4 qmake, Qt3 qmake output won't match here + STRING(REGEX MATCH "^[0-9]+\\.[0-9]+\\.[0-9]+" qt_version_tmp "${QTVERSION}") + IF (qt_version_tmp) + + # we need at least version 4.0.0 + IF (NOT 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) + + # ask qmake for the plugins directory + IF (NOT QT_PLUGINS_DIR) + EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE} + ARGS "-query QT_INSTALL_PLUGINS" + OUTPUT_VARIABLE qt_plugins_dir ) + SET(QT_PLUGINS_DIR ${qt_plugins_dir} CACHE PATH "The location of the Qt plugins") + ENDIF (NOT QT_PLUGINS_DIR) + ######################################## + # + # Setting the INCLUDE-Variables + # + ######################################## + + FIND_PATH(QT_QTCORE_INCLUDE_DIR QtGlobal + ${QT_HEADERS_DIR}/QtCore + ${QT_LIBRARY_DIR}/QtCore.framework/Headers + NO_DEFAULT_PATH + ) + + # 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_QTDESIGNERCOMPONENTS_INCLUDE_DIR + FIND_PATH(QT_QTDESIGNERCOMPONENTS_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 QT_MKSPECS_DIR QT_PLUGINS_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 "-F${QT_LIBRARY_DIR} -framework QtCore" CACHE STRING "The QtCore library.") + SET(QT_QT3SUPPORT_LIBRARY "-framework Qt3Support" CACHE STRING "The Qt3Support library.") + SET(QT_QTGUI_LIBRARY "-framework QtGui" CACHE STRING "The QtGui library.") + SET(QT_QTNETWORK_LIBRARY "-framework QtNetwork" CACHE STRING "The QtNetwork library.") + SET(QT_QTOPENGL_LIBRARY "-framework QtOpenGL" CACHE STRING "The QtOpenGL library.") + SET(QT_QTSQL_LIBRARY "-framework QtSql" CACHE STRING "The QtSql library.") + SET(QT_QTXML_LIBRARY "-framework QtXml" CACHE STRING "The QtXml library.") + SET(QT_QTSVG_LIBRARY "-framework QtSvg" CACHE STRING "The QtSvg library.") + SET(QT_QTDBUS_LIBRARY "-framework QtDBus" CACHE STRING "The QtDBus library.") + SET(QT_QTTEST_LIBRARY "-framework QtTest" CACHE STRING "The QtTest library.") + + # WTF? why don't we have frameworks? :P + SET(QT_QTUITOOLS_LIBRARY "-L${QT_LIBRARY_DIR} -lQtUiTools" CACHE STRING "The QtUiTools 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 NAMES QtCore QtCore4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH ) + + # Set QT_QT3SUPPORT_LIBRARY + FIND_LIBRARY(QT_QT3SUPPORT_LIBRARY NAMES Qt3Support Qt3Support4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + + # Set QT_QTGUI_LIBRARY + FIND_LIBRARY(QT_QTGUI_LIBRARY NAMES QtGui QtGui4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + + # Set QT_QTMOTIF_LIBRARY + IF(Q_WS_X11) + FIND_LIBRARY(QT_QTMOTIF_LIBRARY NAMES QtMotif PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + ENDIF(Q_WS_X11) + + # Set QT_QTNETWORK_LIBRARY + FIND_LIBRARY(QT_QTNETWORK_LIBRARY NAMES QtNetwork QtNetwork4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + + # Set QT_QTNSPLUGIN_LIBRARY + FIND_LIBRARY(QT_QTNSPLUGIN_LIBRARY NAMES QtNsPlugin PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + + # Set QT_QTOPENGL_LIBRARY + FIND_LIBRARY(QT_QTOPENGL_LIBRARY NAMES QtOpenGL QtOpenGL4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + + # Set QT_QTSQL_LIBRARY + FIND_LIBRARY(QT_QTSQL_LIBRARY NAMES QtSql QtSql4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + + # Set QT_QTXML_LIBRARY + FIND_LIBRARY(QT_QTXML_LIBRARY NAMES QtXml QtXml4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + + # Set QT_QTSVG_LIBRARY + FIND_LIBRARY(QT_QTSVG_LIBRARY NAMES QtSvg QtSvg4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + + # Set QT_QTUITOOLS_LIBRARY + FIND_LIBRARY(QT_QTUITOOLS_LIBRARY NAMES QtUiTools QtUiTools4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + + # Set QT_QTTEST_LIBRARY + FIND_LIBRARY(QT_QTTEST_LIBRARY NAMES QtTest QtTest4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + + FIND_LIBRARY(QT_QTDBUS_LIBRARY NAMES QtDBus QtDBus4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + + IF(MSVC) + FIND_LIBRARY(QT_QTCORE_LIBRARY_DEBUG NAMES QtCored4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + FIND_LIBRARY(QT_QT3SUPPORT_LIBRARY_DEBUG NAMES Qt3Supportd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + FIND_LIBRARY(QT_QTGUI_LIBRARY_DEBUG NAMES QtGuid4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + FIND_LIBRARY(QT_QTNETWORK_LIBRARY_DEBUG NAMES QtNetworkd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + FIND_LIBRARY(QT_QTOPENGL_LIBRARY_DEBUG NAMES QtOpenGLd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + FIND_LIBRARY(QT_QTSQL_LIBRARY_DEBUG NAMES QtSqld4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + FIND_LIBRARY(QT_QTXML_LIBRARY_DEBUG NAMES QtXmld4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + FIND_LIBRARY(QT_QTSVG_LIBRARY_DEBUG NAMES QtSvgd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + FIND_LIBRARY(QT_QTUITOOLS_LIBRARY_DEBUG NAMES QtUiToolsd QtUiToolsd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + FIND_LIBRARY(QT_QTTEST_LIBRARY_DEBUG NAMES QtTestd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + FIND_LIBRARY(QT_QTDBUS_LIBRARY_DEBUG NAMES QtDBusd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + FIND_LIBRARY(QT_QTASSISTANT_LIBRARY_DEBUG NAMES QtAssistantClientd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + FIND_LIBRARY(QT_QTMAIN_LIBRARY_DEBUG NAMES qtmaind PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + ENDIF(MSVC) + + ENDIF (QT_USE_FRAMEWORKS) + + IF( NOT QT_QTCORE_LIBRARY ) + 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 ) + + # Set QT_QTASSISTANT_LIBRARY + FIND_LIBRARY(QT_QTASSISTANT_LIBRARY NAMES QtAssistantClient QtAssistantClient4 QtAssistant QtAssistant4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + + # Set QT_QTDESIGNER_LIBRARY + FIND_LIBRARY(QT_QTDESIGNER_LIBRARY NAMES QtDesigner QtDesigner4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + + # Set QT_QTDESIGNERCOMPONENTS_LIBRARY + FIND_LIBRARY(QT_QTDESIGNERCOMPONENTS_LIBRARY NAMES QtDesignerComponents QtDesignerComponents4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + + # Set QT_QTMAIN_LIBRARY + IF(WIN32) + FIND_LIBRARY(QT_QTMAIN_LIBRARY NAMES qtmain PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH) + ENDIF(WIN32) + + ############################################ + # + # Check the existence of the libraries. + # + ############################################ + + MACRO (_QT4_ADJUST_LIB_VARS basename) + IF (QT_${basename}_LIBRARY OR QT_${basename}_LIBRARY_DEBUG) + + IF(MSVC) + + # Both set + IF (QT_${basename}_LIBRARY AND QT_${basename}_LIBRARY_DEBUG) + SET(QT_${basename}_LIBRARY optimized ${QT_${basename}_LIBRARY} debug ${QT_${basename}_LIBRARY_DEBUG}) + ENDIF (QT_${basename}_LIBRARY AND QT_${basename}_LIBRARY_DEBUG) + + # Only debug was found + IF (NOT QT_${basename}_LIBRARY AND QT_${basename}_LIBRARY_DEBUG) + SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY_DEBUG}) + ENDIF (NOT QT_${basename}_LIBRARY AND QT_${basename}_LIBRARY_DEBUG) + + # Hmm, is this used anywhere ? Yes, in UseQt4.cmake. We are currently incompatible :-( + SET(QT_${basename}_LIBRARIES optimized ${QT_${basename}_LIBRARY} debug ${QT_${basename}_LIBRARY_DEBUG}) + + ENDIF(MSVC) + + 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) + + ENDIF (QT_${basename}_LIBRARY OR QT_${basename}_LIBRARY_DEBUG) + + IF (QT_${basename}_INCLUDE_DIR) + #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}_INCLUDE_DIR) + ENDMACRO (_QT4_ADJUST_LIB_VARS) + + + # Set QT_xyz_LIBRARY variable and add + # library include path to QT_INCLUDES + _QT4_ADJUST_LIB_VARS(QTCORE) + _QT4_ADJUST_LIB_VARS(QTGUI) + _QT4_ADJUST_LIB_VARS(QT3SUPPORT) + _QT4_ADJUST_LIB_VARS(QTASSISTANT) + _QT4_ADJUST_LIB_VARS(QTDESIGNER) + _QT4_ADJUST_LIB_VARS(QTDESIGNERCOMPONENTS) + _QT4_ADJUST_LIB_VARS(QTNETWORK) + _QT4_ADJUST_LIB_VARS(QTNSPLUGIN) + _QT4_ADJUST_LIB_VARS(QTOPENGL) + _QT4_ADJUST_LIB_VARS(QTSQL) + _QT4_ADJUST_LIB_VARS(QTXML) + _QT4_ADJUST_LIB_VARS(QTSVG) + _QT4_ADJUST_LIB_VARS(QTUITOOLS) + _QT4_ADJUST_LIB_VARS(QTTEST) + _QT4_ADJUST_LIB_VARS(QTDBUS) + + + # platform dependent libraries + IF(Q_WS_X11) + _QT4_ADJUST_LIB_VARS(QTMOTIF) + ENDIF(Q_WS_X11) + IF(WIN32) + _QT4_ADJUST_LIB_VARS(QTMAIN) + ENDIF(WIN32) + + + ####################################### + # + # Check the executables of Qt + # ( moc, uic, rcc ) + # + ####################################### + + + # find moc and uic using qmake + QT_QUERY_QMAKE(QT_MOC_EXECUTABLE_INTERNAL "QMAKE_MOC") + QT_QUERY_QMAKE(QT_UIC_EXECUTABLE_INTERNAL "QMAKE_UIC") + + 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 qdbuscpp2xml + PATHS ${QT_BINARY_DIR} + NO_DEFAULT_PATH + ) + + FIND_PROGRAM(QT_DBUSXML2CPP_EXECUTABLE + NAMES qdbusxml2cpp + 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 QT_DBUSXML2CPP_EXECUTABLE QT_DBUSCPP2XML_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}) + + SET_SOURCE_FILES_PROPERTIES(${outfile} PROPERTIES SKIP_AUTOMOC TRUE) # dont run automoc on this file + + MACRO_ADD_FILE_DEPENDENCIES(${abs_infile} ${outfile}) + ENDMACRO (QT4_GENERATE_MOC) + + + # QT4_WRAP_CPP(outfiles inputfile ... ) + # TODO perhaps add support for -D, -U and other minor options + + MACRO (QT4_WRAP_CPP outfiles ) + # get include dirs + QT4_GET_MOC_INC_DIRS(moc_includes) + + 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) + GET_FILENAME_COMPONENT(rc_path ${infile} PATH) + SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/qrc_${outfilename}.cxx) + # parse file for dependencies + FILE(READ "${infile}" _RC_FILE_CONTENTS) + STRING(REGEX MATCHALL "<file>[^<]*" _RC_FILES "${_RC_FILE_CONTENTS}") + SET(_RC_DEPENDS) + FOREACH(_RC_FILE ${_RC_FILES}) + STRING(REGEX REPLACE "^<file>" "" _RC_FILE "${_RC_FILE}") + SET(_RC_DEPENDS ${_RC_DEPENDS} "${rc_path}/${_RC_FILE}") + ENDFOREACH(_RC_FILE) + ADD_CUSTOM_COMMAND(OUTPUT ${outfile} + COMMAND ${QT_RCC_EXECUTABLE} + ARGS -name ${outfilename} -o ${outfile} ${infile} + MAIN_DEPENDENCY ${infile} + DEPENDS ${_RC_DEPENDS}) + SET(${outfiles} ${${outfiles}} ${outfile}) + ENDFOREACH (it) + + ENDMACRO (QT4_ADD_RESOURCES) + + MACRO(QT4_ADD_DBUS_INTERFACE _sources _interface _basename) + GET_FILENAME_COMPONENT(_infile ${_interface} ABSOLUTE) + SET(_header ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h) + SET(_impl ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp) + SET(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc) + + 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) # _customName ) + SET(_customName "${ARGV1}") + GET_FILENAME_COMPONENT(_in_file ${_header} ABSOLUTE) + GET_FILENAME_COMPONENT(_basename ${_header} NAME_WE) + + IF (_customName) + SET(_target ${CMAKE_CURRENT_BINARY_DIR}/${_customName}) + ELSE (_customName) + SET(_target ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.xml) + ENDIF (_customName) + + ADD_CUSTOM_COMMAND(OUTPUT ${_target} + COMMAND ${QT_DBUSCPP2XML_EXECUTABLE} ${_in_file} > ${_target} + DEPENDS ${_in_file} + ) + ENDMACRO(QT4_GENERATE_DBUS_INTERFACE) + + + MACRO(QT4_ADD_DBUS_ADAPTOR _sources _xml_file _include _parentClass) # _optionalBasename ) + GET_FILENAME_COMPONENT(_infile ${_xml_file} ABSOLUTE) + + SET(_optionalBasename "${ARGV4}") + IF (_optionalBasename) + SET(_basename ${_optionalBasename} ) + ELSE (_optionalBasename) + STRING(REGEX REPLACE "(.*[/\\.])?([^\\.]+)\\.xml" "\\2adaptor" _basename ${_infile}) + STRING(TOLOWER ${_basename} _basename) + ENDIF (_optionalBasename) + + SET(_optionalClassName "${ARGV5}") + SET(_header ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h) + SET(_impl ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp) + SET(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc) + + IF(_optionalClassName) + ADD_CUSTOM_COMMAND(OUTPUT ${_impl} ${_header} + COMMAND ${QT_DBUSXML2CPP_EXECUTABLE} -m -a ${_basename} -c ${_optionalClassName} -i ${_include} -l ${_parentClass} ${_infile} + DEPENDS ${_infile} + ) + ELSE(_optionalClassName) + ADD_CUSTOM_COMMAND(OUTPUT ${_impl} ${_header} + COMMAND ${QT_DBUSXML2CPP_EXECUTABLE} -m -a ${_basename} -i ${_include} -l ${_parentClass} ${_infile} + DEPENDS ${_infile} + ) + ENDIF(_optionalClassName) + + QT4_GENERATE_MOC(${_header} ${_moc}) + SET_SOURCE_FILES_PROPERTIES(${_impl} PROPERTIES SKIP_AUTOMOC TRUE) + MACRO_ADD_FILE_DEPENDENCIES(${_impl} ${_moc}) + + SET(${_sources} ${${_sources}} ${_impl} ${_header} ${_moc}) + ENDMACRO(QT4_ADD_DBUS_ADAPTOR) + + MACRO(QT4_AUTOMOC) + QT4_GET_MOC_INC_DIRS(_moc_INCS) + + SET(_matching_FILES ) + FOREACH (_current_FILE ${ARGN}) + + GET_FILENAME_COMPONENT(_abs_FILE ${_current_FILE} ABSOLUTE) + # if "SKIP_AUTOMOC" is set to true, we will not handle this file here. + # here. this is required to make bouic work correctly: + # we need to add generated .cpp files to the sources (to compile them), + # but we cannot let automoc handle them, as the .cpp files don't exist yet when + # cmake is run for the very first time on them -> however the .cpp files might + # exist at a later run. at that time we need to skip them, so that we don't add two + # different rules for the same moc file + GET_SOURCE_FILE_PROPERTY(_skip ${_abs_FILE} SKIP_AUTOMOC) + + IF ( NOT _skip AND EXISTS ${_abs_FILE} ) + + FILE(READ ${_abs_FILE} _contents) + + GET_FILENAME_COMPONENT(_abs_PATH ${_abs_FILE} PATH) + + STRING(REGEX MATCHALL "#include +[^ ]+\\.moc[\">]" _match "${_contents}") + IF(_match) + FOREACH (_current_MOC_INC ${_match}) + STRING(REGEX MATCH "[^ <\"]+\\.moc" _current_MOC "${_current_MOC_INC}") + + GET_filename_component(_basename ${_current_MOC} NAME_WE) + # SET(_header ${CMAKE_CURRENT_SOURCE_DIR}/${_basename}.h) + 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) + IF ( NOT QT_LIBRARY_DIR ) + MESSAGE(STATUS "Qt libraries NOT found!") + ENDIF(NOT QT_LIBRARY_DIR ) + IF ( NOT QT_INCLUDE_DIR ) + MESSAGE(STATUS "Qt includes NOT found!") + ENDIF( NOT QT_INCLUDE_DIR ) + IF ( NOT QT_MOC_EXECUTABLE ) + MESSAGE(STATUS "Qt's moc NOT found!") + ENDIF( NOT QT_MOC_EXECUTABLE ) + IF ( NOT QT_UIC_EXECUTABLE ) + MESSAGE(STATUS "Qt's uic NOT found!") + ENDIF( NOT QT_UIC_EXECUTABLE ) + IF ( NOT QT_RCC_EXECUTABLE ) + MESSAGE(STATUS "Qt's rcc NOT found!") + ENDIF( NOT QT_RCC_EXECUTABLE ) + MESSAGE( FATAL_ERROR "Qt libraries, includes, moc, uic or/and rcc NOT found!") + ENDIF( Qt4_FIND_REQUIRED) + ENDIF( 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/cmakemodules/FindStrigi.cmake b/cmakemodules/FindStrigi.cmake new file mode 100644 index 0000000..072ad84 --- /dev/null +++ b/cmakemodules/FindStrigi.cmake @@ -0,0 +1,47 @@ +# - Try to find Strigi +# Once done this will define +# +# STRIGI_FOUND - system has Strigi +# STRIGI_INCLUDE_DIR - the Strigi include directory +# STRIGIHTMLGUI_LIBRARY - Link these to use Strigi html gui +# STRIGICLIENT_LIBRARY - Link to use the Strigi C++ client +# + +FIND_PATH(STRIGI_INCLUDE_DIR strigihtmlgui.h + PATHS + $ENV{HOME}/include/strigi + $ENV{HOME}/usr/include/strigi + $ENV{KDEDIR}/include/strigi + /opt/kde/include/strigi + /opt/kde3/include/strigi + /opt/kde4/include/strigi + /usr/kde/3.5/include/strigi + /usr/include/strigi + /usr/local/include/strigi + /opt/include/strigi + ${INCLUDE_SEARCH_PATHES} +) + +FIND_LIBRARY(STRIGIHTMLGUI_LIBRARY NAMES strigihtmlgui + PATHS + ${LIB_SEARCH_PATHES} +) +FIND_LIBRARY(STRIGICLIENT_LIBRARY NAMES searchclient + PATHS + ${LIB_SEARCH_PATHES} +) + +IF(STRIGI_INCLUDE_DIR AND STRIGIHTMLGUI_LIBRARY AND STRIGICLIENT_LIBRARY) + SET(STRIGI_FOUND TRUE) +ENDIF(STRIGI_INCLUDE_DIR AND STRIGIHTMLGUI_LIBRARY AND STRIGICLIENT_LIBRARY) + +IF(STRIGI_FOUND) + IF(NOT Strigi_FIND_QUIETLY) + MESSAGE(STATUS "Found Strigi: ${STRIGIHTMLGUI_LIBRARY}") + ENDIF(NOT Strigi_FIND_QUIETLY) +ELSE(STRIGI_FOUND) + IF(Strigi_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could not find Strigi! Please download and install Strigi from http://strigi.sf.net") + ENDIF(Strigi_FIND_REQUIRED) +ENDIF(STRIGI_FOUND) + diff --git a/cmakemodules/FindX11.cmake b/cmakemodules/FindX11.cmake new file mode 100644 index 0000000..1fd45e1 --- /dev/null +++ b/cmakemodules/FindX11.cmake @@ -0,0 +1,352 @@ +# - Find X11 installation +# Try to find X11 on UNIX systems. The following values are defined +# X11_FOUND - True if X11 is available +# X11_INCLUDE_DIR - include directories to use X11 +# X11_LIBRARIES - link against these to use X11 + +# Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. +# See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. + +if (UNIX) + set(X11_FOUND 0) + + set(X11_INC_SEARCH_PATH + /usr/X11R6/include + /usr/local/include + /usr/include/X11 + /usr/openwin/include + /usr/openwin/share/include + /opt/graphics/OpenGL/include + /usr/include + ) + + set(X11_LIB_SEARCH_PATH + /usr/X11R6/lib + /usr/local/lib + /usr/openwin/lib + /usr/lib + ) + + FIND_PATH(X11_X11_INCLUDE_PATH X11/X.h ${X11_INC_SEARCH_PATH}) + FIND_PATH(X11_Xlib_INCLUDE_PATH X11/Xlib.h ${X11_INC_SEARCH_PATH}) + + # Look for includes; keep the list sorted by name of the cmake *_INCLUDE_PATH + # variable (which doesn't need to match the include file name). + + # Solaris lacks XKBrules.h, so we should skip kxkbd there. + FIND_PATH(X11_Xaccessrules_INCLUDE_PATH X11/extensions/XKBrules.h ${X11_INC_SEARCH_PATH}) + FIND_PATH(X11_Xaccessstr_INCLUDE_PATH X11/extensions/XKBstr.h ${X11_INC_SEARCH_PATH}) + FIND_PATH(X11_Xcomposite_INCLUDE_PATH X11/extensions/Xcomposite.h ${X11_INC_SEARCH_PATH}) + FIND_PATH(X11_Xcursor_INCLUDE_PATH X11/Xcursor/Xcursor.h ${X11_INC_SEARCH_PATH}) + FIND_PATH(X11_Xdamage_INCLUDE_PATH X11/extensions/Xdamage.h ${X11_INC_SEARCH_PATH}) + FIND_PATH(X11_Xdmcp_INCLUDE_PATH X11/Xdmcp.h ${X11_INC_SEARCH_PATH}) + FIND_PATH(X11_dpms_INCLUDE_PATH X11/extensions/dpms.h ${X11_INC_SEARCH_PATH}) + FIND_PATH(X11_Xf86misc_INCLUDE_PATH X11/extensions/xf86misc.h ${X11_INC_SEARCH_PATH}) + FIND_PATH(X11_xf86vmode_INCLUDE_PATH X11/extensions/xf86vmode.h ${X11_INC_SEARCH_PATH}) + FIND_PATH(X11_Xfixes_INCLUDE_PATH X11/extensions/Xfixes.h ${X11_INC_SEARCH_PATH}) + FIND_PATH(X11_Xft_INCLUDE_PATH X11/Xft/Xft.h ${X11_INC_SEARCH_PATH}) + FIND_PATH(X11_Xinerama_INCLUDE_PATH X11/extensions/Xinerama.h ${X11_INC_SEARCH_PATH}) + FIND_PATH(X11_Xinput_INCLUDE_PATH X11/extensions/XInput.h ${X11_INC_SEARCH_PATH}) + FIND_PATH(X11_Xkb_INCLUDE_PATH X11/extensions/XKB.h ${X11_INC_SEARCH_PATH}) + FIND_PATH(X11_Xkblib_INCLUDE_PATH X11/XKBlib.h ${X11_INC_SEARCH_PATH}) + FIND_PATH(X11_Xpm_INCLUDE_PATH X11/xpm.h ${X11_INC_SEARCH_PATH}) + FIND_PATH(X11_XTest_INCLUDE_PATH X11/extensions/XTest.h ${X11_INC_SEARCH_PATH}) + FIND_PATH(X11_Xrandr_INCLUDE_PATH X11/extensions/Xrandr.h ${X11_INC_SEARCH_PATH}) + FIND_PATH(X11_Xrender_INCLUDE_PATH X11/extensions/Xrender.h ${X11_INC_SEARCH_PATH}) + FIND_PATH(X11_Xscreensaver_INCLUDE_PATH X11/extensions/scrnsaver.h ${X11_INC_SEARCH_PATH}) + FIND_PATH(X11_Xshape_INCLUDE_PATH X11/extensions/shape.h ${X11_INC_SEARCH_PATH}) + FIND_PATH(X11_Xutil_INCLUDE_PATH X11/Xutil.h ${X11_INC_SEARCH_PATH}) + FIND_PATH(X11_Xv_INCLUDE_PATH X11/extensions/Xvlib.h ${X11_INC_SEARCH_PATH}) + + + FIND_LIBRARY(X11_X11_LIB X11 ${X11_LIB_SEARCH_PATH} NO_SYSTEM_PATH) + + # Find additional X libraries. Keep list sorted by library name. + FIND_LIBRARY(X11_Xau_LIB Xau ${X11_LIB_SEARCH_PATH} NO_SYSTEM_PATH) + FIND_LIBRARY(X11_Xcomposite_LIB Xcomposite ${X11_LIB_SEARCH_PATH} NO_SYSTEM_PATH) + FIND_LIBRARY(X11_Xcursor_LIB Xcursor ${X11_LIB_SEARCH_PATH} NO_SYSTEM_PATH) + FIND_LIBRARY(X11_Xdamage_LIB Xdamage ${X11_LIB_SEARCH_PATH} NO_SYSTEM_PATH) + FIND_LIBRARY(X11_Xdmcp_LIB Xdmcp ${X11_LIB_SEARCH_PATH} NO_SYSTEM_PATH) + FIND_LIBRARY(X11_Xext_LIB Xext ${X11_LIB_SEARCH_PATH} NO_SYSTEM_PATH) + FIND_LIBRARY(X11_Xfixes_LIB Xfixes ${X11_LIB_SEARCH_PATH} NO_SYSTEM_PATH) + FIND_LIBRARY(X11_Xft_LIB Xft ${X11_LIB_SEARCH_PATH} NO_SYSTEM_PATH) + FIND_LIBRARY(X11_Xinerama_LIB Xinerama ${X11_LIB_SEARCH_PATH} NO_SYSTEM_PATH) + FIND_LIBRARY(X11_Xinput_LIB Xi ${X11_LIB_SEARCH_PATH} NO_SYSTEM_PATH) + FIND_LIBRARY(X11_Xpm_LIB Xpm ${X11_LIB_SEARCH_PATH} NO_SYSTEM_PATH) + FIND_LIBRARY(X11_Xrandr_LIB Xrandr ${X11_LIB_SEARCH_PATH} NO_SYSTEM_PATH) + FIND_LIBRARY(X11_Xrender_LIB Xrender ${X11_LIB_SEARCH_PATH} NO_SYSTEM_PATH) + FIND_LIBRARY(X11_Xss_LIB Xss ${X11_LIB_SEARCH_PATH} NO_SYSTEM_PATH) + FIND_LIBRARY(X11_Xt_LIB Xt ${X11_LIB_SEARCH_PATH} NO_SYSTEM_PATH) + FIND_LIBRARY(X11_XTest_LIB Xtst ${X11_LIB_SEARCH_PATH} NO_SYSTEM_PATH) + FIND_LIBRARY(X11_Xv_LIB Xv ${X11_LIB_SEARCH_PATH} NO_SYSTEM_PATH) + FIND_LIBRARY(X11_Xxf86misc_LIB Xxf86misc ${X11_LIB_SEARCH_PATH} NO_SYSTEM_PATH) + + if (X11_X11_INCLUDE_PATH) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_X11_INCLUDE_PATH}) + endif (X11_X11_INCLUDE_PATH) + + if (X11_Xlib_INCLUDE_PATH) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xlib_INCLUDE_PATH}) + endif (X11_Xlib_INCLUDE_PATH) + + if (X11_Xutil_INCLUDE_PATH) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xutil_INCLUDE_PATH}) + endif (X11_Xutil_INCLUDE_PATH) + + if(X11_Xshape_INCLUDE_PATH) + set(X11_Xshape_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xshape_INCLUDE_PATH}) + endif(X11_Xshape_INCLUDE_PATH) + + if (X11_X11_LIB) + set(X11_LIBRARIES ${X11_LIBRARIES} ${X11_X11_LIB}) + endif (X11_X11_LIB) + + if (X11_Xext_LIB) + set(X11_LIBRARIES ${X11_LIBRARIES} ${X11_Xext_LIB}) + endif (X11_Xext_LIB) + + if(X11_Xft_LIB AND X11_Xft_INCLUDE_PATH) + set(X11_XFT_FOUND TRUE) + set(X11_LIBRARIES ${X11_LIBRARIES} ${X11_Xft_LIB}) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xft_INCLUDE_PATH}) + endif(X11_Xft_LIB AND X11_Xft_INCLUDE_PATH) + + if(X11_Xv_LIB AND X11_Xv_INCLUDE_PATH) + set(X11_XV_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xv_INCLUDE_PATH}) + endif(X11_Xv_LIB AND X11_Xv_INCLUDE_PATH) + + if (X11_Xau_LIB) + set(X11_Xau_FOUND TRUE) + set(X11_LIBRARIES ${X11_LIBRARIES} ${X11_Xau_LIB}) + endif (X11_Xau_LIB) + + if (X11_Xdmcp_INCLUDE_PATH AND X11_Xdmcp_LIB) + set(X11_Xdmcp_FOUND TRUE) + set(X11_LIBRARIES ${X11_LIBRARIES} ${X11_Xdmcp_LIB}) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xdmcp_INCLUDE_PATH}) + endif (X11_Xdmcp_INCLUDE_PATH AND X11_Xdmcp_LIB) + + if (X11_Xaccessrules_INCLUDE_PATH AND X11_Xaccessstr_INCLUDE_PATH) + set(X11_Xaccess_FOUND TRUE) + set(X11_Xaccess_INCLUDE_PATH ${X11_Xaccessstr_INCLUDE_PATH}) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xaccess_INCLUDE_PATH}) + endif (X11_Xaccessrules_INCLUDE_PATH AND X11_Xaccessstr_INCLUDE_PATH) + + if (X11_Xpm_INCLUDE_PATH AND X11_Xpm_LIB) + set(X11_Xpm_FOUND TRUE) + set(X11_LIBRARIES ${X11_LIBRARIES} ${X11_Xpm_LIB}) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xpm_INCLUDE_PATH}) + endif (X11_Xpm_INCLUDE_PATH AND X11_Xpm_LIB) + + + if (X11_Xcomposite_INCLUDE_PATH) + set(X11_Xcomposite_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xcomposite_INCLUDE_PATH}) + endif (X11_Xcomposite_INCLUDE_PATH) + + if (X11_Xdamage_INCLUDE_PATH) + set(X11_Xdamage_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xdamage_INCLUDE_PATH}) + endif (X11_Xdamage_INCLUDE_PATH) + + if (X11_XTest_INCLUDE_PATH AND X11_XTest_LIB) + set(X11_XTest_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_XTest_INCLUDE_PATH}) + endif (X11_XTest_INCLUDE_PATH AND X11_XTest_LIB) + + if (X11_Xinerama_INCLUDE_PATH) + set(X11_Xinerama_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xinerama_INCLUDE_PATH}) + endif (X11_Xinerama_INCLUDE_PATH) + + if (X11_Xfixes_INCLUDE_PATH) + set(X11_Xfixes_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xfixes_INCLUDE_PATH}) + endif (X11_Xfixes_INCLUDE_PATH) + + if (X11_Xrender_INCLUDE_PATH AND X11_Xrender_LIB) + set(X11_Xrender_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xrender_INCLUDE_PATH}) + endif (X11_Xrender_INCLUDE_PATH AND X11_Xrender_LIB) + + if (X11_Xrandr_INCLUDE_PATH) + set(X11_Xrandr_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xrandr_INCLUDE_PATH}) + endif (X11_Xrandr_INCLUDE_PATH) + + if (X11_Xxf86misc_INCLUDE_PATH) + set(X11_Xxf86misc_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xxf86misc_INCLUDE_PATH}) + endif (X11_Xxf86misc_INCLUDE_PATH) + + if (X11_xf86vmode_INCLUDE_PATH) + set(X11_xf86vmode_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_xf86vmode_INCLUDE_PATH}) + endif (X11_xf86vmode_INCLUDE_PATH) + + if (X11_Xcursor_INCLUDE_PATH AND X11_Xcursor_LIB) + set(X11_Xcursor_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xcursor_INCLUDE_PATH}) + endif (X11_Xcursor_INCLUDE_PATH AND X11_Xcursor_LIB) + + if (X11_Xscreensaver_INCLUDE_PATH) + set(X11_Xscreensaver_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xscreensaver_INCLUDE_PATH}) + endif (X11_Xscreensaver_INCLUDE_PATH) + + if (X11_dpms_INCLUDE_PATH) + set(X11_dpms_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_dpms_INCLUDE_PATH}) + endif (X11_dpms_INCLUDE_PATH) + + if (X11_Xkb_INCLUDE_PATH AND X11_Xkblib_INCLUDE_PATH AND X11_Xlib_INCLUDE_PATH) + set(X11_Xkb_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xkb_INCLUDE_PATH} ) + endif (X11_Xkb_INCLUDE_PATH AND X11_Xkblib_INCLUDE_PATH AND X11_Xlib_INCLUDE_PATH) + + if (X11_Xinput_INCLUDE_PATH AND X11_Xinput_LIB) + set(X11_Xinput_FOUND TRUE) + set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xinput_INCLUDE_PATH}) + endif (X11_Xinput_INCLUDE_PATH AND X11_Xinput_LIB) + + # Deprecated variable for backwards compatibility with CMake 1.4 + if (X11_X11_INCLUDE_PATH) + if (X11_LIBRARIES) + set(X11_FOUND 1) + endif (X11_LIBRARIES) + endif (X11_X11_INCLUDE_PATH) + + set(X11_LIBRARY_DIR "") + if (X11_X11_LIB) + GET_FILENAME_COMPONENT(X11_LIBRARY_DIR ${X11_X11_LIB} PATH) + endif (X11_X11_LIB) + + if (X11_FOUND) + INCLUDE(CheckFunctionExists) + INCLUDE(CheckLibraryExists) + + # Translated from an autoconf-generated configure script. + # See libs.m4 in autoconf's m4 directory. + if ($ENV{ISC} MATCHES "^yes$") + set(X11_X_EXTRA_LIBS -lnsl_s -linet) + else ($ENV{ISC} MATCHES "^yes$") + set(X11_X_EXTRA_LIBS "") + + # See if XOpenDisplay in X11 works by itself. + CHECK_LIBRARY_EXISTS("${X11_LIBRARIES}" "XOpenDisplay" "${X11_LIBRARY_DIR}" X11_LIB_X11_SOLO) + if (NOT X11_LIB_X11_SOLO) + # Find library needed for dnet_ntoa. + CHECK_LIBRARY_EXISTS("dnet" "dnet_ntoa" "" X11_LIB_DNET_HAS_DNET_NTOA) + if (X11_LIB_DNET_HAS_DNET_NTOA) + set(X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -ldnet) + else (X11_LIB_DNET_HAS_DNET_NTOA) + CHECK_LIBRARY_EXISTS("dnet_stub" "dnet_ntoa" "" X11_LIB_DNET_STUB_HAS_DNET_NTOA) + if (X11_LIB_DNET_STUB_HAS_DNET_NTOA) + set(X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -ldnet_stub) + endif (X11_LIB_DNET_STUB_HAS_DNET_NTOA) + endif (X11_LIB_DNET_HAS_DNET_NTOA) + endif (NOT X11_LIB_X11_SOLO) + + # Find library needed for gethostbyname. + CHECK_FUNCTION_EXISTS("gethostbyname" CMAKE_HAVE_GETHOSTBYNAME) + if (NOT CMAKE_HAVE_GETHOSTBYNAME) + CHECK_LIBRARY_EXISTS("nsl" "gethostbyname" "" CMAKE_LIB_NSL_HAS_GETHOSTBYNAME) + if (CMAKE_LIB_NSL_HAS_GETHOSTBYNAME) + set(X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -lnsl) + else (CMAKE_LIB_NSL_HAS_GETHOSTBYNAME) + CHECK_LIBRARY_EXISTS("bsd" "gethostbyname" "" CMAKE_LIB_BSD_HAS_GETHOSTBYNAME) + if (CMAKE_LIB_BSD_HAS_GETHOSTBYNAME) + set(X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -lbsd) + endif (CMAKE_LIB_BSD_HAS_GETHOSTBYNAME) + endif (CMAKE_LIB_NSL_HAS_GETHOSTBYNAME) + endif (NOT CMAKE_HAVE_GETHOSTBYNAME) + + # Find library needed for connect. + CHECK_FUNCTION_EXISTS("connect" CMAKE_HAVE_CONNECT) + if (NOT CMAKE_HAVE_CONNECT) + CHECK_LIBRARY_EXISTS("socket" "connect" "" CMAKE_LIB_SOCKET_HAS_CONNECT) + if (CMAKE_LIB_SOCKET_HAS_CONNECT) + set(X11_X_EXTRA_LIBS -lsocket ${X11_X_EXTRA_LIBS}) + endif (CMAKE_LIB_SOCKET_HAS_CONNECT) + endif (NOT CMAKE_HAVE_CONNECT) + + # Find library needed for remove. + CHECK_FUNCTION_EXISTS("remove" CMAKE_HAVE_REMOVE) + if (NOT CMAKE_HAVE_REMOVE) + CHECK_LIBRARY_EXISTS("posix" "remove" "" CMAKE_LIB_POSIX_HAS_REMOVE) + if (CMAKE_LIB_POSIX_HAS_REMOVE) + set(X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -lposix) + endif (CMAKE_LIB_POSIX_HAS_REMOVE) + endif (NOT CMAKE_HAVE_REMOVE) + + # Find library needed for shmat. + CHECK_FUNCTION_EXISTS("shmat" CMAKE_HAVE_SHMAT) + if (NOT CMAKE_HAVE_SHMAT) + CHECK_LIBRARY_EXISTS("ipc" "shmat" "" CMAKE_LIB_IPS_HAS_SHMAT) + if (CMAKE_LIB_IPS_HAS_SHMAT) + set(X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -lipc) + endif (CMAKE_LIB_IPS_HAS_SHMAT) + endif (NOT CMAKE_HAVE_SHMAT) + endif ($ENV{ISC} MATCHES "^yes$") + + CHECK_LIBRARY_EXISTS("ICE" "IceConnectionNumber" "${X11_LIBRARY_DIR}" + CMAKE_LIB_ICE_HAS_ICECONNECTIONNUMBER) + if (CMAKE_LIB_ICE_HAS_ICECONNECTIONNUMBER) + set(X11_X_PRE_LIBS -lSM -lICE) + endif (CMAKE_LIB_ICE_HAS_ICECONNECTIONNUMBER) + # Build the final list of libraries. + set(X11_LIBRARIES ${X11_X_PRE_LIBS} ${X11_LIBRARIES} ${X11_X_EXTRA_LIBS}) + endif (X11_FOUND) + + MARK_AS_ADVANCED( + X11_X11_INCLUDE_PATH + X11_X11_LIB + X11_Xext_LIB + X11_Xau_LIB + X11_Xlib_INCLUDE_PATH + X11_Xutil_INCLUDE_PATH + X11_Xcomposite_INCLUDE_PATH + X11_Xcomposite_LIB + X11_Xaccess_INCLUDE_PATH + X11_Xfixes_LIB + X11_Xfixes_INCLUDE_PATH + X11_Xrandr_LIB + X11_Xrandr_INCLUDE_PATH + X11_Xdamage_LIB + X11_Xdamage_INCLUDE_PATH + X11_Xrender_LIB + X11_Xrender_INCLUDE_PATH + X11_Xxf86misc_LIB + X11_Xxf86misc_INCLUDE_PATH + X11_Xinerama_LIB + X11_Xinerama_INCLUDE_PATH + X11_XTest_LIB + X11_XTest_INCLUDE_PATH + X11_Xcursor_LIB + X11_Xcursor_INCLUDE_PATH + X11_dpms_INCLUDE_PATH + X11_Xt_LIB + X11_Xss_LIB + X11_Xdmcp_LIB + X11_LIBRARIES + X11_Xaccessrules_INCLUDE_PATH + X11_Xaccessstr_INCLUDE_PATH + X11_Xdmcp_INCLUDE_PATH + X11_Xf86misc_INCLUDE_PATH + X11_Xkb_INCLUDE_PATH + X11_Xkblib_INCLUDE_PATH + X11_Xscreensaver_INCLUDE_PATH + X11_Xpm_INCLUDE_PATH + X11_Xpm_LIB + X11_Xinput_LIB + X11_Xinput_INCLUDE_PATH + X11_Xft_LIB + X11_Xft_INCLUDE_PATH + X11_Xshape_INCLUDE_PATH + X11_Xv_LIB + X11_Xv_INCLUDE_PATH + ) + +endif (UNIX) diff --git a/cmakemodules/KDE3Macros.cmake b/cmakemodules/KDE3Macros.cmake new file mode 100644 index 0000000..f132854 --- /dev/null +++ b/cmakemodules/KDE3Macros.cmake @@ -0,0 +1,392 @@ +# + +# See FindKDE3.cmake for documentation. +# +# this file contains the following macros: +# KDE3_ADD_DCOP_SKELS +# KDE3_ADD_DCOP_STUBS +# KDE3_ADD_MOC_FILES +# KDE3_ADD_UI_FILES +# KDE3_ADD_KCFG_FILES +# KDE3_AUTOMOC +# KDE3_INSTALL_LIBTOOL_FILE +# KDE3_CREATE_FINAL_FILE +# KDE3_ADD_KPART +# KDE3_ADD_KDEINIT_EXECUTABLE +# KDE3_ADD_EXECUTABLE + +#neundorf@kde.org +# +# Modified by PhobosK <phobosk@mail.kbfx.org> + +INCLUDE(AddFileDependencies) + +#create the kidl and skeletion file for dcop stuff +#usage: KDE_ADD_COP_SKELS(foo_SRCS ${dcop_headers}) +MACRO(KDE3_ADD_DCOP_SKELS _sources) + FOREACH (_current_FILE ${ARGN}) + + GET_FILENAME_COMPONENT(_tmp_FILE ${_current_FILE} ABSOLUTE) + GET_FILENAME_COMPONENT(_basename ${_tmp_FILE} NAME_WE) + + SET(_skel ${CMAKE_CURRENT_BINARY_DIR}/${_basename}_skel.cpp) + SET(_kidl ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.kidl) + + IF (NOT HAVE_${_basename}_KIDL_RULE) + SET(HAVE_${_basename}_KIDL_RULE ON) + + ADD_CUSTOM_COMMAND(OUTPUT ${_kidl} + COMMAND ${KDE3_DCOPIDL_EXECUTABLE} + ARGS ${CMAKE_CURRENT_SOURCE_DIR}/${_current_FILE} > ${_kidl} + DEPENDS ${_tmp_FILE} + ) + ENDIF (NOT HAVE_${_basename}_KIDL_RULE) + + IF (NOT HAVE_${_basename}_SKEL_RULE) + SET(HAVE_${_basename}_SKEL_RULE ON) + + ADD_CUSTOM_COMMAND(OUTPUT ${_skel} + COMMAND ${KDE3_DCOPIDL2CPP_EXECUTABLE} + ARGS --c++-suffix cpp --no-signals --no-stub ${_kidl} + DEPENDS ${_kidl} + ) + + ENDIF (NOT HAVE_${_basename}_SKEL_RULE) + + SET(${_sources} ${${_sources}} ${_skel}) + + ENDFOREACH (_current_FILE) + +ENDMACRO(KDE3_ADD_DCOP_SKELS) + + +MACRO(KDE3_ADD_DCOP_STUBS _sources) + FOREACH (_current_FILE ${ARGN}) + + GET_FILENAME_COMPONENT(_tmp_FILE ${_current_FILE} ABSOLUTE) + + GET_FILENAME_COMPONENT(_basename ${_tmp_FILE} NAME_WE) + + SET(_stub_CPP ${CMAKE_CURRENT_BINARY_DIR}/${_basename}_stub.cpp) + SET(_kidl ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.kidl) + + IF (NOT HAVE_${_basename}_KIDL_RULE) + SET(HAVE_${_basename}_KIDL_RULE ON) + + + ADD_CUSTOM_COMMAND(OUTPUT ${_kidl} + COMMAND ${KDE3_DCOPIDL_EXECUTABLE} + ARGS ${tmp_FILE} > ${_kidl} + DEPENDS ${tmp_FILE} + ) + + ENDIF (NOT HAVE_${_basename}_KIDL_RULE) + + + IF (NOT HAVE_${_basename}_STUB_RULE) + SET(HAVE_${_basename}_STUB_RULE ON) + + ADD_CUSTOM_COMMAND(OUTPUT ${_stub_CPP} + COMMAND ${KDE3_DCOPIDL2CPP_EXECUTABLE} + ARGS --c++-suffix cpp --no-signals --no-skel ${_kidl} + DEPENDS ${_kidl} + ) + + ENDIF (NOT HAVE_${_basename}_STUB_RULE) + + SET(${_sources} ${${_sources}} ${_stub_CPP}) + + ENDFOREACH (_current_FILE) + +ENDMACRO(KDE3_ADD_DCOP_STUBS) + + +MACRO(KDE3_ADD_KCFG_FILES _sources) + FOREACH (_current_FILE ${ARGN}) + + GET_FILENAME_COMPONENT(_tmp_FILE ${_current_FILE} ABSOLUTE) + + GET_FILENAME_COMPONENT(_basename ${_tmp_FILE} NAME_WE) + + FILE(READ ${_tmp_FILE} _contents) + STRING(REGEX REPLACE "^(.*\n)?File=([^\n]+)\n.*$" "\\2" _kcfg_FILE "${_contents}") + + SET(_src_FILE ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp) + SET(_header_FILE ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h) + + ADD_CUSTOM_COMMAND(OUTPUT ${_src_FILE} + COMMAND ${KDE3_KCFGC_EXECUTABLE} + ARGS ${CMAKE_CURRENT_SOURCE_DIR}/${_kcfg_FILE} ${_tmp_FILE} + DEPENDS ${_tmp_FILE} ${CMAKE_CURRENT_SOURCE_DIR}/${_kcfg_FILE} ) + + SET(${_sources} ${${_sources}} ${_src_FILE}) + + ENDFOREACH (_current_FILE) + +ENDMACRO(KDE3_ADD_KCFG_FILES) + + +#create the moc files and add them to the list of sources +#usage: KDE_ADD_MOC_FILES(foo_SRCS ${moc_headers}) +MACRO(KDE3_ADD_MOC_FILES _sources) + FOREACH (_current_FILE ${ARGN}) + + GET_FILENAME_COMPONENT(_tmp_FILE ${_current_FILE} ABSOLUTE) + + GET_FILENAME_COMPONENT(_basename ${_tmp_FILE} NAME_WE) + SET(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc.cpp) + + ADD_CUSTOM_COMMAND(OUTPUT ${_moc} + COMMAND ${QT_MOC_EXECUTABLE} + ARGS ${_tmp_FILE} -o ${_moc} + DEPENDS ${_tmp_FILE} + ) + + SET(${_sources} ${${_sources}} ${_moc}) + + ENDFOREACH (_current_FILE) +ENDMACRO(KDE3_ADD_MOC_FILES) + + +GET_FILENAME_COMPONENT( KDE3_MODULE_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) + +#create the implementation files from the ui files and add them to the list of sources +#usage: KDE_ADD_UI_FILES(foo_SRCS ${ui_files}) +MACRO(KDE3_ADD_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}/${_basename}.h) + SET(_src ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp) + SET(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc.cpp) + + ADD_CUSTOM_COMMAND(OUTPUT ${_header} + COMMAND ${QT_UIC_EXECUTABLE} + ARGS -L ${KDE3_LIB_DIR}/kde3/plugins/designer -nounload -o ${_header} ${CMAKE_CURRENT_SOURCE_DIR}/${_current_FILE} + DEPENDS ${_tmp_FILE} + ) + + ADD_CUSTOM_COMMAND(OUTPUT ${_src} + COMMAND ${CMAKE_COMMAND} + ARGS + -DKDE_UIC_PLUGIN_DIR:FILEPATH=${KDE3_LIB_DIR}/kde3/plugins/designer + -DKDE_UIC_EXECUTABLE:FILEPATH=${QT_UIC_EXECUTABLE} + -DKDE_UIC_FILE:FILEPATH=${_tmp_FILE} + -DKDE_UIC_CPP_FILE:FILEPATH=${_src} + -DKDE_UIC_H_FILE:FILEPATH=${_header} + -P ${KDE3_MODULE_DIR}/kde3uic.cmake + DEPENDS ${_header} + ) + + ADD_CUSTOM_COMMAND(OUTPUT ${_moc} + COMMAND ${QT_MOC_EXECUTABLE} + ARGS ${_header} -o ${_moc} + DEPENDS ${_header} + ) + + SET(${_sources} ${${_sources}} ${_src} ${_moc} ) + + ENDFOREACH (_current_FILE) +ENDMACRO(KDE3_ADD_UI_FILES) + + +MACRO(KDE3_AUTOMOC) + 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[\">]" _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 ${_header} -o ${_moc} + DEPENDS ${_header} + ) + + ADD_FILE_DEPENDENCIES(${_abs_FILE} ${_moc}) + + ENDFOREACH (_current_MOC_INC) + ENDIF(_match) + + ENDIF (EXISTS ${_abs_FILE} AND NOT _skip) + ENDFOREACH (_current_FILE) +ENDMACRO(KDE3_AUTOMOC) + +# only used internally by KDE3_INSTALL_ICONS +MACRO (_KDE3_ADD_ICON_INSTALL_RULE _install_SCRIPT _install_PATH _group _orig_NAME _install_NAME) + + # if the string doesn't match the pattern, the result is the full string, so all three have the same content + IF (NOT ${_group} STREQUAL ${_install_NAME} ) + SET(_icon_GROUP "actions") + + IF (${_group} STREQUAL "mime") + SET(_icon_GROUP "mimetypes") + ENDIF (${_group} STREQUAL "mime") + + IF (${_group} STREQUAL "filesys") + SET(_icon_GROUP "filesystems") + ENDIF (${_group} STREQUAL "filesys") + + IF (${_group} STREQUAL "device") + SET(_icon_GROUP "devices") + ENDIF (${_group} STREQUAL "device") + + IF (${_group} STREQUAL "app") + SET(_icon_GROUP "apps") + ENDIF (${_group} STREQUAL "app") + + IF (${_group} STREQUAL "action") + SET(_icon_GROUP "actions") + ENDIF (${_group} STREQUAL "action") + +# message(STATUS "icon: ${_current_ICON} size: ${_size} group: ${_group} name: ${_name}" ) + INSTALL(FILES ${_orig_NAME} DESTINATION ${_install_PATH}/${_icon_GROUP}/ RENAME ${_install_NAME} ) + ENDIF (NOT ${_group} STREQUAL ${_install_NAME} ) + +ENDMACRO (_KDE3_ADD_ICON_INSTALL_RULE) + + +MACRO (KDE3_INSTALL_ICONS _theme ) + SET(_defaultpath "${CMAKE_INSTALL_PREFIX}/share/icons") + # first the png icons + FILE(GLOB _icons *.png) + FOREACH (_current_ICON ${_icons} ) + STRING(REGEX REPLACE "^.*/[a-zA-Z]+([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\1" _size "${_current_ICON}") + STRING(REGEX REPLACE "^.*/[a-zA-Z]+([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\2" _group "${_current_ICON}") + STRING(REGEX REPLACE "^.*/[a-zA-Z]+([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\3" _name "${_current_ICON}") + _KDE3_ADD_ICON_INSTALL_RULE(${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake + ${_defaultpath}/${_theme}/${_size}x${_size} + ${_group} ${_current_ICON} ${_name}) + ENDFOREACH (_current_ICON) + + # and now the svg icons + FILE(GLOB _icons *.svgz) + FOREACH (_current_ICON ${_icons} ) + STRING(REGEX REPLACE "^.*/crsc\\-([a-z]+)\\-(.+\\.svgz)$" "\\1" _group "${_current_ICON}") + STRING(REGEX REPLACE "^.*/crsc\\-([a-z]+)\\-(.+\\.svgz)$" "\\2" _name "${_current_ICON}") + _KDE3_ADD_ICON_INSTALL_RULE(${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake + ${_defaultpath}/${_theme}/scalable + ${_group} ${_current_ICON} ${_name}) + ENDFOREACH (_current_ICON) + +ENDMACRO (KDE3_INSTALL_ICONS) + +MACRO(KDE3_INSTALL_LIBTOOL_FILE _target _place) + GET_TARGET_PROPERTY(_target_location ${_target} LOCATION) + + GET_FILENAME_COMPONENT(_laname ${_target_location} NAME_WE) + GET_FILENAME_COMPONENT(_soname ${_target_location} NAME) + SET(_laname ${CMAKE_CURRENT_BINARY_DIR}/${_laname}.la) + + FILE(WRITE ${_laname} "# ${_laname} - a libtool library file, generated by cmake \n") + FILE(APPEND ${_laname} "# The name that we can dlopen(3).\n") + FILE(APPEND ${_laname} "dlname='${_soname}'\n") + FILE(APPEND ${_laname} "# Names of this library\n") + FILE(APPEND ${_laname} "library_names='${_soname} ${_soname} ${_soname}'\n") + FILE(APPEND ${_laname} "# The name of the static archive\n") + FILE(APPEND ${_laname} "old_library=''\n") + FILE(APPEND ${_laname} "# Libraries that this one depends upon.\n") + FILE(APPEND ${_laname} "dependency_libs=''\n") +# FILE(APPEND ${_laname} "dependency_libs='${${_target}_LIB_DEPENDS}'\n") + FILE(APPEND ${_laname} "# Version information.\ncurrent=0\nage=0\nrevision=0\n") + FILE(APPEND ${_laname} "# Is this an already installed library?\ninstalled=yes\n") + FILE(APPEND ${_laname} "# Should we warn about portability when linking against -modules?\nshouldnotlink=yes\n") + FILE(APPEND ${_laname} "# Files to dlopen/dlpreopen\ndlopen=''\ndlpreopen=''\n") + FILE(APPEND ${_laname} "# Directory that this library needs to be installed in:\n") + FILE(APPEND ${_laname} "libdir='${_place}'\n") + INSTALL(FILES ${_laname} DESTINATION ${_place}) +ENDMACRO(KDE3_INSTALL_LIBTOOL_FILE) + + +MACRO(KDE3_CREATE_FINAL_FILE _filename) + FILE(WRITE ${_filename} "//autogenerated file\n") + FOREACH (_current_FILE ${ARGN}) + FILE(APPEND ${_filename} "#include \"${_current_FILE}\"\n") + ENDFOREACH (_current_FILE) + +ENDMACRO(KDE3_CREATE_FINAL_FILE) + + +OPTION(KDE3_ENABLE_FINAL "Enable final all-in-one compilation") +OPTION(KDE3_BUILD_TESTS "Build the tests") + + +MACRO(KDE3_ADD_KPART _target_NAME _with_PREFIX) +#is the first argument is "WITH_PREFIX" then keep the standard "lib" prefix, otherwise SET the prefix empty + IF (${_with_PREFIX} STREQUAL "WITH_PREFIX") + SET(_first_SRC) + ELSE (${_with_PREFIX} STREQUAL "WITH_PREFIX") + SET(_first_SRC ${_with_PREFIX}) + ENDIF (${_with_PREFIX} STREQUAL "WITH_PREFIX") + + IF (KDE3_ENABLE_FINAL) + KDE3_CREATE_FINAL_FILE(${_target_NAME}_final.cpp ${_first_SRC} ${ARGN}) + ADD_LIBRARY(${_target_NAME} MODULE ${_target_NAME}_final.cpp) + ELSE (KDE3_ENABLE_FINAL) + ADD_LIBRARY(${_target_NAME} MODULE ${_first_SRC} ${ARGN}) + ENDIF (KDE3_ENABLE_FINAL) + + IF(_first_SRC) + SET_TARGET_PROPERTIES(${_target_NAME} PROPERTIES PREFIX "") + ENDIF(_first_SRC) + + KDE3_INSTALL_LIBTOOL_FILE(${_target_NAME}) + +ENDMACRO(KDE3_ADD_KPART) + + +MACRO(KDE3_ADD_KDEINIT_EXECUTABLE _target_NAME ) + + IF (KDE3_ENABLE_FINAL) + KDE3_CREATE_FINAL_FILE(${_target_NAME}_final.cpp ${ARGN}) + ADD_LIBRARY(kdeinit_${_target_NAME} SHARED ${_target_NAME}_final.cpp) + ELSE (KDE3_ENABLE_FINAL) + ADD_LIBRARY(kdeinit_${_target_NAME} SHARED ${ARGN} ) + ENDIF (KDE3_ENABLE_FINAL) + + CONFIGURE_FILE(${KDE3_MODULE_DIR}/kde3init_dummy.cpp.in ${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_dummy.cpp) + + ADD_EXECUTABLE( ${_target_NAME} ${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_dummy.cpp ) + TARGET_LINK_LIBRARIES( ${_target_NAME} kdeinit_${_target_NAME} ) + +ENDMACRO(KDE3_ADD_KDEINIT_EXECUTABLE) + + +MACRO(KDE3_ADD_EXECUTABLE _target_NAME ) + + IF (KDE3_ENABLE_FINAL) + KDE3_CREATE_FINAL_FILE(${_target_NAME}_final.cpp ${ARGN}) + ADD_EXECUTABLE(${_target_NAME} ${_target_NAME}_final.cpp) + ELSE (KDE3_ENABLE_FINAL) + ADD_EXECUTABLE(${_target_NAME} ${ARGN} ) + ENDIF (KDE3_ENABLE_FINAL) + +ENDMACRO(KDE3_ADD_EXECUTABLE) + + diff --git a/cmakemodules/KDE4Macros.cmake b/cmakemodules/KDE4Macros.cmake new file mode 100644 index 0000000..8be1538 --- /dev/null +++ b/cmakemodules/KDE4Macros.cmake @@ -0,0 +1,854 @@ +# for documentation look at FindKDE4Internal.cmake +# +# this file contains the following macros: +# KDE4_ADD_UI_FILES +# KDE4_ADD_UI3_FILES +# KDE4_ADD_KCFG_FILES +# KDE4_AUTOMOC +# KDE4_INSTALL_LIBTOOL_FILE +# KDE4_CREATE_FINAL_FILES +# KDE4_ADD_KDEINIT_EXECUTABLE +# KDE4_ADD_EXECUTABLE +# KDE4_ADD_WIDGET_FILES +# KDE4_INSTALL_ICONS +# KDE4_REMOVE_OBSOLETE_CMAKE_FILES +# KDE4_NO_ENABLE_FINAL +# KDE4_CREATE_HANDBOOK +# KDE4_CREATE_HTML_HANDBOOK +# KDE4_INSTALL_HANDBOOK + +# Copyright (c) 2006, 2007, Alexander Neundorf, <neundorf@kde.org> +# Copyright (c) 2006, 2007, Laurent Montel, <montel@kde.org> +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# +# Modified by PhobosK <phobosk@mail.kbfx.org> + +macro (KDE4_ADD_KCFG_FILES _sources ) + if( ${ARGV1} STREQUAL "GENERATE_MOC" ) + set(_kcfg_generatemoc TRUE) + endif( ${ARGV1} STREQUAL "GENERATE_MOC" ) + + foreach (_current_FILE ${ARGN}) + + if(NOT ${_current_FILE} STREQUAL "GENERATE_MOC") + get_filename_component(_tmp_FILE ${_current_FILE} ABSOLUTE) + get_filename_component(_abs_PATH ${_tmp_FILE} PATH) + get_filename_component(_basename ${_tmp_FILE} NAME_WE) + + file(READ ${_tmp_FILE} _contents) + string(REGEX REPLACE "^(.*\n)?File=([^\n]+kcfg).*\n.*$" "\\2" _kcfg_FILE "${_contents}") + set(_src_FILE ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp) + set(_header_FILE ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h) + set(_moc_FILE ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc) + + # the command for creating the source file from the kcfg file + add_custom_command(OUTPUT ${_header_FILE} ${_src_FILE} + COMMAND ${KDE4_KCFGC_EXECUTABLE} + ARGS ${_abs_PATH}/${_kcfg_FILE} ${_tmp_FILE} -d ${CMAKE_CURRENT_BINARY_DIR} + MAIN_DEPENDENCY ${_tmp_FILE} + DEPENDS ${_abs_PATH}/${_kcfg_FILE} ${_KDE4_KCONFIG_COMPILER_DEP} ) + + if(_kcfg_generatemoc) + qt4_generate_moc(${_header_FILE} ${_moc_FILE} ) + set_source_files_properties(${_src_FILE} PROPERTIES SKIP_AUTOMOC TRUE) # dont run automoc on this file + list(APPEND ${_sources} ${_moc_FILE}) + endif(_kcfg_generatemoc) + +# if (KDE4_ENABLE_FINAL) +# kde4_create_final_files(${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_final_cpp.cpp _separate_files ${ARGN}) +# macro_add_file_dependencies(${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_final_cpp.cpp ${_src_FILE}) +# endif (KDE4_ENABLE_FINAL) + + list(APPEND ${_sources} ${_src_FILE} ${_header_FILE}) + endif(NOT ${_current_FILE} STREQUAL "GENERATE_MOC") + endforeach (_current_FILE) + +endmacro (KDE4_ADD_KCFG_FILES) + + +GET_FILENAME_COMPONENT(KDE4_MODULE_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) + +#create the implementation files from the ui files and add them to the list of sources +#usage: KDE4_ADD_UI_FILES(foo_SRCS ${ui_files}) +macro (KDE4_ADD_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 ${KDE4_MODULE_DIR}/kde4uic.cmake + MAIN_DEPENDENCY ${_tmp_FILE} + ) + list(APPEND ${_sources} ${_header}) + endforeach (_current_FILE) +endmacro (KDE4_ADD_UI_FILES) + + +#create the implementation files from the ui files and add them to the list of sources +#usage: KDE4_ADD_UI3_FILES(foo_SRCS ${ui_files}) +macro (KDE4_ADD_UI3_FILES _sources ) + + qt4_get_moc_inc_dirs(_moc_INCS) + + 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}/${_basename}.h) + set(_src ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp) + set(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc.cpp) + + add_custom_command(OUTPUT ${_header} + COMMAND ${CMAKE_COMMAND} + -DKDE3_HEADER:BOOL=ON + -DKDE_UIC_EXECUTABLE:FILEPATH=${QT_UIC3_EXECUTABLE} + -DKDE_UIC_FILE:FILEPATH=${_tmp_FILE} + -DKDE_UIC_H_FILE:FILEPATH=${_header} + -DKDE_UIC_BASENAME:STRING=${_basename} + -DKDE_UIC_PLUGIN_DIR:FILEPATH="." + -P ${KDE4_MODULE_DIR}/kde4uic.cmake + MAIN_DEPENDENCY ${_tmp_FILE} + ) + +# we need to run uic3 and replace some things in the generated file + # this is done by executing the cmake script kde4uic.cmake + add_custom_command(OUTPUT ${_src} + COMMAND ${CMAKE_COMMAND} + ARGS + -DKDE3_IMPL:BOOL=ON + -DKDE_UIC_EXECUTABLE:FILEPATH=${QT_UIC3_EXECUTABLE} + -DKDE_UIC_FILE:FILEPATH=${_tmp_FILE} + -DKDE_UIC_CPP_FILE:FILEPATH=${_src} + -DKDE_UIC_H_FILE:FILEPATH=${_header} + -DKDE_UIC_BASENAME:STRING=${_basename} + -DKDE_UIC_PLUGIN_DIR:FILEPATH="." + -P ${KDE4_MODULE_DIR}/kde4uic.cmake + MAIN_DEPENDENCY ${_header} + ) + + add_custom_command(OUTPUT ${_moc} + COMMAND ${QT_MOC_EXECUTABLE} + ARGS ${_moc_INCS} ${_header} -o ${_moc} + MAIN_DEPENDENCY ${_header} + ) + list(APPEND ${_sources} ${_src} ${_moc} ) + + endforeach (_current_FILE) +endmacro (KDE4_ADD_UI3_FILES) + + +macro (KDE4_AUTOMOC) + qt4_get_moc_inc_dirs(_moc_INCS) + + # iterate over all 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 the file exists and should not be skipped read it completely into memory + # and grep for all include <foo.moc> lines + # for each found moc file generate a custom_target and collect + # the generated moc files in a list which will be set as a source files property + # and later be queried in kde4_add_library/executable/plugin() + if (EXISTS ${_abs_FILE} AND NOT _skip) + set(_moc_FILES_PROPERTY) + + 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 ${_abs_PATH}/${_basename}.h) + set(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_current_MOC}) + + if (NOT EXISTS ${_abs_PATH}/${_basename}.h) + message(FATAL_ERROR "In the file \"${_abs_FILE}\" the moc file \"${_current_MOC}\" is included, but \"${_abs_PATH}/${_basename}.h\" doesn't exist.") + endif (NOT EXISTS ${_abs_PATH}/${_basename}.h) + + add_custom_command(OUTPUT ${_moc} + COMMAND ${QT_MOC_EXECUTABLE} + ARGS ${_moc_INCS} ${_header} -o ${_moc} + MAIN_DEPENDENCY ${_header} + ) + + list(APPEND _moc_FILES_PROPERTY ${_moc}) + +# if (KDE4_ENABLE_FINAL) +# kde4_create_final_files(${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_final_cpp.cpp _separate_files ${ARGN}) +# macro_add_file_dependencies(${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_final_cpp.cpp ${_moc}) +# else (KDE4_ENABLE_FINAL) +# macro_add_file_dependencies(${_abs_FILE} ${_moc}) +# endif (KDE4_ENABLE_FINAL) + + endforeach (_current_MOC_INC) + endif (_match) + + set_source_files_properties(${_abs_FILE} PROPERTIES AUTOMOC_FILES "${_moc_FILES_PROPERTY}") + endif (EXISTS ${_abs_FILE} AND NOT _skip) + endforeach (_current_FILE) +endmacro (KDE4_AUTOMOC) + + +macro(KDE4_GET_AUTOMOC_FILES _list) + set(${_list}) + foreach (_current_FILE ${ARGN}) + set(_automoc_FILES_PROPERTY) + get_filename_component(_abs_FILE ${_current_FILE} ABSOLUTE) + get_source_file_property(_automoc_FILES_PROPERTY ${_abs_FILE} AUTOMOC_FILES) + if (_automoc_FILES_PROPERTY) + foreach (_current_MOC_FILE ${_automoc_FILES_PROPERTY}) + list(APPEND ${_list} ${_current_MOC_FILE}) + endforeach (_current_MOC_FILE) + endif (_automoc_FILES_PROPERTY) + endforeach (_current_FILE) +endmacro(KDE4_GET_AUTOMOC_FILES) + +macro (KDE4_INSTALL_HANDBOOK ) + get_filename_component(_tmp_FILE ${CMAKE_CURRENT_SOURCE_DIR} ABSOLUTE) + get_filename_component(_basename ${_tmp_FILE} NAME_WE) + file(GLOB _books *.docbook) + file(GLOB _images *.png) + set(relative ${ARGV0}) + set( dirname ${relative}/${_basename}) + FILE(MAKE_DIRECTORY ${HTML_INSTALL_DIR}/en/${dirname}) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/index.cache.bz2 ${_books} ${_images} DESTINATION ${HTML_INSTALL_DIR}/en/${dirname}) + # TODO symlinks on non-unix platforms + if (UNIX) + ADD_CUSTOM_COMMAND(OUTPUT "${HTML_INSTALL_DIR}/en/${dirname}/common" + DEPENDS "${HTML_INSTALL_DIR}/en/common" + COMMAND /bin/ln + ARGS -s "${HTML_INSTALL_DIR}/en/common" "${HTML_INSTALL_DIR}/en/${dirname}/common" + COMMENT "Symlink") + ADD_CUSTOM_TARGET(CreateSymlinks ALL DEPENDS ${HTML_INSTALL_DIR}/en/${dirname}/common) + endif (UNIX) +endmacro (KDE4_INSTALL_HANDBOOK ) + +macro (KDE4_CREATE_HANDBOOK _docbook) + get_filename_component(_input ${_docbook} ABSOLUTE) + set(_doc ${CMAKE_CURRENT_BINARY_DIR}/index.cache.bz2) + set(_ssheet ${DATA_INSTALL_DIR}/ksgmltools2/customization/kde-chunk.xsl) + add_custom_command(OUTPUT ${_doc} + COMMAND ${KDE4_MEINPROC_EXECUTABLE} --check --cache ${_doc} ${_input} + DEPENDS ${_input} ${_KDE4_MEINPROC_EXECUTABLE_DEP} ${_ssheet} + ) + add_custom_target(handbook ALL DEPENDS ${_doc}) +endmacro (KDE4_CREATE_HANDBOOK) + +macro (KDE4_CREATE_HTML_HANDBOOK _docbook) + get_filename_component(_input ${_docbook} ABSOLUTE) + set(_doc ${CMAKE_CURRENT_SOURCE_DIR}/index.html) + set(_ssheet ${DATA_INSTALL_DIR}/ksgmltools2/customization/kde-chunk.xsl) + add_custom_command(OUTPUT ${_doc} + COMMAND ${KDE4_MEINPROC_EXECUTABLE} --check -o ${_doc} ${_input} + DEPENDS ${_input} ${_KDE4_MEINPROC_EXECUTABLE_DEP} ${_ssheet} + ) + add_custom_target(htmlhandbook ALL DEPENDS ${_doc}) +endmacro (KDE4_CREATE_HTML_HANDBOOK) + +# only used internally by KDE4_INSTALL_ICONS +MACRO (_KDE4_ADD_ICON_INSTALL_RULE _install_SCRIPT _install_PATH _group _orig_NAME _install_NAME) + + # if the string doesn't match the pattern, the result is the full string, so all three have the same content + IF (NOT ${_group} STREQUAL ${_install_NAME} ) + SET(_icon_GROUP "actions") + + IF (${_group} STREQUAL "mime") + SET(_icon_GROUP "mimetypes") + ENDIF (${_group} STREQUAL "mime") + + IF (${_group} STREQUAL "filesys") + SET(_icon_GROUP "filesystems") + ENDIF (${_group} STREQUAL "filesys") + + IF (${_group} STREQUAL "device") + SET(_icon_GROUP "devices") + ENDIF (${_group} STREQUAL "device") + + IF (${_group} STREQUAL "app") + SET(_icon_GROUP "apps") + ENDIF (${_group} STREQUAL "app") + + IF (${_group} STREQUAL "action") + SET(_icon_GROUP "actions") + ENDIF (${_group} STREQUAL "action") + +# message(STATUS "icon: ${_current_ICON} size: ${_size} group: ${_group} name: ${_name}" ) + INSTALL(FILES ${_orig_NAME} DESTINATION ${_install_PATH}/${_icon_GROUP}/ RENAME ${_install_NAME} ) + ENDIF (NOT ${_group} STREQUAL ${_install_NAME} ) + +ENDMACRO (_KDE4_ADD_ICON_INSTALL_RULE) + + +macro (KDE4_INSTALL_ICONS _defaultpath ) + + # first the png icons + file(GLOB _icons *.png) + foreach (_current_ICON ${_icons} ) + string(REGEX REPLACE "^.*/([a-zA-Z]+)([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\1" _type "${_current_ICON}") + string(REGEX REPLACE "^.*/([a-zA-Z]+)([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\2" _size "${_current_ICON}") + string(REGEX REPLACE "^.*/([a-zA-Z]+)([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\3" _group "${_current_ICON}") + string(REGEX REPLACE "^.*/([a-zA-Z]+)([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\4" _name "${_current_ICON}") + set(_theme_GROUP "nogroup") + + if( ${_type} STREQUAL "ox" ) + set(_theme_GROUP "oxygen") + endif(${_type} STREQUAL "ox" ) + + if( ${_type} STREQUAL "cr" ) + set(_theme_GROUP "crystalsvg") + endif(${_type} STREQUAL "cr" ) + + if( ${_type} STREQUAL "lo" ) + set(_theme_GROUP "locolor") + endif(${_type} STREQUAL "lo" ) + + if( ${_type} STREQUAL "hi" ) + set(_theme_GROUP "hicolor") + endif(${_type} STREQUAL "hi" ) + + if( NOT ${_theme_GROUP} STREQUAL "nogroup") + _KDE4_ADD_ICON_INSTALL_RULE(${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake + ${_defaultpath}/${_theme_GROUP}/${_size}x${_size} + ${_group} ${_current_ICON} ${_name}) + endif( NOT ${_theme_GROUP} STREQUAL "nogroup") + + endforeach (_current_ICON) + + # mng icons + file(GLOB _icons *.mng) + foreach (_current_ICON ${_icons} ) + STRING(REGEX REPLACE "^.*/([a-zA-Z]+)([0-9]+)\\-([a-z]+)\\-(.+\\.mng)$" "\\1" _type "${_current_ICON}") + STRING(REGEX REPLACE "^.*/([a-zA-Z]+)([0-9]+)\\-([a-z]+)\\-(.+\\.mng)$" "\\2" _size "${_current_ICON}") + STRING(REGEX REPLACE "^.*/([a-zA-Z]+)([0-9]+)\\-([a-z]+)\\-(.+\\.mng)$" "\\3" _group "${_current_ICON}") + STRING(REGEX REPLACE "^.*/([a-zA-Z]+)([0-9]+)\\-([a-z]+)\\-(.+\\.mng)$" "\\4" _name "${_current_ICON}") + SET(_theme_GROUP "nogroup") + + if( ${_type} STREQUAL "ox" ) + SET(_theme_GROUP "oxygen") + endif(${_type} STREQUAL "ox" ) + + if( ${_type} STREQUAL "cr" ) + SET(_theme_GROUP "crystalsvg") + endif(${_type} STREQUAL "cr" ) + + if( ${_type} STREQUAL "lo" ) + set(_theme_GROUP "locolor") + endif(${_type} STREQUAL "lo" ) + + if( ${_type} STREQUAL "hi" ) + set(_theme_GROUP "hicolor") + endif(${_type} STREQUAL "hi" ) + + if( NOT ${_theme_GROUP} STREQUAL "nogroup") + _KDE4_ADD_ICON_INSTALL_RULE(${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake + ${_defaultpath}/${_theme_GROUP}/${_size}x${_size} + ${_group} ${_current_ICON} ${_name}) + endif( NOT ${_theme_GROUP} STREQUAL "nogroup") + + endforeach (_current_ICON) + + + # and now the svg icons + file(GLOB _icons *.svgz) + foreach (_current_ICON ${_icons} ) + STRING(REGEX REPLACE "^.*/([a-zA-Z]+)sc\\-([a-z]+)\\-(.+\\.svgz)$" "\\1" _type "${_current_ICON}") + STRING(REGEX REPLACE "^.*/([a-zA-Z]+)sc\\-([a-z]+)\\-(.+\\.svgz)$" "\\2" _group "${_current_ICON}") + STRING(REGEX REPLACE "^.*/([a-zA-Z]+)sc\\-([a-z]+)\\-(.+\\.svgz)$" "\\3" _name "${_current_ICON}") + SET(_theme_GROUP "nogroup") + + if(${_type} STREQUAL "ox" ) + SET(_theme_GROUP "oxygen") + endif(${_type} STREQUAL "ox" ) + + if(${_type} STREQUAL "cr" ) + SET(_theme_GROUP "crystalsvg") + endif(${_type} STREQUAL "cr" ) + + if(${_type} STREQUAL "hi" ) + SET(_theme_GROUP "hicolor") + endif(${_type} STREQUAL "hi" ) + + if(${_type} STREQUAL "lo" ) + SET(_theme_GROUP "locolor") + endif(${_type} STREQUAL "lo" ) + + if( NOT ${_theme_GROUP} STREQUAL "nogroup") + _KDE4_ADD_ICON_INSTALL_RULE(${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake + ${_defaultpath}/${_theme_GROUP}/scalable + ${_group} ${_current_ICON} ${_name}) + endif( NOT ${_theme_GROUP} STREQUAL "nogroup") + + endforeach (_current_ICON) + +endmacro (KDE4_INSTALL_ICONS) + + +MACRO (KDE4_INSTALL_LIBTOOL_FILE _target _dir) + GET_TARGET_PROPERTY(_target_location ${_target} LOCATION) + + GET_FILENAME_COMPONENT(_laname ${_target_location} NAME_WE) + GET_FILENAME_COMPONENT(_soname ${_target_location} NAME) + set(_laname ${LIBRARY_OUTPUT_PATH}/${_laname}.la) + + FILE(WRITE ${_laname} "# ${_laname} - a libtool library file, generated by cmake \n") + FILE(APPEND ${_laname} "# The name that we can dlopen(3).\n") + FILE(APPEND ${_laname} "dlname='${_soname}'\n") + FILE(APPEND ${_laname} "# Names of this library\n") + FILE(APPEND ${_laname} "library_names='${_soname} ${_soname} ${_soname}'\n") + FILE(APPEND ${_laname} "# The name of the static archive\n") + FILE(APPEND ${_laname} "old_library=''\n") + FILE(APPEND ${_laname} "# Libraries that this one depends upon.\n") + FILE(APPEND ${_laname} "dependency_libs=''\n") +# FILE(APPEND ${_laname} "dependency_libs='${${_target}_LIB_DEPENDS}'\n") + FILE(APPEND ${_laname} "# Version information.\ncurrent=0\nage=0\nrevision=0\n") + FILE(APPEND ${_laname} "# Is this an already installed library?\ninstalled=yes\n") + FILE(APPEND ${_laname} "# Should we warn about portability when linking against -modules?\nshouldnotlink=yes\n") + FILE(APPEND ${_laname} "# Files to dlopen/dlpreopen\ndlopen=''\ndlpreopen=''\n") + FILE(APPEND ${_laname} "# Directory that this library needs to be installed in:\n") + FILE(APPEND ${_laname} "libdir='${_dir}'\n") + + INSTALL(FILES ${_laname} DESTINATION ${_dir}) +ENDMACRO (KDE4_INSTALL_LIBTOOL_FILE) + + +# For all C++ sources a big source file which includes all the files +# is created. +# This is not done for the C sources, they are just gathered in a separate list +# because they are usually not written by KDE and as such not intended to be +# compiled all-in-one. +macro (KDE4_CREATE_FINAL_FILES _filenameCPP _filesExcludedFromFinalFile ) + set(${_filesExcludedFromFinalFile}) + file(WRITE ${_filenameCPP} "//autogenerated file\n") + foreach (_current_FILE ${ARGN}) + get_filename_component(_abs_FILE ${_current_FILE} ABSOLUTE) + # don't include any generated files in the final-file + # because then cmake will not know the dependencies + get_source_file_property(_isGenerated ${_abs_FILE} GENERATED) + if (_isGenerated) + list(APPEND ${_filesExcludedFromFinalFile} ${_abs_FILE}) + else (_isGenerated) + # don't include c-files in the final-file, because they usually come + # from a 3rd party and as such are not intended to be compiled all-in-one + string(REGEX MATCH ".+\\.c$" _isCFile ${_abs_FILE}) + if (_isCFile) + list(APPEND ${_filesExcludedFromFinalFile} ${_abs_FILE}) + else (_isCFile) + file(APPEND ${_filenameCPP} "#include \"${_abs_FILE}\"\n") + endif (_isCFile) + endif (_isGenerated) + endforeach (_current_FILE) + +endmacro (KDE4_CREATE_FINAL_FILES) + +# This macro sets the RPATH related options for libraries, plugins and kdeinit executables. +# It overrides the defaults set in FindKDE4Internal.cmake. +# If RPATH is not explicitely disabled, libraries and plugins are built without RPATH, in +# the hope that the RPATH which is compiled into the executable is good enough. +macro (KDE4_HANDLE_RPATH_FOR_LIBRARY _target_NAME) + if (NOT CMAKE_SKIP_RPATH AND NOT KDE4_USE_ALWAYS_FULL_RPATH) + set_target_properties(${_target_NAME} PROPERTIES INSTALL_RPATH_USE_LINK_PATH FALSE SKIP_BUILD_RPATH TRUE BUILD_WITH_INSTALL_RPATH TRUE INSTALL_RPATH "") + endif (NOT CMAKE_SKIP_RPATH AND NOT KDE4_USE_ALWAYS_FULL_RPATH) +endmacro (KDE4_HANDLE_RPATH_FOR_LIBRARY) + +# This macro sets the RPATH related options for executables +# and creates wrapper shell scripts for the executables. +# It overrides the defaults set in FindKDE4Internal.cmake. +# For every executable a wrapper script is created, which sets the appropriate +# environment variable for the platform (LD_LIBRARY_PATH on most UNIX systems, +# DYLD_LIBRARY_PATH on OS X and PATH in Windows) so that it points to the built +# but not yet installed versions of the libraries. So if RPATH is disabled, the executables +# can be run via these scripts from the build tree and will find the correct libraries. +# If RPATH is not disabled, these scripts are also used but only for consistency, because +# they don't really influence anything then, because the compiled-in RPATH overrides +# the LD_LIBRARY_PATH env. variable. +# Executables with the RUN_UNINSTALLED option will be built with the RPATH pointing to the +# build dir, so that they can be run safely without being installed, e.g. as code generators +# for other stuff during the build. These executables will be relinked during "make install". +# All other executables are built with the RPATH with which they will be installed. +macro (KDE4_HANDLE_RPATH_FOR_EXECUTABLE _target_NAME _type) + if (UNIX) + + # set the RPATH related properties + if (NOT CMAKE_SKIP_RPATH) + if (${_type} STREQUAL "GUI") + set_target_properties(${_target_NAME} PROPERTIES SKIP_BUILD_RPATH TRUE BUILD_WITH_INSTALL_RPATH TRUE) + endif (${_type} STREQUAL "GUI") + + if (${_type} STREQUAL "NOGUI") + set_target_properties(${_target_NAME} PROPERTIES SKIP_BUILD_RPATH TRUE BUILD_WITH_INSTALL_RPATH TRUE) + endif (${_type} STREQUAL "NOGUI") + + if (${_type} STREQUAL "RUN_UNINSTALLED") + set_target_properties(${_target_NAME} PROPERTIES SKIP_BUILD_RPATH FALSE BUILD_WITH_INSTALL_RPATH FALSE) + endif (${_type} STREQUAL "RUN_UNINSTALLED") + endif (NOT CMAKE_SKIP_RPATH) + + if (APPLE) + set(_library_path_variable "DYLD_LIBRARY_PATH") + else (APPLE) + set(_library_path_variable "LD_LIBRARY_PATH") + endif (APPLE) + + set(_ld_library_path "${LIBRARY_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/:${LIB_INSTALL_DIR}:${KDE4_LIB_DIR}:${QT_LIBRARY_DIR}") + get_target_property(_executable ${_target_NAME} LOCATION ) + + # use add_custom_target() to have the sh-wrapper generated during build time instead of cmake time + add_custom_command(TARGET ${_target_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} + -D_filename=${_executable}.shell -D_library_path_variable=${_library_path_variable} + -D_ld_library_path="${_ld_library_path}" -D_executable=${_executable} + -P ${KDE4_MODULE_DIR}/kde4_exec_via_sh.cmake + ) + + macro_additional_clean_files(${_executable}.shell) + + # under UNIX, set the property WRAPPER_SCRIPT to the name of the generated shell script + # so it can be queried and used later on easily + set_target_properties(${_target_NAME} PROPERTIES WRAPPER_SCRIPT ${_executable}.shell) + + else (UNIX) + # under windows, set the property WRAPPER_SCRIPT just to the name of the executable + # maybe later this will change to a generated batch file (for setting the PATH so that the Qt libs are found) + get_target_property(_executable ${_target_NAME} LOCATION ) + set_target_properties(${_target_NAME} PROPERTIES WRAPPER_SCRIPT ${_executable}) + + set(_ld_library_path "${LIBRARY_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}\;${LIB_INSTALL_DIR}\;${KDE4_LIB_DIR}\;${QT_LIBRARY_DIR}") + get_target_property(_executable ${_target_NAME} LOCATION ) + + # use add_custom_target() to have the batch-file-wrapper generated during build time instead of cmake time + add_custom_command(TARGET ${_target_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} + -D_filename="${_executable}.bat" + -D_ld_library_path="${_ld_library_path}" -D_executable="${_executable}" + -P ${KDE4_MODULE_DIR}/kde4_exec_via_sh.cmake + ) + + endif (UNIX) +endmacro (KDE4_HANDLE_RPATH_FOR_EXECUTABLE) + + +macro (KDE4_ADD_PLUGIN _target_NAME _with_PREFIX) +#is the first argument is "WITH_PREFIX" then keep the standard "lib" prefix, otherwise set the prefix empty + if (${_with_PREFIX} STREQUAL "WITH_PREFIX") + set(_first_SRC) + else (${_with_PREFIX} STREQUAL "WITH_PREFIX") + set(_first_SRC ${_with_PREFIX}) + endif (${_with_PREFIX} STREQUAL "WITH_PREFIX") + + kde4_get_automoc_files(_automoc_FILES ${_first_SRC} ${ARGN}) + + if (KDE4_ENABLE_FINAL) + kde4_create_final_files(${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_final_cpp.cpp _separate_files ${_first_SRC} ${ARGN}) + add_library(${_target_NAME} MODULE ${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_final_cpp.cpp ${_separate_files} ${_automoc_FILES}) + else (KDE4_ENABLE_FINAL) + add_library(${_target_NAME} MODULE ${_first_SRC} ${ARGN} ${_automoc_FILES}) + endif (KDE4_ENABLE_FINAL) + + if (_first_SRC) + set_target_properties(${_target_NAME} PROPERTIES PREFIX "") + endif (_first_SRC) + + kde4_handle_rpath_for_library(${_target_NAME}) + + if (WIN32) + # for shared libraries/plugins a -DMAKE_target_LIB is required + string(TOUPPER ${_target_NAME} _symbol) + set(_symbol "MAKE_${_symbol}_LIB") + set_target_properties(${_target_NAME} PROPERTIES DEFINE_SYMBOL ${_symbol}) + endif (WIN32) + +endmacro (KDE4_ADD_PLUGIN _target_NAME _with_PREFIX) + + +# this macro checks is intended to check whether a list of source +# files has the "NOGUI" or "RUN_UNINSTALLED" keywords at the beginning +# in _output_LIST the list of source files is returned with the "NOGUI" +# and "RUN_UNINSTALLED" keywords removed +# if "NOGUI" is in the list of files, the _nogui argument is set to +# "NOGUI" (which evaluates to TRUE in cmake), otherwise it is set empty +# (which evaluates to FALSE in cmake) +# if "RUN_UNINSTALLED" is in the list of files, the _uninst argument is set to +# "RUN_UNINSTALLED" (which evaluates to TRUE in cmake), otherwise it is set empty +# (which evaluates to FALSE in cmake) +macro(KDE4_CHECK_EXECUTABLE_PARAMS _output_LIST _nogui _uninst) + set(${_nogui}) + set(${_uninst}) + set(${_output_LIST} ${ARGN}) + list(LENGTH ${_output_LIST} count) + + list(GET ${_output_LIST} 0 first_PARAM) + + set(second_PARAM "NOTFOUND") + if (${count} GREATER 1) + list(GET ${_output_LIST} 1 second_PARAM) + endif (${count} GREATER 1) + + set(remove "NOTFOUND") + + if (${first_PARAM} STREQUAL "NOGUI") + set(${_nogui} "NOGUI") + set(remove 0) + endif (${first_PARAM} STREQUAL "NOGUI") + + if (${second_PARAM} STREQUAL "NOGUI") + set(${_nogui} "NOGUI") + set(remove 0;1) + endif (${second_PARAM} STREQUAL "NOGUI") + + if (${first_PARAM} STREQUAL "RUN_UNINSTALLED") + set(${_uninst} "RUN_UNINSTALLED") + set(remove 0) + endif (${first_PARAM} STREQUAL "RUN_UNINSTALLED") + + if (${second_PARAM} STREQUAL "RUN_UNINSTALLED") + set(${_uninst} "RUN_UNINSTALLED") + set(remove 0;1) + endif (${second_PARAM} STREQUAL "RUN_UNINSTALLED") + + if (NOT "${remove}" STREQUAL "NOTFOUND") + list(REMOVE_AT ${_output_LIST} ${remove}) + endif (NOT "${remove}" STREQUAL "NOTFOUND") + +endmacro(KDE4_CHECK_EXECUTABLE_PARAMS) + + +macro (KDE4_ADD_KDEINIT_EXECUTABLE _target_NAME ) + + kde4_check_executable_params(_SRCS _nogui _uninst ${ARGN}) + +# if (WIN32) +# # under windows, just build a normal executable +# KDE4_ADD_EXECUTABLE(${_target_NAME} ${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_dummy.cpp ${ARGN} ) +# else (WIN32) + # under UNIX, create a shared library and a small executable, which links to this library + kde4_get_automoc_files(_automoc_FILES ${_SRCS}) + + if (KDE4_ENABLE_FINAL) + kde4_create_final_files(${CMAKE_CURRENT_BINARY_DIR}/kdeinit_${_target_NAME}_final_cpp.cpp _separate_files ${_SRCS}) + add_library(kdeinit_${_target_NAME} SHARED ${CMAKE_CURRENT_BINARY_DIR}/kdeinit_${_target_NAME}_final_cpp.cpp ${_separate_files} ${_automoc_FILES}) + + else (KDE4_ENABLE_FINAL) + add_library(kdeinit_${_target_NAME} SHARED ${_SRCS} ${_automoc_FILES}) + endif (KDE4_ENABLE_FINAL) + + kde4_handle_rpath_for_library(kdeinit_${_target_NAME}) + + + configure_file(${KDE4_MODULE_DIR}/kde4init_dummy.cpp.in ${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_dummy.cpp) + kde4_add_executable(${_target_NAME} "${_nogui}" "${_uninst}" ${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_dummy.cpp) + target_link_libraries(${_target_NAME} kdeinit_${_target_NAME}) +# endif (WIN32) + + if (WIN32) + target_link_libraries(${_target_NAME} ${QT_QTMAIN_LIBRARY}) + endif (WIN32) + +endmacro (KDE4_ADD_KDEINIT_EXECUTABLE) + +macro (KDE4_ADD_EXECUTABLE _target_NAME) + + kde4_check_executable_params( _SRCS _nogui _uninst ${ARGN}) + + set(_add_executable_param) + set(_type "GUI") + + # determine additional parameters for add_executable() + # for GUI apps, create a bundle on OSX + if (APPLE) + set(_add_executable_param MACOSX_BUNDLE) + endif (APPLE) + + # for GUI apps, this disables the additional console under Windows + if (WIN32) + set(_add_executable_param WIN32) + endif (WIN32) + + if (_nogui) + set(_type "NOGUI") + set(_add_executable_param) + endif (_nogui) + + if (_uninst) + set(_type "RUN_UNINSTALLED") + endif (_uninst) + + kde4_get_automoc_files(_automoc_FILES ${_SRCS}) + + if (KDE4_ENABLE_FINAL) + kde4_create_final_files(${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_final_cpp.cpp _separate_files ${_SRCS}) + add_executable(${_target_NAME} ${_add_executable_param} ${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_final_cpp.cpp ${_separate_files} ${_automoc_FILES}) + else (KDE4_ENABLE_FINAL) + add_executable(${_target_NAME} ${_add_executable_param} ${_SRCS} ${_automoc_FILES}) + endif (KDE4_ENABLE_FINAL) + + kde4_handle_rpath_for_executable(${_target_NAME} ${_type}) + + if (WIN32) + target_link_libraries(${_target_NAME} ${QT_QTMAIN_LIBRARY}) + endif (WIN32) + +endmacro (KDE4_ADD_EXECUTABLE) + + +MACRO (KDE4_ADD_LIBRARY _target_NAME _lib_TYPE) +#is the first argument is "WITH_PREFIX" then keep the standard "lib" prefix, otherwise set the prefix empty + + set(_first_SRC ${_lib_TYPE}) + set(_add_lib_param) + + if (${_lib_TYPE} STREQUAL "STATIC") + set(_first_SRC) + set(_add_lib_param STATIC) + endif (${_lib_TYPE} STREQUAL "STATIC") + if (${_lib_TYPE} STREQUAL "SHARED") + set(_first_SRC) + set(_add_lib_param SHARED) + endif (${_lib_TYPE} STREQUAL "SHARED") + if (${_lib_TYPE} STREQUAL "MODULE") + set(_first_SRC) + set(_add_lib_param MODULE) + endif (${_lib_TYPE} STREQUAL "MODULE") + + kde4_get_automoc_files(_automoc_FILES ${_first_SRC} ${ARGN}) + + if (KDE4_ENABLE_FINAL) + kde4_create_final_files(${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_final_cpp.cpp _separate_files ${_first_SRC} ${ARGN}) + add_library(${_target_NAME} ${_add_lib_param} ${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_final_cpp.cpp ${_separate_files} ${_automoc_FILES}) + else (KDE4_ENABLE_FINAL) + add_library(${_target_NAME} ${_add_lib_param} ${_first_SRC} ${ARGN} ${_automoc_FILES}) + endif (KDE4_ENABLE_FINAL) + + kde4_handle_rpath_for_library(${_target_NAME}) + + if (WIN32) + # for shared libraries a -DMAKE_target_LIB is required + string(TOUPPER ${_target_NAME} _symbol) + set(_symbol "MAKE_${_symbol}_LIB") + set_target_properties(${_target_NAME} PROPERTIES DEFINE_SYMBOL ${_symbol}) + endif (WIN32) + +ENDMACRO (KDE4_ADD_LIBRARY _target_NAME _lib_TYPE) + + +macro (KDE4_ADD_WIDGET_FILES _sources) + foreach (_current_FILE ${ARGN}) + + get_filename_component(_input ${_current_FILE} ABSOLUTE) + get_filename_component(_basename ${_input} NAME_WE) + set(_source ${CMAKE_CURRENT_BINARY_DIR}/${_basename}widgets.cpp) + set(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_basename}widgets.moc) + + # create source file from the .widgets file + add_custom_command(OUTPUT ${_source} + COMMAND ${KDE4_MAKEKDEWIDGETS_EXECUTABLE} + ARGS -o ${_source} ${_input} + MAIN_DEPENDENCY ${_input} DEPENDS ${_KDE4_MAKEKDEWIDGETS_DEP}) + + # create moc file + qt4_generate_moc(${_source} ${_moc} ) + + list(APPEND ${_sources} ${_source} ${_moc}) + + endforeach (_current_FILE) + +endmacro (KDE4_ADD_WIDGET_FILES) + +MACRO(KDE4_ADD_DCOP_SKELS) + MESSAGE(FATAL_ERROR "There is a call to KDE4_ADD_DCOP_SKELS() in the CMakeLists.txt for '${ARGV0}', but DCOP is no longer supported by KDE4. + Please remove it and port to DBUS.") +ENDMACRO(KDE4_ADD_DCOP_SKELS) + +MACRO(KDE4_ADD_DCOP_STUBS) + MESSAGE(FATAL_ERROR "There is a call to KDE4_ADD_DCOP_STUBS() in the CMakeLists.txt for '${ARGV0}', but DCOP is no longer supported by KDE4. + Please remove it and port to DBUS.") +ENDMACRO(KDE4_ADD_DCOP_STUBS) + +MACRO(KDE4_REMOVE_OBSOLETE_CMAKE_FILES) +# the files listed here will be removed by remove_obsoleted_cmake_files.cmake, Alex + install(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/remove_files.cmake ) + set(module_install_dir ${DATA_INSTALL_DIR}/cmake/modules ) + + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/remove_files.cmake "#generated by cmake, dont edit\n\n") + foreach ( _current_FILE ${ARGN}) + file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/remove_files.cmake "message(STATUS \"Removing ${module_install_dir}/${_current_FILE}\" )\n" ) + file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/remove_files.cmake "exec_program( ${CMAKE_COMMAND} ARGS -E remove ${module_install_dir}/${_current_FILE} OUTPUT_VARIABLE _dummy)\n" ) + endforeach ( _current_FILE) + +ENDMACRO(KDE4_REMOVE_OBSOLETE_CMAKE_FILES) + +MACRO(KDE4_NO_ENABLE_FINAL _project_name) + if(KDE4_ENABLE_FINAL) + set(KDE4_ENABLE_FINAL OFF) + REMOVE_DEFINITIONS(-DKDE_USE_FINAL) + MESSAGE(STATUS "You used enable-final argument but \"${_project_name}\" doesn't support it. Try to fix compile it and remove KDE4_NO_ENABLE_FINAL macro. Thanks") + + endif(KDE4_ENABLE_FINAL) +ENDMACRO(KDE4_NO_ENABLE_FINAL _project_name) + + +FIND_PROGRAM(MSGFMT + NAMES gmsgfmt msgfmt + PATHS ${BIN_SEARCH_PATHES}) + +IF(MSGFMT) + EXECUTE_PROCESS(COMMAND ${MSGFMT} "--version" "2>&1" + OUTPUT_VARIABLE _msgout) + STRING(REGEX MATCH "GNU[\t ]gettext" _isgnu "${_msgout}") + IF (NOT _isgnu) + MESSAGE(STATUS "No gnu msgfmt found!") + SET(MSGFMT ":" CACHE STRING "Msgfmt program") + ELSE(NOT _isgnu) + MESSAGE(STATUS "Found gnu msgfmt: ${MSGFMT}") + ENDIF (NOT _isgnu) +ELSE(MSGFMT) + SET(MSGFMT ":" CACHE STRING "Msgfmt program") + MESSAGE( FATAL_ERROR "Could NOT find Msgfmt program") +ENDIF(MSGFMT) + +MACRO(ADD_POFILES packagename) + SET(_gmofiles) + FILE(GLOB _pofiles *.po) + + FOREACH(_current_po ${_pofiles}) + GET_FILENAME_COMPONENT(_name ${_current_po} NAME_WE) + STRING(REGEX REPLACE "^.*/([a-zA-Z]+)(\\.po)" "\\1" _lang "${_current_po}") + SET(_gmofile "${CMAKE_CURRENT_BINARY_DIR}/${_name}.gmo") + ADD_CUSTOM_COMMAND(OUTPUT ${_gmofile} + COMMAND ${MSGFMT} + ARGS "-o" "${_gmofile}" "${_current_po}" + DEPENDS ${_current_po} + ) + SET(_gmofiles ${_gmofiles} ${_gmofile}) + INSTALL(FILES ${_gmofile} + DESTINATION ${LOCALE_INSTALL_DIR}/${_lang}/LC_MESSAGES + RENAME ${packagename}.mo) + ENDFOREACH(_current_po ${_pofiles}) + + ADD_CUSTOM_TARGET(translations ALL + DEPENDS ${_gmofiles}) + +ENDMACRO(ADD_POFILES) diff --git a/cmakemodules/MacroAddCompileFlags.cmake b/cmakemodules/MacroAddCompileFlags.cmake new file mode 100644 index 0000000..12038c0 --- /dev/null +++ b/cmakemodules/MacroAddCompileFlags.cmake @@ -0,0 +1,19 @@ +# - MACRO_ADD_COMPILE_FLAGS(<_target> "flags...") + +# Copyright (c) 2006, Oswald Buddenhagen, <ossi@kde.org> +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + + +MACRO (MACRO_ADD_COMPILE_FLAGS _target _flg) + + GET_TARGET_PROPERTY(_flags ${_target} COMPILE_FLAGS) + if (_flags) + set(_flags "${_flags} ${_flg}") + else (_flags) + set(_flags "${_flg}") + endif (_flags) + SET_TARGET_PROPERTIES(${_target} PROPERTIES COMPILE_FLAGS "${_flags}") + +ENDMACRO (MACRO_ADD_COMPILE_FLAGS) diff --git a/cmakemodules/MacroAddFileDependencies.cmake b/cmakemodules/MacroAddFileDependencies.cmake new file mode 100644 index 0000000..9e55360 --- /dev/null +++ b/cmakemodules/MacroAddFileDependencies.cmake @@ -0,0 +1,20 @@ +# MACRO_ADD_FILE_DEPENDENCIES(<_file> depend_files...) + +# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org> +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + + +MACRO (MACRO_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/cmakemodules/MacroAddLinkFlags.cmake b/cmakemodules/MacroAddLinkFlags.cmake new file mode 100644 index 0000000..a10d39e --- /dev/null +++ b/cmakemodules/MacroAddLinkFlags.cmake @@ -0,0 +1,18 @@ +# - MACRO_ADD_LINK_FLAGS(<_target> "flags...") + +# Copyright (c) 2006, Oswald Buddenhagen, <ossi@kde.org> +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +MACRO (MACRO_ADD_LINK_FLAGS _target _flg) + + GET_TARGET_PROPERTY(_flags ${_target} LINK_FLAGS) + if (_flags) + set(_flags "${_flags} ${_flg}") + else (_flags) + set(_flags "${_flg}") + endif (_flags) + SET_TARGET_PROPERTIES(${_target} PROPERTIES LINK_FLAGS "${_flags}") + +ENDMACRO (MACRO_ADD_LINK_FLAGS) diff --git a/cmakemodules/MacroAdditionalCleanFiles.cmake b/cmakemodules/MacroAdditionalCleanFiles.cmake new file mode 100644 index 0000000..593182f --- /dev/null +++ b/cmakemodules/MacroAdditionalCleanFiles.cmake @@ -0,0 +1,21 @@ +# - MACRO_ADDITIONAL_CLEAN_FILES(files...) +# MACRO_OPTIONAL_FIND_PACKAGE( <name> [QUIT] ) + +# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org> +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + + +MACRO (MACRO_ADDITIONAL_CLEAN_FILES) + GET_DIRECTORY_PROPERTY(_tmp_DIR_PROPS ADDITIONAL_MAKE_CLEAN_FILES ) + + if (_tmp_DIR_PROPS) + set(_tmp_DIR_PROPS ${_tmp_DIR_PROPS} ${ARGN}) + else (_tmp_DIR_PROPS) + set(_tmp_DIR_PROPS ${ARGN}) + endif (_tmp_DIR_PROPS) + + SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${_tmp_DIR_PROPS}") +ENDMACRO (MACRO_ADDITIONAL_CLEAN_FILES) + diff --git a/cmakemodules/MacroBoolTo01.cmake b/cmakemodules/MacroBoolTo01.cmake new file mode 100644 index 0000000..63b9852 --- /dev/null +++ b/cmakemodules/MacroBoolTo01.cmake @@ -0,0 +1,20 @@ +# MACRO_BOOL_TO_01( VAR RESULT0 ... RESULTN ) +# This macro evaluates its first argument +# and sets all the given vaiables either to 0 or 1 +# depending on the value of the first one + +# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org> +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + + +MACRO(MACRO_BOOL_TO_01 FOUND_VAR ) + FOREACH (_current_VAR ${ARGN}) + IF(${FOUND_VAR}) + SET(${_current_VAR} 1) + ELSE(${FOUND_VAR}) + SET(${_current_VAR} 0) + ENDIF(${FOUND_VAR}) + ENDFOREACH(_current_VAR) +ENDMACRO(MACRO_BOOL_TO_01) diff --git a/cmakemodules/MacroEnsureOutOfSourceBuild.cmake b/cmakemodules/MacroEnsureOutOfSourceBuild.cmake new file mode 100644 index 0000000..ef4d525 --- /dev/null +++ b/cmakemodules/MacroEnsureOutOfSourceBuild.cmake @@ -0,0 +1,16 @@ +# - MACRO_ENSURE_OUT_OF_SOURCE_BUILD(<errorMessage>) +# MACRO_ENSURE_OUT_OF_SOURCE_BUILD(<errorMessage>) + +# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org> +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +MACRO (MACRO_ENSURE_OUT_OF_SOURCE_BUILD _errorMessage) + + STRING(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" insource) + IF(insource) + MESSAGE(FATAL_ERROR "${_errorMessage}") + ENDIF(insource) + +ENDMACRO (MACRO_ENSURE_OUT_OF_SOURCE_BUILD) diff --git a/cmakemodules/MacroEnsureVersion.cmake b/cmakemodules/MacroEnsureVersion.cmake new file mode 100644 index 0000000..9d936ce --- /dev/null +++ b/cmakemodules/MacroEnsureVersion.cmake @@ -0,0 +1,35 @@ +# This macro compares version numbers of the form "x.y.z" +# MACRO_ENSURE_VERSION( FOO_MIN_VERSION FOO_VERSION_FOUND FOO_VERSION_OK) +# will set FOO_VERSIN_OK to true if FOO_VERSION_FOUND >= FOO_MIN_VERSION +# where both have to be in a 3-part-version format, leading and trailing +# text is ok, e.g. +# MACRO_ENSURE_VERSION( "2.5.31" "flex 2.5.4a" VERSION_OK) +# which means 2.5.31 is required and "flex 2.5.4a" is what was found on the system + +# Copyright (c) 2006, David Faure, <faure@kde.org> +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +MACRO(MACRO_ENSURE_VERSION requested_version found_version var_too_old) + + # parse the parts of the version string + STRING(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" req_major_vers "${requested_version}") + STRING(REGEX REPLACE "[0-9]+\\.([0-9]+)\\.[0-9]+" "\\1" req_minor_vers "${requested_version}") + STRING(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" req_patch_vers "${requested_version}") + + STRING(REGEX REPLACE "[^0-9]*([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" found_major_vers "${found_version}") + STRING(REGEX REPLACE "[^0-9]*[0-9]+\\.([0-9]+)\\.[0-9]+.*" "\\1" found_minor_vers "${found_version}") + STRING(REGEX REPLACE "[^0-9]*[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" found_patch_vers "${found_version}") + + # compute an overall version number which can be compared at once + MATH(EXPR req_vers_num "${req_major_vers}*10000 + ${req_minor_vers}*100 + ${req_patch_vers}") + MATH(EXPR found_vers_num "${found_major_vers}*10000 + ${found_minor_vers}*100 + ${found_patch_vers}") + + if (found_vers_num LESS req_vers_num) + set( ${var_too_old} FALSE ) + else (found_vers_num LESS req_vers_num) + set( ${var_too_old} TRUE ) + endif (found_vers_num LESS req_vers_num) + +ENDMACRO(MACRO_ENSURE_VERSION) diff --git a/cmakemodules/MacroLibrary.cmake b/cmakemodules/MacroLibrary.cmake new file mode 100644 index 0000000..3b80212 --- /dev/null +++ b/cmakemodules/MacroLibrary.cmake @@ -0,0 +1,18 @@ +# - include MacroLibrary offers a collection of macros which extend the built-in cmake commands +# OPTIONAL_FIND_PACKAGE( <name> [QUIT] ) + +# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org> +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +INCLUDE(MacroOptionalFindPackage) +INCLUDE(MacroOptionalAddSubdirectory) +INCLUDE(MacroAdditionalCleanFiles) +INCLUDE(MacroAddFileDependencies) +INCLUDE(MacroAddCompileFlags) +INCLUDE(MacroAddLinkFlags) +INCLUDE(MacroEnsureOutOfSourceBuild) +INCLUDE(MacroBoolTo01) +INCLUDE(MacroPushRequiredVars) +INCLUDE(MacroLogFeature) diff --git a/cmakemodules/MacroLogFeature.cmake b/cmakemodules/MacroLogFeature.cmake new file mode 100644 index 0000000..55f7b69 --- /dev/null +++ b/cmakemodules/MacroLogFeature.cmake @@ -0,0 +1,112 @@ +# This file defines the Feature Logging macros. +# +# MACRO_LOG_FEATURE(VAR FEATURE DESCRIPTION URL [REQUIRED [MIN_VERSION [COMMENTS]]]) +# Logs the information so that it can be displayed at the end +# of the configure run +# VAR : TRUE or FALSE, indicating whether the feature is supported +# FEATURE: name of the feature, e.g. "libjpeg" +# DESCRIPTION: description what this feature provides +# URL: home page +# REQUIRED: TRUE or FALSE, indicating whether the featue is required +# MIN_VERSION: minimum version number. empty string if unneeded +# COMMENTS: More info you may want to provide. empty string if unnecessary +# +# MACRO_DISPLAY_FEATURE_LOG() +# Call this to display the collected results. +# Exits CMake with a FATAL error message if a required feature is missing +# +# Example: +# +# INCLUDE(MacroLogFeature) +# +# FIND_PACKAGE(JPEG) +# MACRO_LOG_FEATURE(JPEG_FOUND "libjpeg" "Support JPEG images" "http://www.ijg.org" TRUE "3.2a" "") +# ... +# MACRO_DISPLAY_FEATURE_LOG() + +# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org> +# Copyright (c) 2006, Allen Winter, <winter@kde.org> +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +IF (NOT _macroLogFeatureAlreadyIncluded) + SET(_file ${CMAKE_BINARY_DIR}/MissingRequirements.txt) + IF (EXISTS ${_file}) + FILE(REMOVE ${_file}) + ENDIF (EXISTS ${_file}) + + SET(_file ${CMAKE_BINARY_DIR}/EnabledFeatures.txt) + IF (EXISTS ${_file}) + FILE(REMOVE ${_file}) + ENDIF (EXISTS ${_file}) + + SET(_file ${CMAKE_BINARY_DIR}/DisabledFeatures.txt) + IF (EXISTS ${_file}) + FILE(REMOVE ${_file}) + ENDIF (EXISTS ${_file}) + + SET(_macroLogFeatureAlreadyIncluded TRUE) +ENDIF (NOT _macroLogFeatureAlreadyIncluded) + + +MACRO(MACRO_LOG_FEATURE _var _package _description _url ) # _required _minvers _comments) + + SET(_required "${ARGV4}") + SET(_minvers "${ARGV5}") + SET(_comments "${ARGV6}") + + IF (${_var}) + SET(_LOGFILENAME ${CMAKE_BINARY_DIR}/EnabledFeatures.txt) + ELSE (${_var}) + IF (${_required} MATCHES "[Tt][Rr][Uu][Ee]") + SET(_LOGFILENAME ${CMAKE_BINARY_DIR}/MissingRequirements.txt) + ELSE (${_required} MATCHES "[Tt][Rr][Uu][Ee]") + SET(_LOGFILENAME ${CMAKE_BINARY_DIR}/DisabledFeatures.txt) + ENDIF (${_required} MATCHES "[Tt][Rr][Uu][Ee]") + ENDIF (${_var}) + + SET(_logtext "> ${_package}") + + IF (${_minvers} MATCHES ".*") + SET(_logtext "${_logtext}, ${_minvers}") + ENDIF (${_minvers} MATCHES ".*") + SET(_logtext "${_logtext}: ${_description}; ${_url};") + IF (${_comments} MATCHES ".*") + SET(_logtext "${_logtext}\n${_comments}") + ENDIF (${_comments} MATCHES ".*") + FILE(APPEND "${_LOGFILENAME}" "${_logtext}\n\n") + +ENDMACRO(MACRO_LOG_FEATURE) + + +MACRO(MACRO_DISPLAY_FEATURE_LOG) + + SET(_file ${CMAKE_BINARY_DIR}/MissingRequirements.txt) + IF (EXISTS ${_file}) + FILE(READ ${_file} _requirements) + MESSAGE(STATUS "\n----------------------------------------------------------------------------------\n-- The following list of REQUIRED packages could not be located on your system. --\n-- Please install them before continuing with this software installation. --\n----------------------------------------------------------------------------------\n${_requirements}----------------------------------------------------------------------------------") +# MESSAGE(STATUS "MISSING REQUIREMENTS\n${_requirements}\n") + FILE(REMOVE ${_file}) + MESSAGE(FATAL_ERROR "Exiting: Missing Requirements") + ENDIF (EXISTS ${_file}) + + SET(_summary "\n") + SET(_file ${CMAKE_BINARY_DIR}/EnabledFeatures.txt) + IF (EXISTS ${_file}) + FILE(READ ${_file} _enabled) + FILE(REMOVE ${_file}) + SET(_summary "${_summary}----------------------------------------------------------------------------------\n-- The following list of OPTIONAL packages were located on your system. --\n-- You will have all the following features available from this software. --\n----------------------------------------------------------------------------------\n${_enabled}") +# SET(_summary "${_summary}Enabled Features:\n${_enabled}") + ENDIF (EXISTS ${_file}) + + SET(_file ${CMAKE_BINARY_DIR}/DisabledFeatures.txt) + IF (EXISTS ${_file}) + FILE(READ ${_file} _disabled) + FILE(REMOVE ${_file}) + SET(_summary "${_summary}----------------------------------------------------------------------------------\n-- The following list of OPTIONAL packages could not be located on your system. --\n-- Please consider installing them to enable more features of this software. --\n----------------------------------------------------------------------------------\n${_disabled}") +# SET(_summary "${_summary}Disabled Features:\n${_disabled}") + ENDIF (EXISTS ${_file}) + MESSAGE(STATUS "${_summary}") + +ENDMACRO(MACRO_DISPLAY_FEATURE_LOG) diff --git a/cmakemodules/MacroOptionalAddSubdirectory.cmake b/cmakemodules/MacroOptionalAddSubdirectory.cmake new file mode 100644 index 0000000..b0d565c --- /dev/null +++ b/cmakemodules/MacroOptionalAddSubdirectory.cmake @@ -0,0 +1,27 @@ +# - MACRO_OPTIONAL_ADD_SUBDIRECTORY() combines ADD_SUBDIRECTORY() with an OPTION() +# MACRO_OPTIONAL_ADD_SUBDIRECTORY( <dir> ) +# If you use MACRO_OPTIONAL_ADD_SUBDIRECTORY() instead of ADD_SUBDIRECTORY(), +# this will have two effects +# 1 - CMake will not complain if the directory doesn't exist +# This makes sense if you want to distribute just one of the subdirs +# in a source package, e.g. just one of the subdirs in kdeextragear. +# 2 - If the directory exists, it will offer an option to skip the +# subdirectory. +# This is useful if you want to compile only a subset of all +# directories. + +# Copyright (c) 2007, Alexander Neundorf, <neundorf@kde.org> +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + + +MACRO (MACRO_OPTIONAL_ADD_SUBDIRECTORY _dir ) + GET_FILENAME_COMPONENT(_fullPath ${_dir} ABSOLUTE) + IF(EXISTS ${_fullPath}) + OPTION(BUILD_${_dir} "Build directory ${_dir}" TRUE) + IF(BUILD_${_dir}) + ADD_SUBDIRECTORY(${_dir}) + ENDIF(BUILD_${_dir}) + ENDIF(EXISTS ${_fullPath}) +ENDMACRO (MACRO_OPTIONAL_ADD_SUBDIRECTORY) diff --git a/cmakemodules/MacroOptionalFindPackage.cmake b/cmakemodules/MacroOptionalFindPackage.cmake new file mode 100644 index 0000000..816cdb7 --- /dev/null +++ b/cmakemodules/MacroOptionalFindPackage.cmake @@ -0,0 +1,28 @@ +# - MACRO_OPTIONAL_FIND_PACKAGE() combines FIND_PACKAGE() with an OPTION() +# MACRO_OPTIONAL_FIND_PACKAGE( <name> [QUIT] ) +# This macro is a combination of OPTION() and FIND_PACKAGE(), it +# works like FIND_PACKAGE(), but additionally it automatically creates +# an option name WITH_<name>, which can be disabled via the cmake GUI. +# or via -DWITH_<name>=OFF +# The standard <name>_FOUND variables can be used in the same way +# as when using the normal FIND_PACKAGE() + +# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org> +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + + +MACRO (MACRO_OPTIONAL_FIND_PACKAGE _name ) + OPTION(WITH_${_name} "Search for ${_name} package" ON) + if (WITH_${_name}) + FIND_PACKAGE(${_name} ${ARGN}) + else (WITH_${_name}) + set(${_name}_FOUND) + set(${_name}_INCLUDE_DIR) + set(${_name}_INCLUDES) + set(${_name}_LIBRARY) + set(${_name}_LIBRARIES) + endif (WITH_${_name}) +ENDMACRO (MACRO_OPTIONAL_FIND_PACKAGE) + diff --git a/cmakemodules/MacroPushRequiredVars.cmake b/cmakemodules/MacroPushRequiredVars.cmake new file mode 100644 index 0000000..650b566 --- /dev/null +++ b/cmakemodules/MacroPushRequiredVars.cmake @@ -0,0 +1,47 @@ +# this module defines two macros: +# MACRO_PUSH_REQUIRED_VARS() +# and +# MACRO_POP_REQUIRED_VARS() +# use these if you call cmake macros which use +# any of the CMAKE_REQUIRED_XXX variables +# +# Usage: +# MACRO_PUSH_REQUIRED_VARS() +# SET(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -DSOME_MORE_DEF) +# CHECK_FUNCTION_EXISTS(...) +# MACRO_POP_REQUIRED_VARS() + +# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org> +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +MACRO(MACRO_PUSH_REQUIRED_VARS) + + IF(NOT DEFINED _PUSH_REQUIRED_VARS_COUNTER) + SET(_PUSH_REQUIRED_VARS_COUNTER 0) + ENDIF(NOT DEFINED _PUSH_REQUIRED_VARS_COUNTER) + + MATH(EXPR _PUSH_REQUIRED_VARS_COUNTER "${_PUSH_REQUIRED_VARS_COUNTER}+1") + + SET(_CMAKE_REQUIRED_INCLUDES_SAVE_${_PUSH_REQUIRED_VARS_COUNTER} ${CMAKE_REQUIRED_INCLUDES}) + SET(_CMAKE_REQUIRED_DEFINITIONS_SAVE_${_PUSH_REQUIRED_VARS_COUNTER} ${CMAKE_REQUIRED_DEFINITIONS}) + SET(_CMAKE_REQUIRED_LIBRARIES_SAVE_${_PUSH_REQUIRED_VARS_COUNTER} ${CMAKE_REQUIRED_LIBRARIES}) + SET(_CMAKE_REQUIRED_FLAGS_SAVE_${_PUSH_REQUIRED_VARS_COUNTER} ${CMAKE_REQUIRED_FLAGS}) +ENDMACRO(MACRO_PUSH_REQUIRED_VARS) + +MACRO(MACRO_POP_REQUIRED_VARS) + +# don't pop more than we pushed + IF("${_PUSH_REQUIRED_VARS_COUNTER}" GREATER "0") + + SET(CMAKE_REQUIRED_INCLUDES ${_CMAKE_REQUIRED_INCLUDES_SAVE_${_PUSH_REQUIRED_VARS_COUNTER}}) + SET(CMAKE_REQUIRED_DEFINITIONS ${_CMAKE_REQUIRED_DEFINITIONS_SAVE_${_PUSH_REQUIRED_VARS_COUNTER}}) + SET(CMAKE_REQUIRED_LIBRARIES ${_CMAKE_REQUIRED_LIBRARIES_SAVE_${_PUSH_REQUIRED_VARS_COUNTER}}) + SET(CMAKE_REQUIRED_FLAGS ${_CMAKE_REQUIRED_FLAGS_SAVE_${_PUSH_REQUIRED_VARS_COUNTER}}) + + MATH(EXPR _PUSH_REQUIRED_VARS_COUNTER "${_PUSH_REQUIRED_VARS_COUNTER}-1") + ENDIF("${_PUSH_REQUIRED_VARS_COUNTER}" GREATER "0") + +ENDMACRO(MACRO_POP_REQUIRED_VARS) + diff --git a/cmakemodules/generatelibtoolfile.cmake b/cmakemodules/generatelibtoolfile.cmake new file mode 100644 index 0000000..d74ed21 --- /dev/null +++ b/cmakemodules/generatelibtoolfile.cmake @@ -0,0 +1,16 @@ + FILE(WRITE ${OUTPUTFILE} "# ${OUTPUTFILE} - a libtool library file, generated by cmake \n") + FILE(APPEND ${OUTPUTFILE} "# The name that we can dlopen(3).\n") + FILE(APPEND ${OUTPUTFILE} "dlname='${SONAME}'\n") + FILE(APPEND ${OUTPUTFILE} "# Names of this library\n") + FILE(APPEND ${OUTPUTFILE} "library_names='${SONAME} ${SONAME} ${SONAME}'\n") + FILE(APPEND ${OUTPUTFILE} "# The name of the static archive\n") + FILE(APPEND ${OUTPUTFILE} "old_library=''\n") + FILE(APPEND ${OUTPUTFILE} "# Libraries that this one depends upon.\n") + FILE(APPEND ${OUTPUTFILE} "dependency_libs=''\n") +# FILE(APPEND ${OUTPUTFILE} "dependency_libs='${${_target}_LIB_DEPENDS}'\n") + FILE(APPEND ${OUTPUTFILE} "# Version information.\ncurrent=0\nage=0\nrevision=0\n") + FILE(APPEND ${OUTPUTFILE} "# Is this an already installed library?\ninstalled=yes\n") + FILE(APPEND ${OUTPUTFILE} "# Should we warn about portability when linking against -modules?\nshouldnotlink=yes\n") + FILE(APPEND ${OUTPUTFILE} "# Files to dlopen/dlpreopen\ndlopen=''\ndlpreopen=''\n") + FILE(APPEND ${OUTPUTFILE} "# Directory that this library needs to be installed in:\n") + FILE(APPEND ${OUTPUTFILE} "libdir='${LIBDIR}'\n") diff --git a/cmakemodules/kde3uic.cmake b/cmakemodules/kde3uic.cmake new file mode 100644 index 0000000..0dbbbcf --- /dev/null +++ b/cmakemodules/kde3uic.cmake @@ -0,0 +1,20 @@ + + +# used internally by KDE3Macros.cmake +# neundorf@kde.org + + +EXECUTE_PROCESS(COMMAND ${KDE_UIC_EXECUTABLE} + -L ${KDE_UIC_PLUGIN_DIR} -nounload -tr tr2i18n + -impl ${KDE_UIC_H_FILE} + ${KDE_UIC_FILE} + OUTPUT_VARIABLE _uic_CONTENTS + ERROR_QUIET + ) + +STRING(REGEX REPLACE "tr2i18n\\(\"\"\\)" "QString::null" _uic_CONTENTS "${_uic_CONTENTS}" ) +STRING(REGEX REPLACE "tr2i18n\\(\"\", \"\"\\)" "QString::null" _uic_CONTENTS "${_uic_CONTENTS}" ) + +FILE(WRITE ${KDE_UIC_CPP_FILE} "#include <kdialog.h>\n#include <klocale.h>\n\n") +FILE(APPEND ${KDE_UIC_CPP_FILE} "${_uic_CONTENTS}") + diff --git a/cmakemodules/kdesvnMacros.cmake b/cmakemodules/kdesvnMacros.cmake new file mode 100644 index 0000000..29b99db --- /dev/null +++ b/cmakemodules/kdesvnMacros.cmake @@ -0,0 +1,50 @@ + +MACRO(KDESVN_CHECK_LINK_FLAG FLAGS VARIABLE) + IF(NOT DEFINED ${VARIABLE}) + TRY_COMPILE(${VARIABLE} + ${CMAKE_BINARY_DIR} + ${CMAKE_ROOT}/Modules/DummyCXXFile.cxx + CMAKE_FLAGS -DCMAKE_EXE_LINKER_FLAGS="${FLAGS}" + OUTPUT_VARIABLE OUTPUT) + IF (${VARIABLE}) + MESSAGE(STATUS "Checking to see if linker accepts flag ${FLAGS} - yes") + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Determining if the linker accepts the flag ${FLAGS} passed with " + "the following output:\n${OUTPUT}\n\n") + ELSE (${VARIABLE}) + MESSAGE(STATUS "Checking to see if linker accepts flag ${FLAGS} - no") + FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log + "Determining if the linker accepts the flag ${FLAGS} failed with " + "the following output:\n${OUTPUT}\n\n") + ENDIF (${VARIABLE}) + ENDIF(NOT DEFINED ${VARIABLE}) +ENDMACRO(KDESVN_CHECK_LINK_FLAG) + +# this macro is required to add libtools to normal build so +# we may debug our part from within build dir +# output name where +# _laname _soname ${LIBRARY_OUTPUT_PATH}/kde3 +MACRO(KDESVN_GENERATE_LIBTOOL_FILE _target) + GET_TARGET_PROPERTY(_target_location ${_target} LOCATION) + GET_FILENAME_COMPONENT(_laname ${_target_location} NAME_WE) + GET_FILENAME_COMPONENT(_soname ${_target_location} NAME) + IF(LIBRARY_OUTPUT_PATH) + SET(_laname ${LIBRARY_OUTPUT_PATH}/${_laname}.la) + ELSE(LIBRARY_OUTPUT_PATH) + SET(_laname ${CMAKE_CURRENT_BINARY_DIR}/${_laname}.la) + ENDIF(LIBRARY_OUTPUT_PATH) + IF(LIBRARY_OUTPUT_PATH) + SET(_libdir "'${LIBRARY_OUTPUT_PATH}/kde3'") + ELSE(LIBRARY_OUTPUT_PATH) + SET(_libdir "'${CMAKE_CURRENT_BUILD_DIR}/kde3'") + ENDIF(LIBRARY_OUTPUT_PATH) + ADD_CUSTOM_COMMAND(TARGET ${_target} + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS + -DOUTPUTFILE:FILEPATH=${_laname} + -DSONAME:STRING=${_soname} + -DLIBDIR:STRING=${_libdir} + -P ${CMAKE_SOURCE_DIR}/cmakemodules/generatelibtoolfile.cmake + ) +ENDMACRO(KDESVN_GENERATE_LIBTOOL_FILE) diff --git a/cmakemodules/makedist.sh.in b/cmakemodules/makedist.sh.in new file mode 100755 index 0000000..2a77085 --- /dev/null +++ b/cmakemodules/makedist.sh.in @@ -0,0 +1,36 @@ +#!/bin/sh +VERSION=@VERSION@ +SRCROOT=@CMAKE_SOURCE_DIR@ +BUILDDIR=@CMAKE_BINARY_DIR@ +PROJECT=@PROJECT_NAME@ +GENTOO_VERSION=@GENTOO_VERSION@ + +EXCLUDE="@DIST_EXCLUDE@" +INCLUDE="@DIST_INCLUDE@" +EXPORT_DIR="${PROJECT}-${VERSION}" + +if [ ! -d ${SRCROOT}/.svn ]; then + echo "This script must run for a svn dir!" + exit 1 +fi + +echo "Exporting source tree" +svn export "${SRCROOT}" ${EXPORT_DIR} + +echo "Copy required files to export" +for i in $INCLUDE ; do + echo " $i" + cp ${BUILDDIR}/$i ${EXPORT_DIR} +done + +echo "Removing not needed stuff" +for i in $EXCLUDE ; do + echo " $i" + rm -rf $EXPORT_DIR/$i +done + +echo "Generating archive" +tar cjf ${BUILDDIR}/${PROJECT}-${VERSION}.tar.bz2 ${EXPORT_DIR} + +echo "Cleaning up" +rm -rf ${EXPORT_DIR} diff --git a/cmakemodules/package_messages.sh.in b/cmakemodules/package_messages.sh.in new file mode 100755 index 0000000..f062fca --- /dev/null +++ b/cmakemodules/package_messages.sh.in @@ -0,0 +1,84 @@ +#!/bin/sh + +# little helper script for regenerating translation files. Mostly taken from cvs.sh from kde-autotool environment +# adapted to a cmake build environment and removed a lot not realy needed stuff +#EXTRACTRC=@EXTRACTRC@ +#PREPARETIPS=@PREPARETIPS@ +MESSAGES_DIR=@MESSAGES_DIR@ +SOURCE_DIR=@CMAKE_SOURCE_DIR@ +MAKE=make +POFILES="@POFILES@" +podir="${SOURCE_DIR}/po" + + +cd ${SOURCE_DIR} +rm -rf po.backup +mkdir po.backup + +for i in `ls -1 po/*.pot 2>/dev/null | sed -e "s#po/##"`; do + egrep -v '^#([^:]|$)' po/$i | egrep '^.*[^ ]+.*$' | grep -v "\"POT-Creation" > po.backup/$i + cp po/$i po.backup/backup_$i + touch -r po/$i po.backup/backup_$i + rm po/$i +done + +podir=${podir:-$PWD/po} +#files=`find . -name Makefile.am | xargs egrep -l '^messages:' ` +#dirs=`for i in $files; do echo \`dirname $i\`; done` +dirs=${MESSAGES_DIR} +tmpname="$PWD/messages.log" +if test -z "$EXTRACTRC"; then EXTRACTRC=extractrc ; fi +if test -z "$PREPARETIPS"; then PREPARETIPS=preparetips ; fi +export EXTRACTRC PREPARETIPS + +for subdir in $dirs; do + test -z "$VERBOSE" || echo "Making messages in $subdir" + (cd $subdir + echo -e 'i18n("_: NAME OF TRANSLATORS\\n"\n"Your names")\ni18n("_: EMAIL OF TRANSLATORS\\n"\n"Your emails")' > _translatorinfo.cpp + $EXTRACTRC `find . -name \*.ui -o -name \*.rc` > rc.cpp + XGETTEXT="${XGETTEXT:-xgettext} -C -ki18n -ktr2i18n -kI18N_NOOP -ktranslate -kaliasLocale -x @KDE3_INCLUDE_DIR@/kde.pot" + find . -name '*.cpp' | xargs ${XGETTEXT} _translatorinfo.cpp -o ${podir}/@PROJECT_NAME@.pot + find . -name '*.ui.h' | xargs ${XGETTEXT} _translatorinfo.cpp -j -o ${podir}/@PROJECT_NAME@.pot + ) 2>&1 | grep -v '^make\[1\]' > $tmpname + test -s $tmpname && { echo $subdir ; cat "$tmpname"; } + test -f $subdir/rc.cpp && rm -f $subdir/rc.cpp + rm -f $subdir/_translatorinfo.cpp +done +rm -f $tmpname +for i in `ls -1 po.backup/*.pot 2>/dev/null | sed -e "s#po.backup/##" | egrep -v '^backup_'`; do + test -f po/$i || echo "disappeared: $i" +done +for i in `ls -1 po/*.pot 2>/dev/null | sed -e "s#po/##"`; do + msgmerge -q -o po/$i po/$i po/$i + egrep -v '^#([^:]|$)' po/$i | egrep '^.*[^ ]+.*$' | grep -v "\"POT-Creation" > temp.pot + if test -f po.backup/$i && test -n "`diff temp.pot po.backup/$i`"; then + echo "will update $i" + msgmerge -q po.backup/backup_$i po/$i > temp.pot + mv temp.pot po/$i + else + if test -f po.backup/backup_$i; then + test -z "$VERBOSE" || echo "I'm restoring $i" + mv po.backup/backup_$i po/$i + rm po.backup/$i + else + echo "will add $i" + fi + fi +done +rm -f temp.pot +rm -rf po.backup + +echo Merging messages +for cat in $POFILES; do + msgmerge -o $cat.new $cat @CMAKE_SOURCE_DIR@/po/@PROJECT_NAME@.pot + if test -s $cat.new; then + grep -v "\"POT-Creation" $cat.new > $cat.new.2 + grep -v "\"POT-Creation" $cat >> $cat.new.1 + if diff $cat.new.1 $cat.new.2; then + rm $cat.new + else + mv $cat.new $cat + fi + rm -f $cat.new.1 $cat.new.2 + fi +done |