aboutsummaryrefslogtreecommitdiff
path: root/modules/FindKDE4Internal.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'modules/FindKDE4Internal.cmake')
-rw-r--r--modules/FindKDE4Internal.cmake237
1 files changed, 89 insertions, 148 deletions
diff --git a/modules/FindKDE4Internal.cmake b/modules/FindKDE4Internal.cmake
index 5ca46f96..a5451d13 100644
--- a/modules/FindKDE4Internal.cmake
+++ b/modules/FindKDE4Internal.cmake
@@ -217,15 +217,12 @@
# It's also important to note that gcc cannot detect all warning conditions
# unless the optimiser is active.
#
-# This module allows to depend on a particular minimum version of kdelibs.
-# To acomplish that one should use the apropriate cmake syntax for
-# find_package. For example to depend on kdelibs >= 4.1.0 one should use
+# You can set the variable KDE_MIN_VERSION before calling find_package()
+# to depend on a particular kdelibs version. For example to depend on
+# KDE 4.1.0 you can use
#
-# find_package(KDE4 4.1.0 REQUIRED)
-#
-# In earlier versions of KDE you could use the variable KDE_MIN_VERSION to
-# have such a dependency. This variable is deprecated with KDE 4.2.0, but
-# will still work to make the module backwards-compatible.
+# set(KDE_MIN_VERSION "4.1.0")
+# find_package(KDE4 REQUIRED)
# _KDE4_PLATFORM_INCLUDE_DIRS is used only internally
# _KDE4_PLATFORM_DEFINITIONS is used only internally
@@ -238,23 +235,26 @@
# this is required now by cmake 2.6 and so must not be skipped by if(KDE4_FOUND) below
-cmake_minimum_required(VERSION 2.6.0 FATAL_ERROR)
-# this second call will never fail
-# it is here for the effect that it sets the cmake policies to the 2.4.x compatibility settings for now
-cmake_minimum_required(VERSION 2.4.5)
+cmake_minimum_required(VERSION 2.4.5 FATAL_ERROR)
+
+# cmake 2.5, i.e. the cvs version between 2.4 and 2.6, is not supported
+if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" STREQUAL "2.5")
+ message(FATAL_ERROR "You are using CMake 2.5, which was the unreleased development version between 2.4 and 2.6. This is no longer supported. Please update to CMake 2.6 or current cvs HEAD.")
+endif("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" STREQUAL "2.5")
# CMake 2.6, set compatibility behaviour to cmake 2.4
# this must be executed always, because the CMAKE_MINIMUM_REQUIRED() command above
# resets the policy settings, so we get a lot of warnings
-
-# CMP0000: don't require cmake_minimum_version() directly in the top level CMakeLists.txt, FindKDE4Internal.cmake is good enough
-cmake_policy(SET CMP0000 OLD)
-# CMP0002: in KDE4 we have multiple targets with the same name for the unit tests
-cmake_policy(SET CMP0002 OLD)
-# CMP0003: add the link paths to the link command as with cmake 2.4
-cmake_policy(SET CMP0003 OLD)
-# CMP0005: keep escaping behaviour for definitions added via add_definitions()
-cmake_policy(SET CMP0005 OLD)
+if(COMMAND CMAKE_POLICY)
+ # CMP0000: don't require cmake_minimum_version() directly in the top level CMakeLists.txt, FindKDE4Internal.cmake is good enough
+ cmake_policy(SET CMP0000 OLD)
+ # CMP0002: in KDE4 we have multiple targets with the same name for the unit tests
+ cmake_policy(SET CMP0002 OLD)
+ # CMP0003: add the link paths to the link command as with cmake 2.4
+ cmake_policy(SET CMP0003 OLD)
+ # CMP0005: keep escaping behaviour for definitions added via add_definitions()
+ cmake_policy(SET CMP0005 OLD)
+endif(COMMAND CMAKE_POLICY)
# Only do something if it hasn't been found yet
@@ -262,65 +262,30 @@ if(NOT KDE4_FOUND)
include (MacroEnsureVersion)
-# we may only search for other packages with "REQUIRED" if we are required ourselves
-if(KDE4_FIND_REQUIRED)
- set(_REQ_STRING_KDE4 "REQUIRED")
- set(_REQ_STRING_KDE4_MESSAGE "FATAL_ERROR")
-else(KDE4_FIND_REQUIRED)
- set(_REQ_STRING_KDE4 )
- set(_REQ_STRING_KDE4_MESSAGE "STATUS")
-endif(KDE4_FIND_REQUIRED)
-
set(QT_MIN_VERSION "4.4.0")
#this line includes FindQt4.cmake, which searches the Qt library and headers
-find_package(Qt4 ${_REQ_STRING_KDE4})
+find_package(Qt4 REQUIRED)
# automoc4 (from kdesupport) is now required, Alex
-find_package(Automoc4 ${_REQ_STRING_KDE4})
-
-# cmake 2.6.0 and automoc4 < 0.9.84 don't work right for -D flags
-if (NOT AUTOMOC4_VERSION)
- # the version macro was added for 0.9.84
- set(AUTOMOC4_VERSION "0.9.83")
-endif (NOT AUTOMOC4_VERSION)
-macro_ensure_version("0.9.84" "${AUTOMOC4_VERSION}" _automoc4_version_ok)
-
-# for compatibility with KDE 4.0.x
+find_package(Automoc4 REQUIRED)
+
+if (CMAKE_MAJOR_VERSION GREATER 4)
+ # cmake 2.6.0 and automoc4 0.9.83 didn't add the necessary definitions for backends to moc calls
+ if (NOT AUTOMOC4_VERSION)
+ # the version macro was added for 0.9.84
+ set(AUTOMOC4_VERSION "0.9.83")
+ endif (NOT AUTOMOC4_VERSION)
+ macro_ensure_version("0.9.84" "${AUTOMOC4_VERSION}" _automoc4_version_ok)
+ if (NOT _automoc4_version_ok)
+ message(FATAL_ERROR "Your version of automoc4 is too old. You have ${AUTOMOC4_VERSION}, you need at least 0.9.84")
+ endif (NOT _automoc4_version_ok)
+endif (CMAKE_MAJOR_VERSION GREATER 4)
+
+# use automoc4 from kdesupport
set(KDE4_AUTOMOC_EXECUTABLE "${AUTOMOC4_EXECUTABLE}" )
-# Perl is required for building KDE software
-find_package(Perl ${_REQ_STRING_KDE4})
-
-# Check that we really found everything.
-# If KDE4 was searched with REQUIRED, we error out with FATAL_ERROR if something wasn't found
-# already above in the other FIND_PACKAGE() calls.
-# If KDE4 was searched without REQUIRED and something in the FIND_PACKAGE() calls above wasn't found,
-# then we get here and must check that everything has actually been found. If something is missing,
-# we must not fail with FATAL_ERROR, but only not set KDE4_FOUND.
-if(NOT PERL_FOUND)
- message(STATUS "KDE4 not found, because Perl not found")
- return()
-endif(NOT PERL_FOUND)
-
-if(NOT QT4_FOUND)
- message(STATUS "KDE4 not found, because Qt4 not found")
- return()
-endif(NOT QT4_FOUND)
-
-if(NOT AUTOMOC4_FOUND OR NOT _automoc4_version_ok)
- if(NOT AUTOMOC4_FOUND)
- message(${_REQ_STRING_KDE4_MESSAGE} "KDE4 not found, because Automoc4 not found.")
- return()
- else(NOT AUTOMOC4_FOUND)
- if(NOT _automoc4_version_ok)
- message(${_REQ_STRING_KDE4_MESSAGE} "Your version of automoc4 is too old. You have ${AUTOMOC4_VERSION}, you need at least 0.9.84")
- return()
- endif(NOT _automoc4_version_ok)
- endif(NOT AUTOMOC4_FOUND)
-endif(NOT AUTOMOC4_FOUND OR NOT _automoc4_version_ok)
-
-
-# now we are sure we have everything we need
+# Perl is required for building KDE software,
+find_package(Perl REQUIRED)
include (MacroLibrary)
include (CheckCXXCompilerFlag)
@@ -399,25 +364,7 @@ else (_kdeBootStrapping)
# we need at least this version:
if (NOT KDE_MIN_VERSION)
- if (KDE4_FIND_VERSION_MAJOR)
- message("${KDE4_FIND_VERSION_MAJOR}")
- if (${KDE4_FIND_VERSION_MAJOR} EQUAL 4)
- if (KDE4_FIND_VERSION_MINOR)
- set(KDE_MIN_VERSION "4.${KDE4_FIND_VERSION_MINOR}")
- else (KDE4_FIND_VERSION_MINOR)
- set(KDE_MIN_VERSION "4.0")
- endif (KDE4_FIND_VERSION_MINOR)
- if (KDE4_FIND_VERSION_PATCH)
- set(KDE_MIN_VERSION "${KDE_MIN_VERSION}.${KDE4_FIND_VERSION_PATCH}")
- else (KDE4_FIND_VERSION_PATCH)
- set(KDE_MIN_VERSION "${KDE_MIN_VERSION}.0")
- endif (KDE4_FIND_VERSION_PATCH)
- else (${KDE4_FIND_VERSION_MAJOR} EQUAL 4)
- message(FATAL_ERROR "FindKDE4 can only be used with KDE 4")
- endif (${KDE4_FIND_VERSION_MAJOR} EQUAL 4)
- else (KDE4_FIND_VERSION_MAJOR)
- set (KDE_MIN_VERSION "4.0.0")
- endif (KDE4_FIND_VERSION_MAJOR)
+ set(KDE_MIN_VERSION "3.9.0")
endif (NOT KDE_MIN_VERSION)
#message(STATUS "KDE_MIN_VERSION=${KDE_MIN_VERSION} found ${KDEVERSION}")
@@ -566,39 +513,25 @@ option(KDE4_ENABLE_FINAL "Enable final all-in-one compilation")
option(KDE4_BUILD_TESTS "Build the tests")
option(KDE4_ENABLE_HTMLHANDBOOK "Create targets htmlhandbook for creating the html versions of the docbook docs")
-# Remove this below once it's sure it really works, Alex
-
-# # This option enables the reduced link interface for libs on UNIX
-# #
-# # The purpose of the KDE4_DISABLE_PROPERTY_ variable is to be used as a prefix for
-# # the target property LINK_INTERFACE_LIBRARIES. If it is empty, the property will have its
-# # correct name, if it's not empty, it will be a different name, i.e. the actual property
-# # will not be set, i.e. disabled. See kdelibs/kdecore/CMakeLists.txt for an example.
-# #
-# # By default (i.e. also for Windows) make it non-empty, so the property name will
-# # change from "LINK_INTERFACE_LIBRARIES" to "DISABLED_LINK_INTERFACE_LIBRARIES",
-# # which is a different (non-existing) target property, and so setting that property
-# # won't have an effect
-
-# disable this for now for Windows, since there is an issue with the use of "debug" and
-# "optimized" in the LINK_INTERFACE_LIBRARIES target property, Alex
-
-# disable the reduced linking temporarily for Windows, cmake HEAD and the soon-to-be-released cmake 2.6.2
-# With 2.6.0 and 2.6.1 it can happen that the "debug", "optimized" and "general" keywords are
-# misinterpreted by cmake as library names, the linking fails. Usually this happens under Windows.
-# In 2.6.2 this will be an error at cmake time, so we disable it for now and once we require
-# 2.6.2 we'll fix it the right way (using TARGET_LINK_LIBRARIES(foo LINK_INTERFACE_LIBRARIES ...)
-if (WIN32 OR "${CMAKE_MINOR_VERSION}" EQUAL 7 OR "${CMAKE_PATCH_VERSION}" EQUAL 2)
- set(KDE4_DISABLE_PROPERTY_ "DISABLED_")
-endif (WIN32 OR "${CMAKE_MINOR_VERSION}" EQUAL 7 OR "${CMAKE_PATCH_VERSION}" EQUAL 2)
-#endif(WIN32)
-
-# option(KDE4_ENABLE_EXPERIMENTAL_LIB_EXPORT "Enable the experimental reduced library exports" FALSE)
-# # If enabled, make it empty, so the property will keep it's actual name.
-# # and the LINK_INTERFACE_LIBRARIES property will be set.
-# if (KDE4_ENABLE_EXPERIMENTAL_LIB_EXPORT)
-# set(KDE4_DISABLE_PROPERTY_ )
-# endif (KDE4_ENABLE_EXPERIMENTAL_LIB_EXPORT)
+# This option enables the reduced link interface for libs on UNIX
+#
+# The purpose of the KDE4_DISABLE_PROPERTY_ variable is to be used as a prefix for
+# the target property LINK_INTERFACE_LIBRARIES. If it is empty, the property will have its
+# correct name, if it's not empty, it will be a different name, i.e. the actual property
+# will not be set, i.e. disabled. See kdelibs/kdecore/CMakeLists.txt for an example.
+#
+# By default (i.e. also for Windows) make it non-empty, so the property name will
+# change from "LINK_INTERFACE_LIBRARIES" to "DISABLED_LINK_INTERFACE_LIBRARIES",
+# which is a different (non-existing) target property, and so setting that property
+# won't have an effect
+set(KDE4_DISABLE_PROPERTY_ "DISABLED_")
+
+option(KDE4_ENABLE_EXPERIMENTAL_LIB_EXPORT "Enable the experimental reduced library exports" FALSE)
+# If enabled, make it empty, so the property will keep it's actual name.
+# and the LINK_INTERFACE_LIBRARIES property will be set.
+if (KDE4_ENABLE_EXPERIMENTAL_LIB_EXPORT)
+ set(KDE4_DISABLE_PROPERTY_ )
+endif (KDE4_ENABLE_EXPERIMENTAL_LIB_EXPORT)
if( KDE4_ENABLE_FINAL)
@@ -611,19 +544,7 @@ endif(KDE4_ENABLE_FINAL)
# info from "http://www.linuxfromscratch.org/hlfs/view/unstable/glibc/chapter02/pie.html"
option(KDE4_ENABLE_FPIE "Enable platform supports PIE linking")
-# If we are building ! kdelibs, check where kdelibs are installed.
-# If they are installed in a directory which contains "lib64", we default to "64" for LIB_SUFFIX,
-# so the current project will by default also go into lib64.
-# The same for lib32. Alex
-set(_Init_LIB_SUFFIX "")
-if ("${KDE4_LIB_DIR}" MATCHES lib64)
- set(_Init_LIB_SUFFIX 64)
-endif ("${KDE4_LIB_DIR}" MATCHES lib64)
-if ("${KDE4_LIB_DIR}" MATCHES lib32)
- set(_Init_LIB_SUFFIX 32)
-endif ("${KDE4_LIB_DIR}" MATCHES lib32)
-
-set(LIB_SUFFIX "${_Init_LIB_SUFFIX}" CACHE STRING "Define suffix of directory name (32/64)" )
+set(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" )
########## the following are directories where stuff will be installed to ###########
@@ -773,24 +694,40 @@ set(INSTALL_TARGETS_DEFAULT_ARGS RUNTIME DESTINATION "${BIN_INSTALL_DIR}"
# on the Mac support an extra install directory for application bundles starting with cmake 2.6
if(APPLE)
- set(INSTALL_TARGETS_DEFAULT_ARGS ${INSTALL_TARGETS_DEFAULT_ARGS}
- BUNDLE DESTINATION "${BUNDLE_INSTALL_DIR}" )
+ if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER "2.5")
+ set(INSTALL_TARGETS_DEFAULT_ARGS ${INSTALL_TARGETS_DEFAULT_ARGS}
+ BUNDLE DESTINATION "${BUNDLE_INSTALL_DIR}" )
+ endif("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER "2.5")
endif(APPLE)
############## add some more default search paths ###############
#
+# always search in the directory where cmake is installed
+# and in the current installation prefix
# the KDE4_xxx_INSTALL_DIR variables are empty when building kdelibs itself
# and otherwise point to the kde4 install dirs
+# they will be set by default starting with cmake 2.6.0, maybe already 2.4.8
+
+# also add the install directory of the running cmake to the search directories
+# CMAKE_ROOT is CMAKE_INSTALL_PREFIX/share/cmake, so we need to go two levels up
+get_filename_component(_CMAKE_INSTALL_DIR "${CMAKE_ROOT}" PATH)
+get_filename_component(_CMAKE_INSTALL_DIR "${_CMAKE_INSTALL_DIR}" PATH)
set(CMAKE_SYSTEM_INCLUDE_PATH ${CMAKE_SYSTEM_INCLUDE_PATH}
- "${KDE4_INCLUDE_INSTALL_DIR}")
+ "${KDE4_INCLUDE_INSTALL_DIR}"
+ "${_CMAKE_INSTALL_DIR}/include"
+ "${CMAKE_INSTALL_PREFIX}/include" )
set(CMAKE_SYSTEM_PROGRAM_PATH ${CMAKE_SYSTEM_PROGRAM_PATH}
- "${KDE4_BIN_INSTALL_DIR}" )
+ "${KDE4_BIN_INSTALL_DIR}"
+ "${_CMAKE_INSTALL_DIR}/bin"
+ "${CMAKE_INSTALL_PREFIX}/bin" )
set(CMAKE_SYSTEM_LIBRARY_PATH ${CMAKE_SYSTEM_LIBRARY_PATH}
- "${KDE4_LIB_INSTALL_DIR}" )
+ "${KDE4_LIB_INSTALL_DIR}"
+ "${_CMAKE_INSTALL_DIR}/lib"
+ "${CMAKE_INSTALL_PREFIX}/lib" )
# under Windows dlls may be also installed in bin/
if(WIN32)
@@ -1016,7 +953,9 @@ endif(MSVC)
if (CMAKE_COMPILER_IS_GNUCXX)
- set (CMAKE_CONFIGURATION_TYPES ${CMAKE_CONFIGURATION_TYPES} "Debugfull")
+ if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 2.5)
+ set (CMAKE_CONFIGURATION_TYPES ${CMAKE_CONFIGURATION_TYPES} "Debugfull")
+ endif("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 2.5)
set (KDE4_ENABLE_EXCEPTIONS -fexceptions)
# Select flags.
@@ -1125,7 +1064,9 @@ endif (CMAKE_COMPILER_IS_GNUCXX)
if (CMAKE_C_COMPILER MATCHES "icc")
- set (CMAKE_CONFIGURATION_TYPES ${CMAKE_CONFIGURATION_TYPES} "Debugfull")
+ if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 2.5)
+ set (CMAKE_CONFIGURATION_TYPES ${CMAKE_CONFIGURATION_TYPES} "Debugfull")
+ endif("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 2.5)
set (KDE4_ENABLE_EXCEPTIONS -fexceptions)
# Select flags.
@@ -1170,13 +1111,13 @@ macro (KDE4_PRINT_RESULTS)
# inside kdelibs the include dir and lib dir are internal, not "found"
if (NOT _kdeBootStrapping)
if(KDE4_INCLUDE_DIR)
- message(STATUS "Found KDE 4.2 include dir: ${KDE4_INCLUDE_DIR}")
+ message(STATUS "Found KDE 4.1 include dir: ${KDE4_INCLUDE_DIR}")
else(KDE4_INCLUDE_DIR)
message(STATUS "ERROR: unable to find KDE 4 headers")
endif(KDE4_INCLUDE_DIR)
if(KDE4_LIB_DIR)
- message(STATUS "Found KDE 4.2 library dir: ${KDE4_LIB_DIR}")
+ message(STATUS "Found KDE 4.1 library dir: ${KDE4_LIB_DIR}")
else(KDE4_LIB_DIR)
message(STATUS "ERROR: unable to find KDE 4 core library")
endif(KDE4_LIB_DIR)