summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt345
1 files changed, 97 insertions, 248 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 97c4284..31e405f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,71 +1,47 @@
-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/trinity/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/trinity/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/trinity/lib
- /opt/kde4/lib
- /usr/kde/3.5/lib
- /usr/lib
- /usr/local/lib
- /opt/lib
- )
-
-# Setting versions
+#################################################
+#
+# (C) 2011 Timothy Pearson
+# kb9vqf (AT) pearsoncomputing.net
+#
+# Improvements and feedback are welcome
+#
+# This file is released under GPL >= 2
+#
+#################################################
+
+cmake_minimum_required( VERSION 2.8 )
+
+
+##### general package setup #####################
+
+project( kio-locate )
+
+
+##### include essential cmake modules ###########
+
+include( CheckCXXSourceCompiles )
+include( CheckFunctionExists )
+include( CheckIncludeFileCXX )
+include( CheckLibraryExists )
+include( CheckStructHasMember )
+include( CheckSymbolExists )
+include( CheckTypeSize )
+include( FindPkgConfig )
+
+
+##### include our cmake modules #################
+
+set( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules" )
+include( TDEMacros )
+
+
+##### setup install paths #######################
+
+include( TDESetupPaths )
+tde_setup_paths( )
+
+
+##### set version numbers #######################
# For versions that are stable set to 1, else to 0
SET(APPLICATION_STABLE 1)
@@ -95,194 +71,67 @@ 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)
-
-IF (NOT QT_FOUND)
- MESSAGE("TQt3 not found, assuming TQt4 was desired")
- SET(TQT_INCLUDE_DIR "/usr/include/qt4")
-ELSE ()
- SET(TQT_INCLUDE_DIR "${QT_INCLUDE_DIR}")
-ENDIF ()
-
-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
- ${TQT_INCLUDE_DIR}
- ${KDE3_INCLUDE_DIR}
- ${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})
-
-SET(QT_UIC_EXECUTABLE "/usr/bin/uic-tqt")
-SET(QT_MOC_EXECUTABLE "/usr/bin/tmoc")
-
-SET(CMAKE_CXX_FLAGS "-I/usr/include/tqt -include tqt.h -DTQT_THREAD_SUPPORT")
-
-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)
+
+##### user requested modules ####################
+
+option( BUILD_ALL "Build all" OFF )
+option( BUILD_DOC "Build doc" ${BUILD_ALL} )
+option( BUILD_TRANSLATIONS "Build translations" ${BUILD_ALL} )
+option( USE_STRIGI "Enable use of Strigi search support (disabled)" OFF )
+option( USE_MENUDRAKE "Use 'menudrake' instead of 'kmenuedit' in Mandriva (auto)" ON )
+
+
+##### configure checks ##########################
+
+include( ConfigureChecks.cmake )
+
+
+###### global compiler settings #################
+
+add_definitions(
+ -DHAVE_CONFIG_H
+)
+
+set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TQT_CXX_FLAGS} -DTQT_THREAD_SUPPORT" )
+set( CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined" )
+set( CMAKE_MODULE_LINKER_FLAGS "-Wl,--no-undefined" )
+
+
+##### source directories ########################
+
+add_subdirectory( kbfxlib )
+add_subdirectory( src )
+add_subdirectory( configdialog )
+add_subdirectory( skin )
+add_subdirectory( images )
+add_subdirectory( plugins )
+tde_conditional_add_subdirectory( BUILD_DOC doc )
+tde_conditional_add_subdirectory( BUILD_TRANSLATIONS po )
+tde_conditional_add_subdirectory( USE_STRIGI plugins/strigi )
SET(DIST_INCLUDE "kbfx-9999.ebuild kbfx.spec kbfx-${GENTOO_VERSION}.ebuild strigi-${STRIGI_VERSION}.ebuild")
SET(DIST_EXCLUDE "Helperstuff")
-CONFIGURE_FILE(
+configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmakemodules/makedist.sh.in"
"${CMAKE_CURRENT_BINARY_DIR}/makedist.sh"
IMMEDIATE
@ONLY)
-ADD_CUSTOM_TARGET(dist
+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")
+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")
+
+
+##### write configure files #####################
+configure_file(config.h.in config.h @ONLY)
+configure_file(kbfx.spec.in kbfx.spec @ONLY)
+configure_file(kbfx.ebuild.in kbfx-${GENTOO_VERSION}.ebuild @ONLY)
+configure_file(strigi.ebuild.in strigi-${STRIGI_VERSION}.ebuild @ONLY)
+configure_file(kbfx-svn.ebuild.in kbfx-9999.ebuild @ONLY)