[karchive] /: Show how qmake integration can be done.

David Faure faure at kde.org
Sat Jan 4 11:19:59 UTC 2014


Git commit 7948c5cfdf511aef1778681f9fdae96c1cfc14e5 by David Faure.
Committed on 04/01/2014 at 11:19.
Pushed by dfaure into branch 'master'.

Show how qmake integration can be done.

The .pri.in file should be generated by ECM code instead, to make this
easier to deploy.

CCMAIL: kde-buildsystem at kde.org

M  +17   -0    CMakeLists.txt
A  +13   -0    KArchive.pri.in
A  +6    -0    examples/helloworld/helloworld.pro

http://commits.kde.org/karchive/7948c5cfdf511aef1778681f9fdae96c1cfc14e5

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f3704b1..d698bf6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -79,6 +79,23 @@ install(FILES
 
 install(EXPORT KF5ArchiveTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KF5ArchiveTargets.cmake NAMESPACE KF5:: )
 
+### qmake support - TODO, make a ecm macro for this
+set(FRAMEWORK_NAME KArchive)
+set(FRAMEWORK_LIBNAME KF5Archive)
+set(FRAMEWORK_QTDEPS core)
+set(ECM_VERSION_STRING "${KARCHIVE_VERSION_STRING}")
+set(ECM_VERSION_MAJOR "${KARCHIVE_VERSION_MAJOR}")
+set(ECM_VERSION_MINOR "${KARCHIVE_VERSION_MINOR}")
+set(ECM_VERSION_PATCH "${KARCHIVE_VERSION_PATCH}")
+
+# This default value makes "installing qt and kf5 into the same prefix" work out of the box.
+# Packagers who use -DCMAKE_INSTALL_PREFIX=/usr will certainly want to set ECM_MKSPECS_INSTALL_DIR to something like share/qt5/mkspecs/modules
+set(ECM_MKSPECS_INSTALL_DIR mkspecs/modules CACHE PATH "The directory where mkspecs will be installed to.")
+
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${FRAMEWORK_NAME}.pri.in ${CMAKE_CURRENT_BINARY_DIR}/qt_${FRAMEWORK_NAME}.pri @ONLY)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/qt_${FRAMEWORK_NAME}.pri DESTINATION ${ECM_MKSPECS_INSTALL_DIR})
+#### end of qmake support
+
 if ("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
   feature_summary(WHAT ALL   FATAL_ON_MISSING_REQUIRED_PACKAGES)
 endif()
diff --git a/KArchive.pri.in b/KArchive.pri.in
new file mode 100644
index 0000000..cf55229
--- /dev/null
+++ b/KArchive.pri.in
@@ -0,0 +1,13 @@
+QT. at FRAMEWORK_NAME@.VERSION = @ECM_VERSION_STRING@
+QT. at FRAMEWORK_NAME@.MAJOR_VERSION = @ECM_VERSION_MAJOR@
+QT. at FRAMEWORK_NAME@.MINOR_VERSION = @ECM_VERSION_MINOR@
+QT. at FRAMEWORK_NAME@.PATCH_VERSION = @ECM_VERSION_PATCH@
+QT. at FRAMEWORK_NAME@.name = @FRAMEWORK_LIBNAME@
+QT. at FRAMEWORK_NAME@.bins =
+QT. at FRAMEWORK_NAME@.includes = @CMAKE_INSTALL_PREFIX@/@INCLUDE_INSTALL_DIR@/@FRAMEWORK_NAME@
+QT. at FRAMEWORK_NAME@.private_includes =
+QT. at FRAMEWORK_NAME@.sources =
+QT. at FRAMEWORK_NAME@.libs = @CMAKE_INSTALL_PREFIX@/@LIB_INSTALL_DIR@
+QT. at FRAMEWORK_NAME@.plugins =
+QT. at FRAMEWORK_NAME@.imports =
+QT. at FRAMEWORK_NAME@.depends = @FRAMEWORK_QTDEPS@
diff --git a/examples/helloworld/helloworld.pro b/examples/helloworld/helloworld.pro
new file mode 100644
index 0000000..cba4f7a
--- /dev/null
+++ b/examples/helloworld/helloworld.pro
@@ -0,0 +1,6 @@
+# Show how to use KArchive using qmake
+
+# Set $QMAKEPATH to your KArchive install prefix if this is not found.
+QT += KArchive
+
+SOURCES += main.cpp


More information about the Kde-buildsystem mailing list