summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorAlexander Neundorf <neundorf@kde.org>2006-03-09 19:10:59 (GMT)
committerAlexander Neundorf <neundorf@kde.org>2006-03-09 19:10:59 (GMT)
commitd253baab99663f531d91d406faf6fe2b822f5cb8 (patch)
tree1bbdce092a3b66c975c6503513519ed9b29c5414 /Modules
parent26e1fea95b4b40cdaa99d069e4892c47f108756b (diff)
downloadCMake-d253baab99663f531d91d406faf6fe2b822f5cb8.zip
CMake-d253baab99663f531d91d406faf6fe2b822f5cb8.tar.gz
CMake-d253baab99663f531d91d406faf6fe2b822f5cb8.tar.bz2
ENH: add real-world-tested and used KDE3 support, and obsolete FindKDE.cmake, which wasn't used by anybody that I heard of
Alex
Diffstat (limited to 'Modules')
-rw-r--r--Modules/FindKDE.cmake149
-rw-r--r--Modules/FindKDE3.cmake211
-rw-r--r--Modules/KDE3Macros.cmake375
-rw-r--r--Modules/kde3init_dummy.cpp.in6
-rw-r--r--Modules/kde3uic.cmake20
5 files changed, 617 insertions, 144 deletions
diff --git a/Modules/FindKDE.cmake b/Modules/FindKDE.cmake
index 3778090..58f3206 100644
--- a/Modules/FindKDE.cmake
+++ b/Modules/FindKDE.cmake
@@ -1,148 +1,9 @@
-# - Locate KDE include paths and libraries
-# KDE_INCLUDE_DIR
-# KDE_LIB_DIR
-# KDE_KDE_CONFIG
-# KDE_DCOP_IDL
-# KDE_VERSION
-# the macro ADD_DCOP_SOURCES(src_headers dest_srcs)
+# I don't think anybody actually used this file
+# at least not in any large scale
+# so it should be safe to obsolete it now
#
-# usage:
-# SET(MY_APP_SOURCES main.cpp kfoo.cpp)
-# SET(MY_DCOP_SOURCES kfooiface.h)
-# ADD_DCOP_SOURCES(MY_DCOP_SOURCES MY_APP_SOURCES)
-# uses KDE_MIN_VERSION
+# Alex <neundorf@kde.org>
-CMAKE_MINIMUM_REQUIRED(VERSION 2.0.0)
+MESSAGE(FATAL_ERROR "FindKDE.cmake is obsolete, please use FindKDE3.cmake or FindKDE4.cmake instead.")
-FIND_PATH(KDE_INCLUDE_DIR kurl.h
- $ENV{KDEDIR}/include
- /opt/kde/include
- /opt/kde3/include
- /usr/local/include
- /usr/include/
- /usr/include/kde
- /usr/local/include/kde
- )
-
-IF(KDE_INCLUDE_DIR)
- MESSAGE(STATUS "Found KDE header files in ${KDE_INCLUDE_DIR}")
-ELSE(KDE_INCLUDE_DIR)
- MESSAGE(FATAL_ERROR "Didn't find KDE headers")
-ENDIF(KDE_INCLUDE_DIR)
-
-FIND_PROGRAM(KDE_CONFIG NAME kde-config PATHS
- $ENV{KDEDIR}/bin
- /opt/kde/bin
- /opt/kde3/bin)
-
-IF(NOT KDE_CONFIG)
- MESSAGE(FATAL_ERROR "Didn't find the kde-config utility")
-ENDIF(NOT KDE_CONFIG)
-
-FIND_PATH(KDE_LIB_DIR libkdecore.so
- $ENV{KDEDIR}/lib
- /opt/kde/lib
- /opt/kde3/lib
- )
-
-IF(KDE_LIB_DIR)
- MESSAGE(STATUS "Found KDE libraries in ${KDE_LIB_DIR}")
-ELSE(KDE_LIB_DIR)
- MESSAGE(FATAL_ERROR "Didn't find KDE core library")
-ENDIF(KDE_LIB_DIR)
-
-IF (KDE_MIN_VERSION)
- #extract the version from kdeversion.h
-
- FILE(READ ${KDE_INCLUDE_DIR}/kdeversion.h KDE_VERSION_H)
-
- STRING(REGEX REPLACE ".*#define[\\t\\ ]+KDE_VERSION_STRING[\\t\\ ]+\"([0-9]+\\.[0-9]+\\.[0-9]+)\".*" "\\1" KDE_VERSION "${KDE_VERSION_H}")
- STRING(REGEX REPLACE ".*#define[\\t\\ ]+KDE_VERSION_MAJOR[\\t\\ ]+([0-9]+).*" "\\1" kde_major_vers "${KDE_VERSION_H}")
- STRING(REGEX REPLACE ".*#define[\\t\\ ]+KDE_VERSION_MINOR[\\t\\ ]+([0-9]+).*" "\\1" kde_minor_vers "${KDE_VERSION_H}")
- STRING(REGEX REPLACE ".*#define[\\t\\ ]+KDE_VERSION_RELEASE[\\t\\ ]+([0-9]+).*" "\\1" kde_vers_release "${KDE_VERSION_H}")
-
-#now parse the parts of the user given version string into variables
- STRING(REGEX MATCH "^[0-9]+\\.[0-9]+\\.[0-9]+$" req_kde_major_vers "${KDE_MIN_VERSION}")
- IF (NOT req_kde_major_vers)
- MESSAGE( FATAL_ERROR "Invalid KDE version string given: \"${KDE_MIN_VERSION}\", expected e.g. \"3.1.5\"")
- ENDIF (NOT req_kde_major_vers)
-
- STRING(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" req_kde_major_vers "${KDE_MIN_VERSION}")
- STRING(REGEX REPLACE "[0-9]+\\.([0-9])+\\.[0-9]+" "\\1" req_kde_minor_vers "${KDE_MIN_VERSION}")
- STRING(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" req_kde_patch_vers "${KDE_MIN_VERSION}")
-
-# req = "6.5.4", qt = "3.2.1"
-
- IF (req_kde_major_vers GREATER kde_major_vers) # (6 > 3) ?
- MESSAGE( FATAL_ERROR "KDE major version not matched (required: ${KDE_MIN_VERSION}, found: ${KDE_VERSION})") # yes
- ELSE (req_kde_major_vers GREATER kde_major_vers) # no
- IF (req_kde_major_vers LESS kde_major_vers) # (6 < 3) ?
- SET( QT_VERSION_BIG_ENOUGH "YES" ) # yes
- ELSE (req_kde_major_vers LESS kde_major_vers) # ( 6==3) ?
- IF (req_kde_minor_vers GREATER kde_minor_vers) # (5>2) ?
- MESSAGE( FATAL_ERROR "KDE minor version not matched (required: ${KDE_MIN_VERSION}, found: ${KDE_VERSION})") # yes
- ELSE (req_kde_minor_vers GREATER kde_minor_vers) # no
- IF (req_kde_minor_vers LESS kde_minor_vers) # (5<2) ?
- SET( QT_VERSION_BIG_ENOUGH "YES" ) # yes
- ELSE (req_kde_minor_vers LESS kde_minor_vers) # (5==2)
- IF (req_kde_patch_vers GREATER kde_vers_release) # (4>1) ?
- MESSAGE( FATAL_ERROR "KDE release version not matched (required: ${KDE_MIN_VERSION}, found: ${KDE_VERSION})") # yes
- ELSE (req_kde_patch_vers GREATER kde_patch_vers) # (4>1) ?
- SET( QT_VERSION_BIG_ENOUGH "YES" ) # yes
- ENDIF (req_kde_patch_vers GREATER kde_vers_release) # (4>1) ?
- ENDIF (req_kde_minor_vers LESS kde_minor_vers)
- ENDIF (req_kde_minor_vers GREATER kde_minor_vers)
- ENDIF (req_kde_major_vers LESS kde_major_vers)
- ENDIF (req_kde_major_vers GREATER kde_major_vers)
- MESSAGE(STATUS "KDE version ok (required: ${KDE_MIN_VERSION}, found: ${KDE_VERSION})")
-ENDIF (KDE_MIN_VERSION)
-
-#now search for the dcop utilities
-FIND_PROGRAM(KDE_DCOPIDL NAME dcopidl PATHS
- $ENV{KDEDIR}/bin
- /opt/kde/bin
- /opt/kde3/bin)
-
-IF(NOT KDE_DCOPIDL)
- MESSAGE(FATAL_ERROR "Didn't find the dcopidl preprocessor")
-ENDIF(NOT KDE_DCOPIDL)
-
-FIND_PROGRAM(KDE_DCOPIDL2CPP NAME dcopidl2cpp PATHS
- $ENV{KDEDIR}/bin
- /opt/kde/bin
- /opt/kde3/bin)
-
-IF(NOT KDE_DCOPIDL2CPP)
- MESSAGE(FATAL_ERROR "Didn't find the dcopidl2cpp preprocessor")
-ENDIF(NOT KDE_DCOPIDL2CPP)
-
-MACRO(DCOP_WRAP SKEL_SOURCES)
- FOREACH(dcop_source ${ARGN})
-
- GET_FILENAME_COMPONENT(dcop_source_basename ${dcop_source} NAME_WE)
-
- SET(idl_file ${CMAKE_BINARY_DIR}/${dcop_source_basename}.kidl)
- SET(skel_file ${CMAKE_BINARY_DIR}/${dcop_source_basename}_skel.cpp)
-
- ADD_CUSTOM_COMMAND(
- OUTPUT ${idl_file}
- COMMAND ${KDE_DCOPIDL}
- ARGS ${CMAKE_SOURCE_DIR}/${dcop_source} > ${idl_file}
- DEPENDS ${CMAKE_SOURCE_DIR}/${dcop_source})
-
- ADD_CUSTOM_COMMAND(
- OUTPUT ${skel_file}
- COMMAND ${KDE_DCOPIDL2CPP}
- ARGS --c++-suffix cpp --no-signals --no-stub ${idl_file}
- DEPENDS ${idl_file})
-
- SET( SKEL_SOURCES ${${SKEL_SOURCES}}
- ${skel_file})
- ENDFOREACH(dcop_source)
-ENDMACRO (DCOP_WRAP)
-
-MARK_AS_ADVANCED(
- KDE_INCLUDE_DIR
- KDE_LIB_DIR
- )
diff --git a/Modules/FindKDE3.cmake b/Modules/FindKDE3.cmake
new file mode 100644
index 0000000..51e2ced
--- /dev/null
+++ b/Modules/FindKDE3.cmake
@@ -0,0 +1,211 @@
+# - 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_DIR()
+# QT_AND_KDECORE_LIBRARIES - 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_ENABLE_FINAL - enable this for KDE-style enable-final all-in-one compilation
+# 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 )
+# Equivalent to ADD_EXECUTABLE(), but additionally supports KDE3_ENABLE_FINAL
+#
+# KDE3_ADD_KPART(name [WITH_PREFIX] file1 ... fileN )
+# Create a KDE plugin (KPart, kioslave, etc.) from the given source files.
+# It supports KDE3_ENABLE_FINAL
+# If WITH_PREFIX is given, the resulting plugin will have the prefix "lib", otherwise it won't.
+# It creates and install 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.
+# It supports KDE3_ENABLE_FINAL.
+# A library named kdeinit_<name> will be created and a small executable which links to it.
+# Supports KDE3_ENABLE_FINAL
+#
+# Author: Alexander Neundorf <neundorf@kde.org>
+
+IF(NOT UNIX)
+ MESSAGE(FATAL_ERROR "Compiling KDE3 applications and libraries under Windows is not supported")
+ENDIF(NOT UNIX)
+
+
+SET(QT_MT_REQUIRED TRUE)
+#SET(QT_MIN_VERSION "3.0.0")
+
+#this line includes FindQt.cmake, which searches the Qt library and headers
+FIND_PACKAGE(Qt3 REQUIRED)
+FIND_PACKAGE(X11 REQUIRED)
+
+
+SET(QT_AND_KDECORE_LIBS ${QT_LIBRARIES} kdecore)
+
+#add some KDE specific stuff
+SET(KDE3_DEFINITIONS -DQT_CLEAN_NAMESPACE -D_GNU_SOURCE)
+
+#only on linux, but NOT e.g. on FreeBSD:
+IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
+ 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 -O2 -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 -O2 -Wformat-security -fno-exceptions -fno-check-new -fno-common")
+ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
+
+# works on FreeBSD, NOT tested on NetBSD and OpenBSD
+IF (CMAKE_SYSTEM_NAME MATCHES BSD)
+ SET ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-long-long -ansi -Wundef -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -O2 -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 -O2 -Wformat-security -Wmissing-format-attribute -fno-exceptions -fno-check-new -fno-common")
+ENDIF (CMAKE_SYSTEM_NAME MATCHES BSD)
+
+
+#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")
+
+#now try to find some kde stuff
+
+#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
+ $ENV{KDEDIR}/include
+ /opt/kde/include
+ /opt/kde3/include
+ /usr/local/include
+ /usr/include/
+ /usr/include/kde
+ /usr/local/include/kde
+)
+
+#now the KDE library directory
+FIND_LIBRARY(KDE3_LIB_DIR NAMES kdecore
+ PATHS
+ $ENV{KDEDIR}/lib
+ /opt/kde/lib
+ /opt/kde3/lib
+ /usr/lib
+ /usr/local/lib
+)
+
+#now the KDE service types directory
+#FIND_PATH(KDE3_SERVICETYPES_DIR ktexteditor.desktop
+# $ENV{KDEDIR}/share/servicetypes/
+# /opt/kde/share/servicetypes/
+# /opt/kde3/share/servicetypes/
+#)
+
+#now search for the dcop utilities
+FIND_PROGRAM(KDE3_DCOPIDL_EXECUTABLE NAME dcopidl PATHS
+ $ENV{KDEDIR}/bin
+ /opt/kde/bin
+ /opt/kde3/bin
+ )
+
+FIND_PROGRAM(KDE3_DCOPIDL2CPP_EXECUTABLE NAME dcopidl2cpp PATHS
+ $ENV{KDEDIR}/bin
+ /opt/kde/bin
+ /opt/kde3/bin)
+
+FIND_PROGRAM(KDE3_KCFGC_EXECUTABLE NAME kconfig_compiler PATHS
+ $ENV{KDEDIR}/bin
+ /opt/kde/bin
+ /opt/kde3/bin)
+
+
+# KDE3Macros.cmake contains all the KDE specific macros
+INCLUDE(KDE3Macros)
+
+
+#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)
+
+
+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})
+
diff --git a/Modules/KDE3Macros.cmake b/Modules/KDE3Macros.cmake
new file mode 100644
index 0000000..99dfb5f
--- /dev/null
+++ b/Modules/KDE3Macros.cmake
@@ -0,0 +1,375 @@
+
+
+# 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(MacroLibrary)
+
+#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 -nounload -o ${_header} ${CMAKE_CURRENT_SOURCE_DIR}/${_current_FILE}
+ DEPENDS ${_tmp_FILE}
+ )
+
+ ADD_CUSTOM_COMMAND(OUTPUT ${_src}
+ COMMAND ${CMAKE_COMMAND}
+ ARGS
+ -DKDE_UIC_FILE:STRING=${_tmp_FILE}
+ -DKDE_UIC_CPP_FILE:STRING=${_src}
+ -DKDE_UIC_H_FILE:STRING=${_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}
+ )
+
+ MACRO_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)
+
+
+MACRO(KDE3_INSTALL_ICONS _theme)
+ ADD_CUSTOM_TARGET(install_icons )
+ SET_TARGET_PROPERTIES(install_icons PROPERTIES POST_INSTALL_SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake )
+ FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake "# icon installations rules\n")
+ FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake "SET(CMAKE_BACKWARDS_COMPATIBILITY \"2.2\") \n")
+
+ 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}")
+
+ 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}" )
+ SET(_ICON_INSTALL_NAME ${CMAKE_INSTALL_PREFIX}/share/icons/${_theme}/${_size}x${_size}/${_icon_GROUP}/${_name})
+ FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake "message(STATUS \"Installing ${_ICON_INSTALL_NAME}\") \n")
+ FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake "CONFIGURE_FILE( ${_current_ICON} ${_ICON_INSTALL_NAME} COPYONLY) \n")
+
+ 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='${CMAKE_INSTALL_PREFIX}/lib/kde3'\n")
+
+ INSTALL_FILES(/lib/kde3 FILES ${_laname})
+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/Modules/kde3init_dummy.cpp.in b/Modules/kde3init_dummy.cpp.in
new file mode 100644
index 0000000..7135c73
--- /dev/null
+++ b/Modules/kde3init_dummy.cpp.in
@@ -0,0 +1,6 @@
+
+/* used by KDE3Macros.cmake */
+
+extern "C" int kdemain(int argc, char* argv[]);
+extern "C" int kdeinitmain(int argc, char* argv[]) { return kdemain(argc,argv); }
+int main(int argc, char* argv[]) { return kdemain(argc,argv); }
diff --git a/Modules/kde3uic.cmake b/Modules/kde3uic.cmake
new file mode 100644
index 0000000..9483729
--- /dev/null
+++ b/Modules/kde3uic.cmake
@@ -0,0 +1,20 @@
+
+
+# used internally by KDE3Macros.cmake
+# neundorf@kde.org
+
+
+EXECUTE_PROCESS(COMMAND uic
+ -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}")
+