Browse Source

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
tags/v3.5.13
tpearson 9 years ago
commit
ceea23677c
100 changed files with 20998 additions and 0 deletions
  1. +274
    -0
      CMakeLists.txt
  2. +246
    -0
      build.sh
  3. +22
    -0
      cmakemodules/COPYING-CMAKE-SCRIPTS
  4. +21
    -0
      cmakemodules/CheckCXXCompilerFlag.cmake
  5. +49
    -0
      cmakemodules/FindGNUWIN32.cmake
  6. +32
    -0
      cmakemodules/FindKBFX.cmake
  7. +40
    -0
      cmakemodules/FindKDE4.cmake
  8. +839
    -0
      cmakemodules/FindKDE4Internal.cmake
  9. +89
    -0
      cmakemodules/FindKDEWIN32.cmake
  10. +316
    -0
      cmakemodules/FindKdeLibs.cmake
  11. +1081
    -0
      cmakemodules/FindQt4.cmake
  12. +47
    -0
      cmakemodules/FindStrigi.cmake
  13. +352
    -0
      cmakemodules/FindX11.cmake
  14. +392
    -0
      cmakemodules/KDE3Macros.cmake
  15. +854
    -0
      cmakemodules/KDE4Macros.cmake
  16. +19
    -0
      cmakemodules/MacroAddCompileFlags.cmake
  17. +20
    -0
      cmakemodules/MacroAddFileDependencies.cmake
  18. +18
    -0
      cmakemodules/MacroAddLinkFlags.cmake
  19. +21
    -0
      cmakemodules/MacroAdditionalCleanFiles.cmake
  20. +20
    -0
      cmakemodules/MacroBoolTo01.cmake
  21. +16
    -0
      cmakemodules/MacroEnsureOutOfSourceBuild.cmake
  22. +35
    -0
      cmakemodules/MacroEnsureVersion.cmake
  23. +18
    -0
      cmakemodules/MacroLibrary.cmake
  24. +112
    -0
      cmakemodules/MacroLogFeature.cmake
  25. +27
    -0
      cmakemodules/MacroOptionalAddSubdirectory.cmake
  26. +28
    -0
      cmakemodules/MacroOptionalFindPackage.cmake
  27. +47
    -0
      cmakemodules/MacroPushRequiredVars.cmake
  28. +16
    -0
      cmakemodules/generatelibtoolfile.cmake
  29. +20
    -0
      cmakemodules/kde3uic.cmake
  30. +50
    -0
      cmakemodules/kdesvnMacros.cmake
  31. +36
    -0
      cmakemodules/makedist.sh.in
  32. +84
    -0
      cmakemodules/package_messages.sh.in
  33. +4
    -0
      config.h.in
  34. +57
    -0
      configdialog/CMakeLists.txt
  35. +22
    -0
      configdialog/kbfx_install_theme.desktop
  36. +23
    -0
      configdialog/kbfx_prepare_theme.desktop
  37. +18
    -0
      configdialog/kbfx_theme.desktop
  38. +416
    -0
      configdialog/kbfxconfigapp.cpp
  39. +36
    -0
      configdialog/kbfxconfigapp.desktop
  40. +159
    -0
      configdialog/kbfxconfigapp.h
  41. +16
    -0
      configdialog/kbfxconfigapp.lsm
  42. +8
    -0
      configdialog/kbfxconfigappui.rc
  43. +727
    -0
      configdialog/kbfxconfigdlgabout.ui
  44. +159
    -0
      configdialog/kbfxconfigdlgabout.ui.h
  45. +1275
    -0
      configdialog/kbfxconfigdlgbutton.ui
  46. +183
    -0
      configdialog/kbfxconfigdlgbutton.ui.h
  47. +1193
    -0
      configdialog/kbfxconfigdlgfonts-old.ui
  48. +204
    -0
      configdialog/kbfxconfigdlgfonts-old.ui.h
  49. +1084
    -0
      configdialog/kbfxconfigdlglayout.ui
  50. +641
    -0
      configdialog/kbfxconfigdlglayout.ui.h
  51. +670
    -0
      configdialog/kbfxconfigdlgmain.ui
  52. +24
    -0
      configdialog/kbfxconfigdlgmain.ui.h
  53. +390
    -0
      configdialog/kbfxconfigdlgplugins.ui
  54. +157
    -0
      configdialog/kbfxconfigdlgplugins.ui.h
  55. +505
    -0
      configdialog/kbfxconfigdlgstyle.ui
  56. +30
    -0
      configdialog/kbfxconfigdlgstyle.ui.h
  57. +1032
    -0
      configdialog/kbfxconfigdlgthemes.ui
  58. +367
    -0
      configdialog/kbfxconfigdlgthemes.ui.h
  59. +719
    -0
      configdialog/kbfxconfigdlgtooltip.ui
  60. +86
    -0
      configdialog/kbfxconfigdlgtooltip.ui.h
  61. +603
    -0
      configdialog/kbfxthemeinfo.ui
  62. +19
    -0
      configdialog/kbfxthemeinfo.ui.h
  63. +163
    -0
      configdialog/main.cpp
  64. +20
    -0
      configdialog/x-kbfxtheme.desktop
  65. +26
    -0
      doc/AUTHORS
  66. +17
    -0
      doc/CMakeLists.txt
  67. +346
    -0
      doc/COPYING
  68. +11
    -0
      doc/CREDITS
  69. +123
    -0
      doc/ChangeLog
  70. +21
    -0
      doc/HACKING
  71. +411
    -0
      doc/HOWTO
  72. +203
    -0
      doc/INSTALL
  73. +1
    -0
      doc/KNOWN_BUGS
  74. +351
    -0
      doc/LICENSE
  75. +37
    -0
      doc/NEWS
  76. +44
    -0
      doc/README
  77. +62
    -0
      doc/TODO
  78. +5
    -0
      doc/common/CMakeLists.txt
  79. BIN
      doc/common/kbfx-about.jpg
  80. BIN
      doc/common/kbfx-fonts.jpg
  81. BIN
      doc/common/kbfx-layout.jpg
  82. BIN
      doc/common/kbfx-maindescription.jpg
  83. BIN
      doc/common/kbfx-plugins.jpg
  84. BIN
      doc/common/kbfx-startbutton.jpg
  85. BIN
      doc/common/kbfx-style.jpg
  86. BIN
      doc/common/kbfx-themes.jpg
  87. BIN
      doc/common/kbfx-tooltip.jpg
  88. +2
    -0
      doc/en/CMakeLists.txt
  89. +2456
    -0
      doc/en/index.docbook.in
  90. +5
    -0
      images/CMakeLists.txt
  91. BIN
      images/hi128-app-kbfx.png
  92. BIN
      images/hi16-app-kbfxconfigapp.png
  93. BIN
      images/hi32-app-kbfxconfigapp.png
  94. +31
    -0
      kbfx-0.4.9.3.1.ebuild
  95. +27
    -0
      kbfx-9999.ebuild
  96. +27
    -0
      kbfx-svn.ebuild.in
  97. +31
    -0
      kbfx.ebuild.in
  98. +255
    -0
      kbfx.spec
  99. +255
    -0
      kbfx.spec.in
  100. +0
    -0
      kbfxlib/common/CMakeLists.txt

