summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Cord-Landwehr <cordlandwehr@kde.org>2015-04-09 19:59:40 (GMT)
committerAndreas Cord-Landwehr <cordlandwehr@kde.org>2015-04-15 19:55:35 (GMT)
commitac258e49f1d7efe5fe950776ce334a9107923b07 (patch)
tree95491c01a91fc76b5dfdc843b929777fb631e45a
parent4a1c199e8eb687f6df8de6a4e65e9368db1c9ddf (diff)
Use generated version and CMake config files.
Replace both the package version file by a generated file, as well as OkularConfig.cmake package configuration file. Note that with this change the compatibility CMake variable OKULAR_FOUND is not set anymore, use Okular_FOUND instead. REVIEW: 123314
-rw-r--r--CMakeLists.txt31
-rw-r--r--OkularConfig.cmake20
-rw-r--r--OkularConfig.cmake.in10
-rw-r--r--core/version.h24
4 files changed, 34 insertions, 51 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2b8b83a..836b191 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -19,6 +19,11 @@ include(KDEInstallDirs)
include(KDECMakeSettings)
include(ECMAddTests)
include(ECMAddAppIcon)
+include(ECMPackageConfigHelpers)
+
+ecm_setup_version(1.0.0 VARIABLE_PREFIX OKULAR
+ VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/core/version.h"
+ PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/OkularConfigVersion.cmake")
find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED COMPONENTS Core DBus Test Widgets PrintSupport Svg Qml Quick)
find_package(Qt5 ${QT_REQUIRED_VERSION} OPTIONAL_COMPONENTS TextToSpeech)
@@ -156,9 +161,9 @@ install( FILES
core/textpage.h
core/tile.h
core/utils.h
- core/version.h
core/fileprinter.h
core/observer.h
+ ${CMAKE_CURRENT_BINARY_DIR}/core/version.h
${CMAKE_CURRENT_BINARY_DIR}/okularcore_export.h
${CMAKE_CURRENT_BINARY_DIR}/settings_core.h
DESTINATION ${KDE_INSTALL_INCLUDEDIR}/okular/core COMPONENT Devel)
@@ -213,7 +218,7 @@ endif(LibKScreen_FOUND)
set_target_properties(okularcore PROPERTIES VERSION 6.0.0 SOVERSION 6 )
-install(TARGETS okularcore ${KDE_INSTALL_TARGETS_DEFAULT_ARGS} )
+install(TARGETS okularcore EXPORT OkularTargets ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})
install(FILES conf/okular.kcfg DESTINATION ${KDE_INSTALL_KCFGDIR})
install(FILES conf/okular_core.kcfg DESTINATION ${KDE_INSTALL_KCFGDIR})
@@ -310,12 +315,24 @@ install( FILES part.rc part-viewermode.rc DESTINATION ${KDE_INSTALL_KXMLGUI5DIR}
########### cmake files #################
-include(WriteBasicConfigVersionFile)
-write_basic_config_version_file(${CMAKE_CURRENT_BINARY_DIR}/OkularConfigVersion.cmake VERSION 1.0.0 COMPATIBILITY AnyNewerVersion)
+set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/Okular")
+ecm_configure_package_config_file(
+ "${CMAKE_CURRENT_SOURCE_DIR}/OkularConfig.cmake.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/OkularConfig.cmake"
+ INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR}
+ PATH_VARS INCLUDE_INSTALL_DIR CMAKE_INSTALL_PREFIX
+)
+
+install(FILES
+ "${CMAKE_CURRENT_BINARY_DIR}/OkularConfig.cmake"
+ "${CMAKE_CURRENT_BINARY_DIR}/OkularConfigVersion.cmake"
+ DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
+ COMPONENT Devel
+)
+
+install(EXPORT OkularTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE OkularTargets.cmake NAMESPACE Okular:: )
-install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/OkularConfig.cmake
- ${CMAKE_CURRENT_BINARY_DIR}/OkularConfigVersion.cmake
- DESTINATION ${KDE_INSTALL_LIBDIR}/cmake/Okular )
+########### summary #################
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
diff --git a/OkularConfig.cmake b/OkularConfig.cmake
deleted file mode 100644
index 171b845..0000000
--- a/OkularConfig.cmake
+++ /dev/null
@@ -1,20 +0,0 @@
-# get from the full path to OkularConfig.cmake up to the base dir dir:
-get_filename_component(_okularBaseDir "${CMAKE_CURRENT_LIST_DIR}/../../../../" ABSOLUTE)
-
-# find the full paths to the library and the includes:
-find_path(OKULAR_INCLUDE_DIR okular/core/document.h
- HINTS ${_okularBaseDir}/include
- NO_DEFAULT_PATH)
-
-find_library(OKULAR_CORE_LIBRARY okularcore
- HINTS ${_okularBaseDir}/@CMAKE_INSTALL_LIBDIR@
- NO_DEFAULT_PATH)
-
-set(OKULAR_LIBRARIES ${OKULAR_CORE_LIBRARY})
-
-# Compat: the old FindOkular.cmake was setting OKULAR_FOUND and the
-# new one sets Okular_FOUND.
-if(OKULAR_INCLUDE_DIR AND OKULAR_CORE_LIBRARY)
- set(OKULAR_FOUND TRUE)
-endif()
-
diff --git a/OkularConfig.cmake.in b/OkularConfig.cmake.in
new file mode 100644
index 0000000..2b610fe
--- /dev/null
+++ b/OkularConfig.cmake.in
@@ -0,0 +1,10 @@
+@PACKAGE_INIT@
+
+find_dependency(Qt5Core @QT_REQUIRED_VERSION@)
+find_dependency(Qt5PrintSupport @QT_REQUIRED_VERSION@)
+find_dependency(Qt5Widgets @QT_REQUIRED_VERSION@)
+find_dependency(KF5CoreAddons @KF5_REQUIRED_VERSION@)
+find_dependency(KF5Config @KF5_REQUIRED_VERSION@)
+find_dependency(KF5XmlGui @KF5_REQUIRED_VERSION@)
+
+include("${CMAKE_CURRENT_LIST_DIR}/OkularTargets.cmake")
diff --git a/core/version.h b/core/version.h
deleted file mode 100644
index 855df95..0000000
--- a/core/version.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/***************************************************************************
- * Copyright (C) 2008 by Pino Toscano <pino@kde.org> *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- ***************************************************************************/
-
-#ifndef _OKULAR_VERSION_H_
-#define _OKULAR_VERSION_H_
-
-#define OKULAR_VERSION_STRING "1.0.0"
-#define OKULAR_VERSION_MAJOR 1
-#define OKULAR_VERSION_MINOR 0
-#define OKULAR_VERSION_RELEASE 0
-#define OKULAR_MAKE_VERSION( a,b,c ) (((a) << 16) | ((b) << 8) | (c))
-
-#define OKULAR_VERSION \
- OKULAR_MAKE_VERSION(OKULAR_VERSION_MAJOR,OKULAR_VERSION_MINOR,OKULAR_VERSION_RELEASE)
-
-#define OKULAR_IS_VERSION(a,b,c) ( OKULAR_VERSION >= OKULAR_MAKE_VERSION(a,b,c) )
-
-#endif