[kdelibs4support] /: Add a compatibility CMake config file

Alex Merry alex.merry at kde.org
Thu Apr 10 15:07:29 UTC 2014


Git commit 7f707a8c28b92b1ad79b31dc74f0978255eaee9a by Alex Merry.
Committed on 09/04/2014 at 21:55.
Pushed by alexmerry into branch 'master'.

Add a compatibility CMake config file

This allows projects to continue using find_package(KF5KDE4Suport) and
KF5::KDE4Support in CMake files, keeping source compatibility with
beta1.

CCMAIL: kde-frameworks-devel at kde.org

M  +31   -0    CMakeLists.txt
A  +33   -0    KF5KDE4SupportConfig.cmake.in

http://commits.kde.org/kde4support/7f707a8c28b92b1ad79b31dc74f0978255eaee9a

diff --git a/CMakeLists.txt b/CMakeLists.txt
index ad26ee4..1cbf68b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -106,6 +106,37 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/kdelibs4support_version.h
         DESTINATION ${INCLUDE_INSTALL_DIR}
         COMPONENT Devel)
 
+
+
+#
+# Compatibility file
+#
+set(CMAKECONFIG_COMPAT_INSTALL_DIR "${CMAKECONFIG_INSTALL_PREFIX}/KF5KDE4Support")
+if(BUILD_SHARED_LIBS)
+    set(KDELibs4Support_LIB_TYPE SHARED)
+else()
+    set(KDELibs4Support_LIB_TYPE STATIC)
+endif()
+ecm_configure_package_config_file(
+    "${CMAKE_CURRENT_SOURCE_DIR}/KF5KDE4SupportConfig.cmake.in"
+    "${CMAKE_CURRENT_BINARY_DIR}/KF5KDE4SupportConfig.cmake"
+    INSTALL_DESTINATION "${CMAKECONFIG_COMPAT_INSTALL_DIR}"
+)
+write_basic_package_version_file(
+    "${CMAKE_CURRENT_BINARY_DIR}/KF5KDE4SupportConfigVersion.cmake"
+    VERSION ${KF5_VERSION}
+    COMPATIBILITY AnyNewerVersion
+)
+install(
+    FILES
+        "${CMAKE_CURRENT_BINARY_DIR}/KF5KDE4SupportConfig.cmake"
+        "${CMAKE_CURRENT_BINARY_DIR}/KF5KDE4SupportConfigVersion.cmake"
+    DESTINATION "${CMAKECONFIG_COMPAT_INSTALL_DIR}"
+    COMPONENT Devel
+)
+
+
+
 add_subdirectory(cmake)
 add_subdirectory(docs)
 add_subdirectory(src)
diff --git a/KF5KDE4SupportConfig.cmake.in b/KF5KDE4SupportConfig.cmake.in
new file mode 100644
index 0000000..d4488d5
--- /dev/null
+++ b/KF5KDE4SupportConfig.cmake.in
@@ -0,0 +1,33 @@
+ at PACKAGE_INIT@
+
+find_dependency(KF5KDELibs4Support "@KF5_VERSION@")
+
+if(NOT TARGET KF5::KDE4Support)
+    add_library(KF5::KDE4Support @KDELibs4Support_LIB_TYPE@ IMPORTED)
+
+    # Because CMake won't let us alias an imported target, we have to
+    # create a new imported target and copy the properties we care about
+    set(_copy_props
+        INTERFACE_INCLUDE_DIRECTORIES
+        INTERFACE_LINK_LIBRARIES
+        IMPORTED_CONFIGURATIONS
+    )
+    get_target_property(_configs KF5::KDELibs4Support IMPORTED_CONFIGURATIONS)
+    foreach(_config ${_configs})
+        set(_copy_props
+            ${_copy_props}
+            IMPORTED_LINK_DEPENDENT_LIBRARIES_${_config}
+            IMPORTED_LOCATION_${_config}
+            IMPORTED_SONAME_${_config}
+        )
+    endforeach()
+    foreach(_prop ${_copy_props})
+        get_target_property(_temp_prop KF5::KDELibs4Support "${_prop}")
+        set_target_properties(KF5::KDE4Support PROPERTIES "${_prop}" "${_temp_prop}")
+    endforeach()
+
+    message(AUTHOR_WARNING
+"  The KF5KDE4Support package is deprecated: use
+  find_package(KF5KDELibs4Support) or
+  find_package(KF5 COMPONENTS KDELibs4Support) instead.")
+endif()


More information about the Kde-frameworks-devel mailing list