+ 274
- 0
CMakeLists.txt View File

@@ -0,0 +1,274 @@
PROJECT(kbfx)

CMAKE_MINIMUM_REQUIRED(VERSION 2.4.2 FATAL_ERROR)
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmakemodules)
SET(CMAKE_COLOR_MAKEFILE ON CACHE STRING "Enable/Disable color output during build." FORCE)
#SET(CMAKE_VERBOSE_MAKEFILE OFF CACHE STRING "Enable/Disable cmake debug output during build." FORCE)

# Optimization flags
# SET(CMAKE_CXX_FLAGS_DISTRIBUTION "-O3")
# SET(CMAKE_C_FLAGS_DISTRIBUTION "-O3")

# Global variable CMAKE_BUILD_TYPE
# None (CMAKE_C_FLAGS or CMAKE_CXX_FLAGS used)
# Debug (CMAKE_C_FLAGS_DEBUG or CMAKE_CXX_FLAGS_DEBUG)
# Release (CMAKE_C_FLAGS_RELEASE or CMAKE_CXX_FLAGS_RELEASE)
# RelWithDebInfo (CMAKE_C_FLAGS_RELWITHDEBINFO or CMAKE_CXX_FLAGS_RELWITHDEBINFO
# MinSizeRel (CMAKE_C_FLAGS_MINSIZEREL or CMAKE_CXX_FLAGS_MINSIZEREL)
IF (NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE RelWithDebInfo
CACHE
STRING "Specify build type: None Debug Release RelWithDebInfo MinSizeRel."
FORCE)
ENDIF (NOT CMAKE_BUILD_TYPE)

