diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-03-15 17:32:48 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-03-15 17:32:48 +0000 |
commit | e2f541c98dfa4081fa3ab3d28f08ea2309281884 (patch) | |
tree | cb721a55bc88753ddeb9754dc98ef45e2850ce30 /cmakemodules | |
download | tdesvn-e2f541c98dfa4081fa3ab3d28f08ea2309281884.tar.gz tdesvn-e2f541c98dfa4081fa3ab3d28f08ea2309281884.zip |
Added KDE3 version of kdesvn
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kdesvn@1103685 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'cmakemodules')
-rw-r--r-- | cmakemodules/FindKdeLibs.cmake | 521 | ||||
-rw-r--r-- | cmakemodules/KDE3Macros.cmake | 391 | ||||
-rw-r--r-- | cmakemodules/MacroEnsureVersion.cmake | 28 | ||||
-rw-r--r-- | cmakemodules/SetupCompiler.cmake | 72 | ||||
-rw-r--r-- | cmakemodules/TestSetenv.cxx | 7 | ||||
-rw-r--r-- | cmakemodules/cmake_uninstall.cmake.in | 21 | ||||
-rw-r--r-- | cmakemodules/generatelibtoolfile.cmake | 16 | ||||
-rw-r--r-- | cmakemodules/kde3uic.cmake | 20 | ||||
-rw-r--r-- | cmakemodules/kdesvnMacros.cmake | 50 | ||||
-rwxr-xr-x | cmakemodules/makedist.sh.in | 37 | ||||
-rwxr-xr-x | cmakemodules/package_messages.sh.in | 82 |
11 files changed, 1245 insertions, 0 deletions
diff --git a/cmakemodules/FindKdeLibs.cmake b/cmakemodules/FindKdeLibs.cmake new file mode 100644 index 0000000..e36dab4 --- /dev/null +++ b/cmakemodules/FindKdeLibs.cmake @@ -0,0 +1,521 @@ +include(FindQt3) + +# - Find the KDE3 include and library dirs, KDE preprocessors and define a some macros +# +# This module defines the following variables: +# KDE3_DEFINITIONS - compiler definitions required for compiling KDE software +# KDE3_INCLUDE_DIR - the KDE include directory +# KDE3_INCLUDE_DIRS - the KDE and the Qt include directory, for use with INCLUDE_DIRECTORIES() +# KDE3_LIB_DIR - the directory where the KDE libraries are installed, for use with LINK_DIRECTORIES() +# QT_AND_KDECORE_LIBS - this contains both the Qt and the kdecore library +# KDE3_DCOPIDL_EXECUTABLE - the dcopidl executable +# KDE3_DCOPIDL2CPP_EXECUTABLE - the dcopidl2cpp executable +# KDE3_KCFGC_EXECUTABLE - the kconfig_compiler executable +# KDE3_FOUND - set to TRUE if all of the above has been found +# +# The following user adjustable options are provided: +# +# KDE3_BUILD_TESTS - enable this to build KDE testcases +# +# +# It also adds the following macros (from KDE3Macros.cmake) +# SRCS_VAR is always the variable which contains the list of source files for your application or library. +# +# KDE3_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. +# +# KDE3_ADD_MOC_FILES(SRCS_VAR file1 ... fileN ) +# If you don't use the KDE3_AUTOMOC() macro, for the files +# listed here moc files will be created (named "foo.moc.cpp") +# +# KDE3_ADD_DCOP_SKELS(SRCS_VAR header1.h ... headerN.h ) +# Use this to generate DCOP skeletions from the listed headers. +# +# KDE3_ADD_DCOP_STUBS(SRCS_VAR header1.h ... headerN.h ) +# Use this to generate DCOP stubs from the listed headers. +# +# KDE3_ADD_UI_FILES(SRCS_VAR file1.ui ... fileN.ui ) +# Use this to add the Qt designer ui files to your application/library. +# +# KDE3_ADD_KCFG_FILES(SRCS_VAR file1.kcfgc ... fileN.kcfgc ) +# Use this to add KDE kconfig compiler files to your application/library. +# +# KDE3_INSTALL_LIBTOOL_FILE(target) +# This will create and install a simple libtool file for the given target. +# +# KDE3_ADD_EXECUTABLE(name file1 ... fileN ) +# Currently identical to ADD_EXECUTABLE(), may provide some advanced features in the future. +# +# KDE3_ADD_KPART(name [WITH_PREFIX] file1 ... fileN ) +# Create a KDE plugin (KPart, kioslave, etc.) from the given source files. +# 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. +# +# KDE3_ADD_KDEINIT_EXECUTABLE(name 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. +# +# The option KDE3_ENABLE_FINAL to enable all-in-one compilation is +# no longer supported. +# +# +# Author: Alexander Neundorf <neundorf@kde.org> + +IF(NOT UNIX AND KDE3_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Compiling KDE3 applications and libraries under Windows is not supported") +ENDIF(NOT UNIX AND KDE3_FIND_REQUIRED) + +# If Qt4 has already been found, fail. +IF(QT4_FOUND) + IF(KDE3_FIND_REQUIRED) + MESSAGE( FATAL_ERROR "KDE3/Qt3 and Qt4 cannot be used together in one project.") + ELSE(KDE3_FIND_REQUIRED) + IF(NOT KDE3_FIND_QUIETLY) + MESSAGE( STATUS "KDE3/Qt3 and Qt4 cannot be used together in one project.") + ENDIF(NOT KDE3_FIND_QUIETLY) + RETURN() + ENDIF(KDE3_FIND_REQUIRED) +ENDIF(QT4_FOUND) + + +SET(QT_MT_REQUIRED TRUE) +#SET(QT_MIN_VERSION "3.0.0") + +#this line includes FindQt.cmake, which searches the Qt library and headers +IF(KDE3_FIND_REQUIRED) + SET(_REQ_STRING_KDE3 "REQUIRED") +ENDIF(KDE3_FIND_REQUIRED) + +FIND_PACKAGE(Qt3 ${_REQ_STRING_KDE3}) +FIND_PACKAGE(X11 ${_REQ_STRING_KDE3}) + + +#now try to find some kde stuff +FIND_PROGRAM(KDECONFIG_EXECUTABLE NAMES kde-config + HINTS + $ENV{KDEDIR}/bin + PATHS + /opt/kde3/bin + /opt/kde/bin + /usr/kde3/bin + ) + +SET(KDE3PREFIX) +IF(KDECONFIG_EXECUTABLE) + EXECUTE_PROCESS(COMMAND ${KDECONFIG_EXECUTABLE} --version + OUTPUT_VARIABLE kde_config_version ) + + STRING(REGEX MATCH "KDE: .\\." kde_version ${kde_config_version}) + IF (${kde_version} MATCHES "KDE: 3\\.") + EXECUTE_PROCESS(COMMAND ${KDECONFIG_EXECUTABLE} --prefix + OUTPUT_VARIABLE kdedir ) + STRING(REGEX REPLACE "\n" "" KDE3PREFIX "${kdedir}") + + ENDIF (${kde_version} MATCHES "KDE: 3\\.") +ENDIF(KDECONFIG_EXECUTABLE) + + + +# at first the KDE include direcory +# kpassdlg.h comes from kdeui and doesn't exist in KDE4 anymore +# FIND_PATH(KDE3_INCLUDE_DIR kpassdlg.h +# HINTS +# $ENV{KDEDIR}/include +# ${KDE3PREFIX}/include +# PATHS +# /opt/kde3/include +# /opt/kde/include +# /usr/include/kde +# /usr/local/include/kde +# ) + +# override this +SET(KDE3_INCLUDE_DIR "/usr/include/kde") + +#now the KDE library directory +FIND_LIBRARY(KDE3_KDECORE_LIBRARY NAMES kdecore + HINTS + $ENV{KDEDIR}/lib + ${KDE3PREFIX}/lib + PATHS + /opt/kde3/lib + /opt/kde/lib + /usr/kde3/lib +) + +SET(QT_AND_KDECORE_LIBS ${QT_LIBRARIES} ${KDE3_KDECORE_LIBRARY}) + +GET_FILENAME_COMPONENT(KDE3_LIB_DIR ${KDE3_KDECORE_LIBRARY} PATH ) + +IF(NOT KDE3_LIBTOOL_DIR) + IF(KDE3_KDECORE_LIBRARY MATCHES lib64) + SET(KDE3_LIBTOOL_DIR /lib64/kde3) + ELSE(KDE3_KDECORE_LIBRARY MATCHES lib64) + SET(KDE3_LIBTOOL_DIR /lib/kde3) + ENDIF(KDE3_KDECORE_LIBRARY MATCHES lib64) +ENDIF(NOT KDE3_LIBTOOL_DIR) + +#now search for the dcop utilities +FIND_PROGRAM(KDE3_DCOPIDL_EXECUTABLE NAMES dcopidl + HINTS + $ENV{KDEDIR}/bin + ${KDE3PREFIX}/bin + PATHS + /opt/kde3/bin + /opt/kde/bin + /usr/kde3/bin + ) + +FIND_PROGRAM(KDE3_DCOPIDL2CPP_EXECUTABLE NAMES dcopidl2cpp + HINTS + $ENV{KDEDIR}/bin + ${KDE3PREFIX}/bin + PATHS + /opt/kde3/bin + /opt/kde/bin + /usr/kde3/bin + ) + +FIND_PROGRAM(KDE3_KCFGC_EXECUTABLE NAMES kconfig_compiler + HINTS + $ENV{KDEDIR}/bin + ${KDE3PREFIX}/bin + PATHS + /opt/kde3/bin + /opt/kde/bin + /usr/kde3/bin + ) + + +#SET KDE3_FOUND +IF (KDE3_INCLUDE_DIR AND KDE3_LIB_DIR AND KDE3_DCOPIDL_EXECUTABLE AND KDE3_DCOPIDL2CPP_EXECUTABLE AND KDE3_KCFGC_EXECUTABLE) + SET(KDE3_FOUND TRUE) +ELSE (KDE3_INCLUDE_DIR AND KDE3_LIB_DIR AND KDE3_DCOPIDL_EXECUTABLE AND KDE3_DCOPIDL2CPP_EXECUTABLE AND KDE3_KCFGC_EXECUTABLE) + SET(KDE3_FOUND FALSE) +ENDIF (KDE3_INCLUDE_DIR AND KDE3_LIB_DIR AND KDE3_DCOPIDL_EXECUTABLE AND KDE3_DCOPIDL2CPP_EXECUTABLE AND KDE3_KCFGC_EXECUTABLE) + +# add some KDE specific stuff +SET(KDE3_DEFINITIONS -DQT_CLEAN_NAMESPACE -D_GNU_SOURCE) + +# set compiler flags only if KDE3 has actually been found +IF(KDE3_FOUND) + SET(_KDE3_USE_FLAGS FALSE) + IF(CMAKE_COMPILER_IS_GNUCXX) + SET(_KDE3_USE_FLAGS TRUE) # use flags for gnu compiler + EXECUTE_PROCESS(COMMAND ${CMAKE_CXX_COMPILER} --version + OUTPUT_VARIABLE out) + # gnu gcc 2.96 does not work with flags + # I guess 2.95 also doesn't then + IF("${out}" MATCHES "2.9[56]") + SET(_KDE3_USE_FLAGS FALSE) + ENDIF("${out}" MATCHES "2.9[56]") + ENDIF(CMAKE_COMPILER_IS_GNUCXX) + + #only on linux, but NOT e.g. on FreeBSD: + IF(CMAKE_SYSTEM_NAME MATCHES "Linux" AND _KDE3_USE_FLAGS) + SET (KDE3_DEFINITIONS ${KDE3_DEFINITIONS} -D_XOPEN_SOURCE=500 -D_BSD_SOURCE) + SET ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-long-long -ansi -Wundef -Wcast-align -Wconversion -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 -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -fno-exceptions -fno-check-new -fno-common") + ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux" AND _KDE3_USE_FLAGS) + + # works on FreeBSD, NOT tested on NetBSD and OpenBSD + IF (CMAKE_SYSTEM_NAME MATCHES BSD AND _KDE3_USE_FLAGS) + SET ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-long-long -ansi -Wundef -Wcast-align -Wconversion -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 -Wundef -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-exceptions -fno-check-new -fno-common") + ENDIF (CMAKE_SYSTEM_NAME MATCHES BSD AND _KDE3_USE_FLAGS) + + # if no special buildtype is selected, add -O2 as default optimization + IF (NOT CMAKE_BUILD_TYPE AND _KDE3_USE_FLAGS) + SET ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2") + SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2") + ENDIF (NOT CMAKE_BUILD_TYPE AND _KDE3_USE_FLAGS) + +#SET(CMAKE_SHARED_LINKER_FLAGS "-avoid-version -module -Wl,--no-undefined -Wl,--allow-shlib-undefined") +#SET(CMAKE_SHARED_LINKER_FLAGS "-Wl,--fatal-warnings -avoid-version -Wl,--no-undefined -lc") +#SET(CMAKE_MODULE_LINKER_FLAGS "-Wl,--fatal-warnings -avoid-version -Wl,--no-undefined -lc") +ENDIF(KDE3_FOUND) + + +# KDE3Macros.cmake contains all the KDE specific macros +INCLUDE(KDE3Macros) + + +MACRO (KDE3_PRINT_RESULTS) + IF(KDE3_INCLUDE_DIR) + MESSAGE(STATUS "Found KDE3 include dir: ${KDE3_INCLUDE_DIR}") + ELSE(KDE3_INCLUDE_DIR) + MESSAGE(STATUS "Didn't find KDE3 headers") + ENDIF(KDE3_INCLUDE_DIR) + + IF(KDE3_LIB_DIR) + MESSAGE(STATUS "Found KDE3 library dir: ${KDE3_LIB_DIR}") + ELSE(KDE3_LIB_DIR) + MESSAGE(STATUS "Didn't find KDE3 core library") + ENDIF(KDE3_LIB_DIR) + + IF(KDE3_DCOPIDL_EXECUTABLE) + MESSAGE(STATUS "Found KDE3 dcopidl preprocessor: ${KDE3_DCOPIDL_EXECUTABLE}") + ELSE(KDE3_DCOPIDL_EXECUTABLE) + MESSAGE(STATUS "Didn't find the KDE3 dcopidl preprocessor") + ENDIF(KDE3_DCOPIDL_EXECUTABLE) + + IF(KDE3_DCOPIDL2CPP_EXECUTABLE) + MESSAGE(STATUS "Found KDE3 dcopidl2cpp preprocessor: ${KDE3_DCOPIDL2CPP_EXECUTABLE}") + ELSE(KDE3_DCOPIDL2CPP_EXECUTABLE) + MESSAGE(STATUS "Didn't find the KDE3 dcopidl2cpp preprocessor") + ENDIF(KDE3_DCOPIDL2CPP_EXECUTABLE) + + IF(KDE3_KCFGC_EXECUTABLE) + MESSAGE(STATUS "Found KDE3 kconfig_compiler preprocessor: ${KDE3_KCFGC_EXECUTABLE}") + ELSE(KDE3_KCFGC_EXECUTABLE) + MESSAGE(STATUS "Didn't find the KDE3 kconfig_compiler preprocessor") + ENDIF(KDE3_KCFGC_EXECUTABLE) + +ENDMACRO (KDE3_PRINT_RESULTS) + + +IF (KDE3_FIND_REQUIRED AND NOT KDE3_FOUND) + #bail out if something wasn't found + KDE3_PRINT_RESULTS() + MESSAGE(FATAL_ERROR "Could NOT find everything required for compiling KDE 3 programs") + +ENDIF (KDE3_FIND_REQUIRED AND NOT KDE3_FOUND) + + +IF (NOT KDE3_FIND_QUIETLY) + KDE3_PRINT_RESULTS() +ENDIF (NOT KDE3_FIND_QUIETLY) + +#add the found Qt and KDE include directories to the current include path +SET(KDE3_INCLUDE_DIRS ${QT_INCLUDE_DIR} ${KDE3_INCLUDE_DIR}) + +include(kdesvnMacros) + +IF(CMAKE_SIZEOF_VOID_P EQUAL 4) + SET(DEF_SUFF "") +ELSE(CMAKE_SIZEOF_VOID_P EQUAL 4) + SET(DEF_SUFF 64) +ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 4) + +set(LIB_SUFFIX ${DEF_SUFF} CACHE STRING "Define suffix of directory name (32/64)" FORCE) + +SET(LIB_SEARCH_PATHES ${KDE3_LIB_DIR} + $ENV{KDEDIR}/lib + /opt/kde/lib + /opt/kde3/lib + /usr/lib + /usr/local/lib + /usr/kde3/lib +) + +IF (LIB_SUFFIX) + SET(LIB_SEARCH_PATHES + $ENV{KDEDIR}/lib${LIB_SUFFIX} + /opt/kde/lib${LIB_SUFFIX} + /opt/kde3/lib${LIB_SUFFIX} + /usr/lib${LIB_SUFFIX} + /usr/local/lib${LIB_SUFFIX} + ${LIB_SEARCH_PATHES}) +ENDIF (LIB_SUFFIX) + +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_DCOP_LIBRARY NAMES DCOP + PATHS + ${LIB_SEARCH_PATHES} +) + +FIND_LIBRARY(KDE3_WALLET_LIBRARY NAMES kwalletclient + PATHS + ${LIB_SEARCH_PATHES} +) + +FIND_LIBRARY(KDE3_KINIT_KDED_LIBRARY NAMES kdeinit_kded + PATHS + ${LIB_SEARCH_PATHES} +) + +FIND_PROGRAM(KDE3_KDECONFIG_EXECUTABLE NAME kde-config PATHS + $ENV{KDEDIR}/bin + /opt/kde/bin + /opt/kde3/bin + /usr/kde3/bin +) + +FIND_PROGRAM(MSGFMT + NAMES gmsgfmt msgfmt) + +FIND_PROGRAM(STRIP + NAMES strip) + +FIND_PROGRAM(KDE3_MEINPROC_EXECUTABLE NAME meinproc PATHS + ${KDE3_BIN_INSTALL_DIR} + $ENV{KDEDIR}/bin + /opt/kde/bin + /opt/kde3/bin + /usr/kde3/bin +) + +IF(KDE3_MEINPROC_EXECUTABLE) + MESSAGE(STATUS "Found meinproc: ${KDE3_MEINPROC_EXECUTABLE}") +ELSE(KDE3_MEINPROC_EXECUTABLE) + MESSAGE(STATUS "Didn't find meinproc!") +ENDIF(KDE3_MEINPROC_EXECUTABLE) + +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") +ENDIF(MSGFMT) + +# '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 + +IF (CMAKE_SYSTEM MATCHES "Linux*") + 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) +ENDIF (CMAKE_SYSTEM MATCHES "Linux*") + + +# 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) diff --git a/cmakemodules/KDE3Macros.cmake b/cmakemodules/KDE3Macros.cmake new file mode 100644 index 0000000..242e12f --- /dev/null +++ b/cmakemodules/KDE3Macros.cmake @@ -0,0 +1,391 @@ +# + +# 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 + +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) + 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='${PLUGIN_INSTALL_DIR}'\n") + INSTALL(FILES ${_laname} DESTINATION ${PLUGIN_INSTALL_DIR}) +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/MacroEnsureVersion.cmake b/cmakemodules/MacroEnsureVersion.cmake new file mode 100644 index 0000000..091152d --- /dev/null +++ b/cmakemodules/MacroEnsureVersion.cmake @@ -0,0 +1,28 @@ +# LGPL-v2, David Faure +# +# 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 +# +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]+.*" "\\1" found_major_vers "${found_version}") + STRING(REGEX REPLACE "[0-9]+\\.([0-9])+\\.[0-9]+.*" "\\1" found_minor_vers "${found_version}") + STRING(REGEX REPLACE "[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/SetupCompiler.cmake b/cmakemodules/SetupCompiler.cmake new file mode 100644 index 0000000..4e1c003 --- /dev/null +++ b/cmakemodules/SetupCompiler.cmake @@ -0,0 +1,72 @@ +INCLUDE(TestCXXAcceptsFlag) +INCLUDE(MacroEnsureVersion) + +CHECK_CXX_ACCEPTS_FLAG("-fexceptions" CXX_EXCEPTION) +IF (CXX_EXCEPTION) + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions") +ENDIF (CXX_EXCEPTION) + +IF (CMAKE_COMPILER_IS_GNUCXX) + +CHECK_CXX_ACCEPTS_FLAG("-fstack-protector" CXX_PROTECTOR) +IF (CXX_PROTECTOR) + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector") +ENDIF (CXX_PROTECTOR) + +# some code from KDE4 trunk cmake - all stuff under LGPL I think +# check for visibility patch in libstdc++ below written by me +CHECK_CXX_ACCEPTS_FLAG("-fvisibility=hidden" HAVE_GCC_VISIBILITY) + +# get the gcc version +exec_program(${CMAKE_C_COMPILER} ARGS --version OUTPUT_VARIABLE _gcc_version_info) +string (REGEX MATCH " [34]\\.[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) + +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}") + IF (_GCC_COMPILED_WITH_BAD_ALLOCATOR) + SET(HAVE_GCC_VISIBILITY FALSE) + ENDIF (_GCC_COMPILED_WITH_BAD_ALLOCATOR) +else (GCC_IS_NEWER_THAN_4_1) + set(_GCC_COMPILED_WITH_BAD_ALLOCATOR FALSE) + CHECK_CXX_ACCEPTS_FLAG("-E" HAVE_PREPROCESSOR_FLAG) + IF (HAVE_PREPROCESSOR_FLAG) + FILE(WRITE ${CMAKE_BINARY_DIR}/dummy.cpp "#include <exception>\n") + EXECUTE_PROCESS(COMMAND ${CMAKE_CXX_COMPILER} -E ${CMAKE_BINARY_DIR}/dummy.cpp OUTPUT_VARIABLE _gcc_hidden_push_out RESULT_VARIABLE _gcc_hidden_push_err ERROR_QUIET) + FILE(REMOVE ${CMAKE_BINARY_DIR}/dummy.cpp) + IF (NOT ${_gcc_hidden_push_err}) + STRING(REGEX MATCH "GCC visibility push" _gcc_has_hidden_push ${_gcc_hidden_push_out}) + ENDIF (NOT ${_gcc_hidden_push_err}) + IF(_gcc_has_hidden_push) + MESSAGE(STATUS "libstdc++ is patched for visibility support.") + ELSE(_gcc_has_hidden_push) + MESSAGE(STATUS "libstdc++ isn't patched for visibility support. Disabling -fvisibility=hidden") + SET(HAVE_GCC_VISIBILITY FALSE) + ENDIF(_gcc_has_hidden_push) + ELSE (HAVE_PREPROCESSOR_FLAG) + # should never happen but who knows + SET(HAVE_GCC_VISIBILITY FALSE) + ENDIF (HAVE_PREPROCESSOR_FLAG) +endif (GCC_IS_NEWER_THAN_4_1) + +message(STATUS "have_visibility: ${HAVE_GCC_VISIBILITY} version>=4.1: ${GCC_IS_NEWER_THAN_4_1} bad alloctor: ${_GCC_COMPILED_WITH_BAD_ALLOCATOR}") +ENDIF (CMAKE_COMPILER_IS_GNUCXX) + +# check if we can use setenv +TRY_COMPILE(HAS_SETENV + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/cmakemodules/TestSetenv.cxx + OUTPUT_VARIABLE OUTPUT +) + +IF (HAS_SETENV) + MESSAGE(STATUS "Checking for setenv - yes") +ELSE (HAS_SETENV) + MESSAGE(STATUS "Checking for setenv - no") +ENDIF (HAS_SETENV)
\ No newline at end of file diff --git a/cmakemodules/TestSetenv.cxx b/cmakemodules/TestSetenv.cxx new file mode 100644 index 0000000..16f4d0f --- /dev/null +++ b/cmakemodules/TestSetenv.cxx @@ -0,0 +1,7 @@ +#include <stdlib.h> + +int main(int,char**) +{ + ::setenv("testvalue","1",0); + return 0; +} diff --git a/cmakemodules/cmake_uninstall.cmake.in b/cmakemodules/cmake_uninstall.cmake.in new file mode 100644 index 0000000..47187f5 --- /dev/null +++ b/cmakemodules/cmake_uninstall.cmake.in @@ -0,0 +1,21 @@ +IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") + MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") +ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") + +FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) +STRING(REGEX REPLACE "\n" ";" files "${files}") +FOREACH(file ${files}) + MESSAGE(STATUS "Uninstalling \"${file}\"") + IF(NOT EXISTS "${file}") + MESSAGE(FATAL_ERROR "File \"${file}\" does not exists.") + ENDIF(NOT EXISTS "${file}") + EXEC_PROGRAM("@CMAKE_COMMAND@" ARGS "-E remove \"${file}\"" + OUTPUT_VARIABLE rm_out + RETURN_VARIABLE rm_retval) + IF("${rm_retval}" GREATER 0) + MESSAGE(FATAL_ERROR "Problem when removing \"${file}\"") + ENDIF("${rm_retval}" GREATER 0) +ENDFOREACH(file) + + + 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..6df00a5 --- /dev/null +++ b/cmakemodules/makedist.sh.in @@ -0,0 +1,37 @@ +#!/bin/sh +VERSION=@VERSION@ +SRCROOT=@CMAKE_SOURCE_DIR@ +BUILDDIR=@CMAKE_BINARY_DIR@ +PROJECT=@PROJECT_NAME@ +KDESVN_VERSION=@KDESVN_VERSION@ + +EXCLUDE="@DIST_EXCLUDE@" +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" +cp ${BUILDDIR}/${PROJECT}.spec ${EXPORT_DIR} +cp ${SRCROOT}/doc/*.cache.bz2 ${EXPORT_DIR}/doc + +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} + +if [ "x$1" = "xrpm" ]; then + KDESVN_VERSION=${KDESVN_VERSION} rpmbuild -tb ${BUILDDIR}/${PROJECT}-${VERSION}.tar.bz2 +fi diff --git a/cmakemodules/package_messages.sh.in b/cmakemodules/package_messages.sh.in new file mode 100755 index 0000000..962240f --- /dev/null +++ b/cmakemodules/package_messages.sh.in @@ -0,0 +1,82 @@ +#!/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 really 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 --add-comments="TRANSLATORS:" -x ${includedir:-${KDEDIR:-@CMAKE_INSTALL_PREFIX@}/include/kde}/kde.pot" + find . -name '*.cpp' | xargs ${XGETTEXT} _translatorinfo.cpp -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 |