diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/CMakeLists.txt | 1 | ||||
-rw-r--r-- | modules/FindKDE4Internal.cmake | 22 | ||||
-rw-r--r-- | modules/KDE4Macros.cmake | 11 | ||||
-rw-r--r-- | modules/kde4BasicFindPackageVersion.cmake.in | 27 |
4 files changed, 59 insertions, 2 deletions
diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt index b9dea894..35526b69 100644 --- a/modules/CMakeLists.txt +++ b/modules/CMakeLists.txt @@ -9,6 +9,7 @@ install( FILES cmake-modules-styleguide.txt kde4init_win32lib_dummy.cpp.in kde4_cmake_uninstall.cmake.in kde4automoc.files.in + kde4BasicFindPackageVersion.cmake.in FindLibPython.py FindPyKDE4.py FindPyQt.py diff --git a/modules/FindKDE4Internal.cmake b/modules/FindKDE4Internal.cmake index 7a03ca35..386586aa 100644 --- a/modules/FindKDE4Internal.cmake +++ b/modules/FindKDE4Internal.cmake @@ -115,8 +115,11 @@ # 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 +# KDE4_USE_COMMON_CMAKE_PACKAGE_CONFIG_DIR - only present for CMake >= 2.6.3, defaults to TRUE +# If enabled, the package should install its <package>Config.cmake file to +# lib/cmake/<package>/ instead to lib/<package>/cmake # -# It also adds the following macros (from KDE4Macros.cmake) +# It also adds the following macros and functions (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. # @@ -131,6 +134,14 @@ # Use this to add widget description files for the makekdewidgets code generator # for Qt Designer plugins. # +# KDE4_WRITE_BASIC_CMAKE_VERSION_FILE( _filename _major _minor _patch) +# Writes a file for use as <package>Version.cmake file to <_filename>. +# See the documentation of FIND_PACKAGE() for details on this. +# _filename is the output filename, it should be in the build tree. +# _major is the major version number of the project to be installed +# _minor is the minor version number of the project to be installed +# _patch is the patch version number of the project to be installed +# # 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, @@ -591,6 +602,15 @@ 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") +if(${CMAKE_VERSION_MAJOR}.${CMAKE_VERSION_MINOR}.${CMAKE_VERSION_PATCH} VERSION_GREATER 2.6.2) + option(KDE4_USE_COMMON_CMAKE_PACKAGE_CONFIG_DIR + "Prefer to install the <package>Config.cmake files to lib/cmake/<package> instead to lib/<package>/cmake" + TRUE) +else(${CMAKE_VERSION_MAJOR}.${CMAKE_VERSION_MINOR}.${CMAKE_VERSION_PATCH} VERSION_GREATER 2.6.2) + set(KDE4_USE_COMMON_CMAKE_PACKAGE_CONFIG_DIR FALSE) +endif(${CMAKE_VERSION_MAJOR}.${CMAKE_VERSION_MINOR}.${CMAKE_VERSION_PATCH} VERSION_GREATER 2.6.2) + + # This is for the reduced link interface. # In kdelibs it is already alwaysenabled. # In all other modules provide the switch _KDE4_USE_REDUCED_LINK_INTERFACE to turn it on. diff --git a/modules/KDE4Macros.cmake b/modules/KDE4Macros.cmake index be4620a8..37195e87 100644 --- a/modules/KDE4Macros.cmake +++ b/modules/KDE4Macros.cmake @@ -1,6 +1,6 @@ # for documentation look at FindKDE4Internal.cmake -# this file contains the following macros: +# this file contains the following macros (or functions): # KDE4_ADD_UI_FILES # KDE4_ADD_UI3_FILES # KDE4_ADD_KCFG_FILES @@ -21,6 +21,7 @@ # KDE4_CREATE_HANDBOOK # KDE4_ADD_APP_ICON # KDE4_CREATE_MANPAGE +# KDE4_CREATE_BASIC_CMAKE_VERSION_FILE (function) # Copyright (c) 2006, 2007, Alexander Neundorf, <neundorf@kde.org> # Copyright (c) 2006, 2007, Laurent Montel, <montel@kde.org> @@ -1133,6 +1134,14 @@ macro (KDE4_ADD_APP_ICON appsources pattern) endmacro (KDE4_ADD_APP_ICON) +function(KDE4_WRITE_BASIC_CMAKE_VERSION_FILE _filename _major _minor _patch) + set(PROJECT_VERSION_MAJOR ${_major}) + set(PROJECT_VERSION_MINOR ${_minor}) + set(PROJECT_VERSION_PATCH ${_patch}) + configure_file(${KDE4_MODULE_DIR}/kde4BasicFindPackageVersion.cmake.in "${_filename}" @ONLY) +endfunction(KDE4_WRITE_BASIC_CMAKE_VERSION_FILE _major _minor _patch) + + macro(_KDE4_EXPORT_LIBRARY_DEPENDENCIES _append_or_write _filename) message(FATAL_ERROR "_KDE4_EXPORT_LIBRARY_DEPENDENCIES() was an internal macro and has been removed again. Just remove the code which calls it, there is no substitute.") endmacro(_KDE4_EXPORT_LIBRARY_DEPENDENCIES) diff --git a/modules/kde4BasicFindPackageVersion.cmake.in b/modules/kde4BasicFindPackageVersion.cmake.in new file mode 100644 index 00000000..a347e15f --- /dev/null +++ b/modules/kde4BasicFindPackageVersion.cmake.in @@ -0,0 +1,27 @@ +# This is a very basic file for the new style find_package() search mode, +# i.e. Config-mode. It is used by KDE4_WRITE_BASIC_CMAKE_VERSION_FILE() from +# KDE4Macros.cmake. +# In this mode find_package() searches for a <package>Config.cmake +# file and an associated <package>Version.cmake file, which it loads to check +# the version number. +# This file can be used with configure_file() to generate such a file for a project +# with very basic logic. +# It sets PACKAGE_VERSION_EXACT if the current version string and the requested +# version string are exactly the same and it sets PACKAGE_VERSION_COMPATIBLE +# if the current version is >= requested version. +# If this is not good enough for your project, you need to write your own +# improved <package>Version.cmake file. +# This file requires the following three variables to be set: +# PROJECT_VERSION_MAJOR +# PROJECT_VERSION_MINOR +# PROJECT_VERSION_PATCH + + +set(PACKAGE_VERSION @PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@) + +if(NOT ${PACKAGE_FIND_VERSION} VERSION_LESS ${PACKAGE_VERSION} ) + set(PACKAGE_VERSION_COMPATIBLE TRUE) + if( ${PACKAGE_FIND_VERSION} STREQUAL ${PACKAGE_VERSION}) + set(PACKAGE_VERSION_EXACT TRUE) + endif( ${PACKAGE_FIND_VERSION} STREQUAL ${PACKAGE_VERSION}) +endif(NOT ${PACKAGE_FIND_VERSION} VERSION_LESS ${PACKAGE_VERSION} ) |