OPTION(USE_STRIGI "Enable use of Strigi search support (disabled)" OFF)
OPTION(USE_MENUDRAKE "Use 'menudrake' instead of 'kmenuedit' in Mandriva (auto)" ON)
OPTION(USE_KDE4 "Compile for KDE4 (disabled)" OFF)

SET(BIN_SEARCH_PATHES
$ENV{HOME}/bin
$ENV{HOME}/usr/bin
$ENV{KDEDIR}/bin
${CMAKE_INSTALL_PREFIX}/bin
/opt/kde/bin
/opt/kde3/bin
/opt/kde4/bin
/usr/kde/3.5/bin
/usr/bin
/usr/local/bin
/opt/bin
)
SET(INCLUDE_SEARCH_PATHES
$ENV{HOME}/include
$ENV{HOME}/usr/include
$ENV{KDEDIR}/include
/opt/kde/include
/opt/kde3/include
/opt/kde4/include
/usr/kde/3.5/include
/usr/include
/usr/local/include
/opt/include
${CMAKE_SYSTEM_INCLUDE_PATH}
)
SET(LIB_SEARCH_PATHES
$ENV{HOME}/lib
$ENV{HOME}/usr/lib
$ENV{KDEDIR}/lib
/opt/kde/lib
/opt/kde3/lib
/opt/kde4/lib
/usr/kde/3.5/lib
/usr/lib
/usr/local/lib
/opt/lib
)

# Setting versions

# For versions that are stable set to 1, else to 0
SET(APPLICATION_STABLE 1)

SET(LIB_MAJOR 4)
SET(LIB_MINOR 9)
SET(LIB_RELEASE 3)
SET(LIB_SUB_RELEASE 1)
SET(APPLICATION_INTERNAL_VERSION "20070516")
SET(APPLICATION_DATE "2007-05-16")

SET(APPLICATION_NAME "${PROJECT_NAME}")
SET(APPLICATION_MAIN_VERSION "0.${LIB_MAJOR}.${LIB_MINOR}.${LIB_RELEASE}")

IF (APPLICATION_STABLE)
SET(APPLICATION_STABLE_RELEASE ".${LIB_SUB_RELEASE}")
SET(APPLICATION_VERSION "${APPLICATION_MAIN_VERSION}.${LIB_SUB_RELEASE}")
SET(GENTOO_VERSION "${APPLICATION_MAIN_VERSION}.${LIB_SUB_RELEASE}")
ELSE (APPLICATION_APPLICATION_STABLE "")
SET(STABLE_RELEASE)
SET(APPLICATION_VERSION "${APPLICATION_MAIN_VERSION}-${LIB_SUB_RELEASE}")
SET(GENTOO_VERSION "${APPLICATION_MAIN_VERSION}_pre${LIB_SUB_RELEASE}")
ENDIF (APPLICATION_STABLE)

SET(VERSION ${APPLICATION_VERSION})

SET(STRIGI_VERSION "0.3.11")
SET(GENTOO_KEYWORDS "x86 ~ppc ~amd64")

# Prepare docbook part
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/doc/en/index.docbook.in ${CMAKE_BINARY_DIR}/doc/en/index.docbook @ONLY)

IF (USE_STRIGI)
FIND_PACKAGE(Strigi REQUIRED)
INCLUDE_DIRECTORIES(${STRIGI_INCLUDE_DIR})
MESSAGE(STATUS "Strigi support is: ON!")
ELSE (USE_STRIGI)
MESSAGE(STATUS "Strigi support is: OFF!")
ENDIF (USE_STRIGI)


FIND_PROGRAM(HAVE_MANDRAKE menudrake)
IF (HAVE_MANDRAKE AND USE_MENUDRAKE)
SET(MANDRAKE "1")
MESSAGE(STATUS "Will use 'menudrake' instead of 'kmenuedit'!")
ELSE (HAVE_MANDRAKE AND USE_MENUDRAKE)
SET(MANDRAKE "")
MESSAGE(STATUS "Will use 'kmenuedit'!")
ENDIF (HAVE_MANDRAKE AND USE_MENUDRAKE)

