From 728a5895ce2bd160b3a8748ee15711d942d62ebb Mon Sep 17 00:00:00 2001 From: Alexander Neundorf Date: Sun, 14 Dec 2008 23:11:35 +0000 Subject: -rename the new kde4_write_basic_cmake_version_file() to macro_write_basic_cmake_version_file(), since it is completely KDE-independent and can potentially be used in any other project remove the old macro, add the new renamed one, add it to the macro library, adjust kdepimlibs/CMakeLists.txt accordingly Alex svn path=/trunk/KDE/kdelibs/; revision=896999 --- modules/BasicFindPackageVersion.cmake.in | 30 +++++++++++++++++++++++++++ modules/CMakeLists.txt | 4 ++-- modules/FindKDE4Internal.cmake | 8 ------- modules/KDE4Macros.cmake | 8 ------- modules/MacroLibrary.cmake | 1 + modules/MacroWriteBasicCMakeVersionFile.cmake | 22 ++++++++++++++++++++ modules/kde4BasicFindPackageVersion.cmake.in | 30 --------------------------- 7 files changed, 55 insertions(+), 48 deletions(-) create mode 100644 modules/BasicFindPackageVersion.cmake.in create mode 100644 modules/MacroWriteBasicCMakeVersionFile.cmake delete mode 100644 modules/kde4BasicFindPackageVersion.cmake.in diff --git a/modules/BasicFindPackageVersion.cmake.in b/modules/BasicFindPackageVersion.cmake.in new file mode 100644 index 00000000..ae5d3125 --- /dev/null +++ b/modules/BasicFindPackageVersion.cmake.in @@ -0,0 +1,30 @@ +# This is a very basic file for the new style find_package() search mode, +# i.e. Config-mode. It is used by MACRO_WRITE_BASIC_CMAKE_VERSION_FILE() from +# MacroWriteBasicCMakeVersionFile.cmake. +# In this mode find_package() searches for a Config.cmake +# file and an associated 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 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("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" ) + set(PACKAGE_VERSION_COMPATIBLE FALSE) +else("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_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("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" ) + diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt index 35526b69..675659c4 100644 --- a/modules/CMakeLists.txt +++ b/modules/CMakeLists.txt @@ -1,4 +1,4 @@ -## install the cmake files +# install the cmake files file(GLOB cmakeFiles "${CMAKE_CURRENT_SOURCE_DIR}/*.cmake") @@ -9,7 +9,7 @@ install( FILES cmake-modules-styleguide.txt kde4init_win32lib_dummy.cpp.in kde4_cmake_uninstall.cmake.in kde4automoc.files.in - kde4BasicFindPackageVersion.cmake.in + BasicFindPackageVersion.cmake.in FindLibPython.py FindPyKDE4.py FindPyQt.py diff --git a/modules/FindKDE4Internal.cmake b/modules/FindKDE4Internal.cmake index ba03f65f..6d839124 100644 --- a/modules/FindKDE4Internal.cmake +++ b/modules/FindKDE4Internal.cmake @@ -134,14 +134,6 @@ # 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 ConfigVersion.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, diff --git a/modules/KDE4Macros.cmake b/modules/KDE4Macros.cmake index 37195e87..f0bd9c8e 100644 --- a/modules/KDE4Macros.cmake +++ b/modules/KDE4Macros.cmake @@ -1134,14 +1134,6 @@ 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/MacroLibrary.cmake b/modules/MacroLibrary.cmake index 5e482f92..a467d840 100644 --- a/modules/MacroLibrary.cmake +++ b/modules/MacroLibrary.cmake @@ -16,3 +16,4 @@ INCLUDE(MacroEnsureOutOfSourceBuild) INCLUDE(MacroBoolTo01) INCLUDE(MacroPushRequiredVars) INCLUDE(MacroLogFeature) +INCLUDE(MacroWriteBasicCMakeVersionFile) diff --git a/modules/MacroWriteBasicCMakeVersionFile.cmake b/modules/MacroWriteBasicCMakeVersionFile.cmake new file mode 100644 index 00000000..6f9e4189 --- /dev/null +++ b/modules/MacroWriteBasicCMakeVersionFile.cmake @@ -0,0 +1,22 @@ +# MACRO_WRITE_BASIC_CMAKE_VERSION_FILE( _filename _major _minor _patch) +# Writes a file for use as ConfigVersion.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 +# + +# Copyright (c) 2008, Alexander Neundorf, +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +get_filename_component(_currentListFileDir ${CMAKE_CURRENT_LIST_FILE} PATH) + +function(MACRO_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(${_currentListFileDir}/BasicFindPackageVersion.cmake.in "${_filename}" @ONLY) +endfunction(MACRO_WRITE_BASIC_CMAKE_VERSION_FILE _major _minor _patch) diff --git a/modules/kde4BasicFindPackageVersion.cmake.in b/modules/kde4BasicFindPackageVersion.cmake.in deleted file mode 100644 index ba4cb1eb..00000000 --- a/modules/kde4BasicFindPackageVersion.cmake.in +++ /dev/null @@ -1,30 +0,0 @@ -# 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 Config.cmake -# file and an associated 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 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("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" ) - set(PACKAGE_VERSION_COMPATIBLE FALSE) -else("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_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("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" ) - -- cgit v1.2.1