IF (NOT USE_KDE4)
MESSAGE(STATUS "Building for KDE3")
INCLUDE(TestCXXAcceptsFlag)

SET(CMAKE_CXX_FLAGS_DEBUG
"${CMAKE_CXX_FLAGS_DEBUG} -DTESTING_RC=\"\\\"\${CMAKE_SOURCE_DIR}/configdialog/kbfxconfigappui.rc\\\"\"")

CHECK_CXX_ACCEPTS_FLAG("-fexceptions" CXX_EXCEPTION)
CHECK_CXX_ACCEPTS_FLAG("-fstack-protector" CXX_PROTECTOR)

FIND_PACKAGE(KDE3 REQUIRED)

INCLUDE(FindKdeLibs)
INCLUDE(MacroEnsureVersion)

# Dummy macros for compatibility
MACRO(KDE4_AUTOMOC _dummy)
ENDMACRO(KDE4_AUTOMOC)

MACRO(KDE4_ADD_LIBRARY _dummy _dummy1 _dummy2)
ENDMACRO(KDE4_ADD_LIBRARY)

MACRO(KDE4_INSTALL_LIBTOOL_FILE _dummy _dummy1)
ENDMACRO(KDE4_INSTALL_LIBTOOL_FILE)

MACRO(KDE4_ADD_UI3_FILES _dummy _dummy1)
ENDMACRO(KDE4_ADD_UI3_FILES)

MACRO(KDE4_ADD_DCOP_SKELS _dummy _dummy1)
ENDMACRO(KDE4_ADD_DCOP_SKELS)

MACRO(KDE4_ADD_EXECUTABLE _dummy _dummy1)
ENDMACRO(KDE4_ADD_EXECUTABLE)

MACRO(KDE4_INSTALL_ICONS _dummy)
ENDMACRO(KDE4_INSTALL_ICONS)
ELSE (NOT USE_KDE4)
MESSAGE(STATUS "Building for KDE4")
FIND_PACKAGE(KDE4 REQUIRED)
ADD_DEFINITIONS(${KDE4_DEFINITIONS} ${QT_DEFINITIONS})
SET(INCLUDE_SEARCH_PATHES
${INCLUDE_SEARCH_PATHES}
${KDE4_INCLUDES}
)
SET(LIB_SEARCH_PATHES
${LIB_SEARCH_PATHES}
${KDE4_LIB_DIR}
)
ENDIF (NOT USE_KDE4)

INCLUDE_DIRECTORIES(
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}/kbfxlib/data
${CMAKE_BINARY_DIR}/kbfxlib/common
${CMAKE_BINARY_DIR}/src
${CMAKE_BINARY_DIR}/configdialog
${CMAKE_BINARY_DIR}/plugins/common
${CMAKE_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/kbfxlib/data
${CMAKE_SOURCE_DIR}/kbfxlib/common
${CMAKE_SOURCE_DIR}/src
${CMAKE_SOURCE_DIR}/configdialog
${CMAKE_SOURCE_DIR}/plugins/common
${KDE3_INCLUDE_DIR}/kbfx
${KDE3_INCLUDE_DIR}/kbfx/plugins
${INCLUDE_SEARCH_PATHES}
)

IF (NOT USE_KDE4)
IF (CXX_EXCEPTION)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions")
ENDIF (CXX_EXCEPTION)
IF (CXX_PROTECTOR)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector")
ENDIF (CXX_PROTECTOR)

ADD_DEFINITIONS(${KDE3_DEFINITIONS} ${QT_DEFINITIONS})
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)

IF(KDE3_KDECONFIG_EXECUTABLE)
EXECUTE_PROCESS(COMMAND ${KDE3_KDECONFIG_EXECUTABLE} "--version" OUTPUT_VARIABLE output)
STRING(REGEX MATCH "KDE: [0-9]+\\.[0-9]+\\.[0-9]+" KDEVERSION "${output}")
STRING(REGEX REPLACE "^KDE: " "" KDEVERSION "${KDEVERSION}")
ENDIF(KDE3_KDECONFIG_EXECUTABLE)
SET(KDE_MIN_VERSION "3.5.0")
MACRO_ENSURE_VERSION(${KDE_MIN_VERSION} ${KDEVERSION} VERSION_OK)
IF(NOT VERSION_OK)
MESSAGE(FATAL_ERROR "You need at least KDE Version of 3.5.0 in order to compile KBFX.\n Please upgrade your KDE or install the development files of KDE.")
ENDIF(NOT VERSION_OK)
ENDIF (NOT USE_KDE4)

SET(KBFX_LIB_INSTALL_DIR ${LIB_INSTALL_DIR})

ADD_SUBDIRECTORY(kbfxlib/data)
ADD_SUBDIRECTORY(kbfxlib/common)
ADD_SUBDIRECTORY(src)
ADD_SUBDIRECTORY(configdialog)
ADD_SUBDIRECTORY(skin/vector)
ADD_SUBDIRECTORY(skin/raster/default)
ADD_SUBDIRECTORY(skin/raster/2panels)
ADD_SUBDIRECTORY(images)
ADD_SUBDIRECTORY(doc)
ADD_SUBDIRECTORY(doc/en)
ADD_SUBDIRECTORY(doc/common)
ADD_SUBDIRECTORY(po)
ADD_SUBDIRECTORY(plugins/common)
ADD_SUBDIRECTORY(plugins/applications)
ADD_SUBDIRECTORY(plugins/settings)
ADD_SUBDIRECTORY(plugins/plasmoids)
ADD_SUBDIRECTORY(plugins/recentstuff)
IF (USE_STRIGI)
ADD_SUBDIRECTORY(plugins/strigi)
ENDIF (USE_STRIGI)

CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/config.h.in ${CMAKE_BINARY_DIR}/config.h @ONLY)
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/kbfx.spec.in ${CMAKE_BINARY_DIR}/kbfx.spec @ONLY)
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/kbfx.ebuild.in ${CMAKE_BINARY_DIR}/kbfx-${GENTOO_VERSION}.ebuild @ONLY)
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/strigi.ebuild.in ${CMAKE_BINARY_DIR}/strigi-${STRIGI_VERSION}.ebuild @ONLY)
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/kbfx-svn.ebuild.in ${CMAKE_BINARY_DIR}/kbfx-9999.ebuild @ONLY)

SET(DIST_INCLUDE "kbfx-9999.ebuild kbfx.spec kbfx-${GENTOO_VERSION}.ebuild strigi-${STRIGI_VERSION}.ebuild")
SET(DIST_EXCLUDE "Helperstuff")
CONFIGURE_FILE(
"${CMAKE_CURRENT_SOURCE_DIR}/cmakemodules/makedist.sh.in"
"${CMAKE_CURRENT_BINARY_DIR}/makedist.sh"
IMMEDIATE
@ONLY)
ADD_CUSTOM_TARGET(dist
"${CMAKE_BINARY_DIR}/makedist.sh"
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})

IF (NOT USE_KDE4)
CONFIGURE_FILE(
"${CMAKE_CURRENT_SOURCE_DIR}/cmakemodules/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
ADD_CUSTOM_TARGET(uninstall
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
ENDIF (NOT USE_KDE4)


FILE(GLOB _POFILES po/*.po)
FOREACH(_p ${_POFILES})
SET(POFILES "${_p} ${POFILES}")
ENDFOREACH(_p)

SET(MESSAGES_DIR ${CMAKE_SOURCE_DIR})
CONFIGURE_FILE(
"${CMAKE_CURRENT_SOURCE_DIR}/cmakemodules/package_messages.sh.in"
"${CMAKE_CURRENT_BINARY_DIR}/package_messages.sh"
IMMEDIATE
@ONLY)
ADD_CUSTOM_TARGET(package-messages
"${CMAKE_CURRENT_BINARY_DIR}/package_messages.sh")


+ 246
- 0
build.sh View File

@@ -0,0 +1,246 @@
#! /bin/sh

CMAKE_OPT_PREFIX_KDE3="-DCMAKE_INSTALL_PREFIX:PATH=`kde-config --prefix 2>/dev/null` "
CMAKE_OPT_PREFIX_KDE4="-DCMAKE_INSTALL_PREFIX:PATH=`kde4-config --prefix 2>/dev/null` "
CMAKE_OPT_PREFIX=""
MAKE_VERBOSE=""
USE_STRIGI_SEARCH=""
MENUDRAKE=""
KDE4=""
ACTION="install"
NOCHECK=0
build_state="touch kbfx_build"
command_line_args=$@
eval "which kbfxconfigapp > /dev/null 2>&1" && kbfx_installed="1" || kbfx_installed="0"

color_ok="\\033[1;32m"
color_error="\\033[1;31m"
color_normal="\\033[0;39m"
color_warn="\\033[1;33m"


prog_action(){
echo
echo -e "$color_ok $@ $color_normal"
}

prog_err(){
echo
echo -e "$color_error ERROR doing $@ $color_normal\n"
}

confirm() {
printf "$color_warn %s (Y)es/(N)o? [%s]$color_normal " "$1" "$2"
unset user_input
answer="$2"
read user_input
if [ "$user_input" = "y" -o "$user_input" = "Y" -o "$user_input" = "YES" -o "$user_input" = "Yes" -o "$user_input" = "yes" ]; then
answer="Y"
fi
if [ "$user_input" = "n" -o "$user_input" = "N" -o "" = "NO" -o "$user_input" = "No" -o "$user_input" = "no" ]; then
answer="N"
fi
}

parse_command_line() {
if [ "$#" -eq 0 ]; then
return 0
fi
while [ "$1" != "${1##-}" ]; do
case $1 in
--verbose|-v)
MAKE_VERBOSE="VERBOSE=1"
shift 1
;;
--prefix|-p)
if [ -n "$2" -a "$2" = "${2##-}" ]; then
t=0
stop=0
s=""
for p in $@
do
t=$[t+1]
if [ $t -gt 1 -a "$p" = "${p##-}" -a $stop -eq 0 ]; then
s="$s$p "
fi
if [ $t -gt 1 -a "$p" != "${p##-}" ]; then
stop=$[t-1]
fi
done
if [ $stop -eq 0 ]; then
stop=$[t-1]
fi
if [ -n "$s" ]; then
s=${s%%[ ]}
CMAKE_OPT_PREFIX="-DCMAKE_INSTALL_PREFIX:PATH='$s' "
fi
shift $stop
else
shift 1
return 1
fi
;;
--strigi|-s)
USE_STRIGI_SEARCH="-DUSE_STRIGI:BOOL=TRUE"
shift 1
;;
--menudrake-off|-m)
MENUDRAKE="-DUSE_MENUDRAKE:BOOL=FALSE"
shift 1
;;
--kde4|-k)
KDE4="-DUSE_KDE4:BOOL=TRUE"
shift 1
;;
--uninstall|-u)
ACTION="uninstall"
shift 1
;;
--nocheck|-n)
NOCHECK=1
shift 1
;;
*)
if [ "$#" -ge 1 ]; then
return 1
fi
return 0
;;
esac
done
}

show_usage(){
echo
echo -e "$color_warn Usage: \n\t build.sh \t [(-v|--verbose) Be verbose when compiling (default: no)] \n\t\t\t [(-u|--uninstall) Uninstall KBFX (default: no)] \n\t\t\t [(-p|--prefix) Install prefix (default: KDE prefix)] \n\t\t\t [(-s|--strigi) Compile strigi search plugin (default: no)] \n\t\t\t [(-m|-menudrake-off) Don't use menudrake in Mandriva (default: auto)] \n\t\t\t [(-k|--kde4) Compile for KDE4 (default: no)] \n\t\t\t [(-n|--nocheck) Do not check for old KBFX versions (default: check)] $color_normal"
echo
}

parse_command_line $command_line_args
if [ "$?" -eq 1 ]; then
prog_err "build.sh"
show_usage
exit 1
fi

show_usage

if [ "$ACTION" = "install" ]
then {
if [ $kbfx_installed -eq 1 -a $NOCHECK -eq 0 ] ; then
echo
echo -e "$color_error \n\t You have KBFX installed in your \$PATH!\n\t In order to compile the new version you HAVE TO REMOVE the old KBFX first!\n $color_normal"
exit 1
fi

if [ -d build ] ; then
echo
echo -e "$color_warn Directory 'build' exists! Using it...$color_normal"
echo -e "$color_error If 'build.sh' fails, try removing the directory 'build' and run 'build.sh' again! $color_normal"
else
mkdir build
fi
cd build

if [ "$CMAKE_OPT_PREFIX" = "" ]
then {
if [ "$KDE4" = "" ]
then {
CMAKE_OPT_PREFIX=$CMAKE_OPT_PREFIX_KDE3
}
else {
CMAKE_OPT_PREFIX=$CMAKE_OPT_PREFIX_KDE4
}
fi
}
fi

CMAKE_OPT="$CMAKE_OPT_PREFIX $KDE4 $MENUDRAKE $USE_STRIGI_SEARCH"

prog_action "Doing CMake configure..."
echo $CMAKE_OPT
eval "cmake ../ $CMAKE_OPT"
if [ $? -ne 0 ]; then
prog_err "CMake configure..."
exit 1
fi

prog_action "Doing make..."
make $MAKE_VERBOSE
if [ $? -ne 0 ]; then
prog_err "make..."
exit 1
fi

eval $build_state
prog_action "Success building KBFX...\n"

confirm "Do you want to install KBFX?" "Y"
if [ "$answer" = "Y" ]
then
sucommand="make install"
after_su="touch kbfx_install_user"
if [ `whoami` != 'root' ]
then {
confirm "To install KBFX as 'root', answer 'Yes'. To install as '`whoami`', answer 'No'" "N"
if [ "$answer" = "Y" ]
then {
sucommand="su root -c 'make install'"
after_su="touch kbfx_install_root"
}
fi
}
fi

prog_action "Doing 'make install'..."
eval $sucommand
if [ $? -ne 0 ]; then
prog_err "make install..."
exit 1
fi
eval $after_su
echo
echo -e "$color_warn NOTE: If you have used a custom prefix for your install (-p or --prefix option for script), \n you should add '$s' to your \$KDEDIRS environment variable\n and '$s/lib' to your \$LD_LIBRARY_PATH environment variable!\n $color_normal"
fi
}
else {
if [ -d build ]
then
cd build
else
echo
echo -e "$color_error \n\t Directory 'build' DOES NOT exist!\n\t You HAVE NOT used 'build.sh' script for installing KBFX! \n\t Uninstall CAN NOT continue!\n $color_normal"
exit 1
fi

if [ -f kbfx_install_user ]
then
sucommand="make uninstall"
after_su="rm -f kbfx_install_user"
elif [ -f kbfx_install_root ]
then
sucommand="su root -c 'make uninstall'"
after_su="rm -f kbfx_install_root"
elif [ -f kbfx_build ]
then
echo
echo -e "$color_error \n\t KBFX IS NOT installed! \n\t Uninstall CAN NOT continue!\n $color_normal"
exit 1
else
echo
echo -e "$color_error \n\t You HAVE NOT used 'build.sh' script for installing KBFX! \n\t Uninstall CAN NOT continue!\n $color_normal"
exit 1
fi

prog_action "Uninstalling..."
eval $sucommand
if [ $? -ne 0 ]; then
prog_err "uninstall..."
exit 1
fi
eval $after_su

}
fi

prog_action "All actions ended successfully...\n"

+ 22
- 0
cmakemodules/COPYING-CMAKE-SCRIPTS View File

@@ -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.

+ 21
- 0
cmakemodules/CheckCXXCompilerFlag.cmake View File

@@ -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)


+ 49
- 0
cmakemodules/FindGNUWIN32.cmake View File

@@ -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)


+ 32
- 0
cmakemodules/FindKBFX.cmake View File

@@ -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)


+ 40
- 0
cmakemodules/FindKDE4.cmake View File

@@ -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)


+ 839
- 0
cmakemodules/FindKDE4Internal.cmake View File

@@ -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)

+ 89
- 0
cmakemodules/FindKDEWIN32.cmake View File

@@ -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)

+ 316
- 0
cmakemodules/FindKdeLibs.cmake View File

@@ -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 )


+ 1081
- 0
cmakemodules/FindQt4.cmake
File diff suppressed because it is too large
View File


+ 47
- 0
cmakemodules/FindStrigi.cmake View File

@@ -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)


+ 352
- 0
cmakemodules/FindX11.cmake View File

@@ -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})