[Development] Qt 5 packaging and binary renaming

Stephen Kelly stephen.kelly at kdab.com
Wed Dec 12 14:52:16 CET 2012


Hi there,

For anyone packaging Qt 5 and renaming the binaries moc, rcc, uic, etc, please 
remember to also change the CMake config files using those to the renamed 
binaries.

The files to change are:

In qtbase.git:
 * src/widgets/Qt5WidgetsConfigExtras.cmake.in
 * src/dbus/Qt5DBusConfigExtras.cmake.in
 * src/corelib/Qt5CoreConfigExtras.cmake.in

In qttools.git:
 * src/linguist/Qt5LinguistToolsConfig.cmake.in

You need to change the IMPORTED_LOCATION value in the files. For example:

diff --git a/src/corelib/Qt5CoreConfigExtras.cmake.in 
b/src/corelib/Qt5CoreConfigExtras.cmake.in
index 0df2703..70c32dc 100644
--- a/src/corelib/Qt5CoreConfigExtras.cmake.in
+++ b/src/corelib/Qt5CoreConfigExtras.cmake.in
@@ -18,9 +18,9 @@ if (NOT TARGET Qt5::moc)
 
     set_target_properties(Qt5::moc PROPERTIES
 !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)                                                                                                                                                                           
-        IMPORTED_LOCATION 
\"${_qt5_corelib_install_prefix}/$${CMAKE_BIN_DIR}moc$$CMAKE_BIN_SUFFIX\"                                                                                                               
+        IMPORTED_LOCATION 
\"${_qt5_corelib_install_prefix}/$${CMAKE_BIN_DIR}moc-qt5$$CMAKE_BIN_SUFFIX\"                                                                                                           
 !!ELSE                                                                                                                                                                                                            
-        IMPORTED_LOCATION \"$${CMAKE_BIN_DIR}moc$$CMAKE_BIN_SUFFIX\"                                                                                                                                              
+        IMPORTED_LOCATION \"$${CMAKE_BIN_DIR}moc-qt5$$CMAKE_BIN_SUFFIX\"                                                                                                                                          
 !!ENDIF                                                                                                                                                                                                           
     )                                                                                                                                                                                                             
     # For CMake automoc feature                             



Note also that if you move the mkspecs, you also need to patch the cmake 
files. For example:

diff --git a/src/corelib/Qt5CoreConfigExtras.cmake.in 
b/src/corelib/Qt5CoreConfigExtras.cmake.in
index 0df2703..24e4625 100644
--- a/src/corelib/Qt5CoreConfigExtras.cmake.in
+++ b/src/corelib/Qt5CoreConfigExtras.cmake.in
@@ -44,7 +44,7 @@ set(Qt5Core_MOC_EXECUTABLE Qt5::moc)
 set(Qt5Core_RCC_EXECUTABLE Qt5::rcc)
 
 !!IF isEmpty(CMAKE_DATA_DIR_IS_ABSOLUTE)
-list(APPEND Qt5Core_INCLUDE_DIRS 
\"${_qt5_corelib_install_prefix}/mkspecs/$${CMAKE_MKSPEC}\")
+list(APPEND Qt5Core_INCLUDE_DIRS 
\"${_qt5_corelib_install_prefix}/share/qt5/mkspecs/$${CMAKE_MKSPEC}\")
 !!ELSE
 list(APPEND Qt5Core_INCLUDE_DIRS 
\"$${CMAKE_DATA_DIR}mkspecs/$${CMAKE_MKSPEC}\")
 !!ENDIF



Note that the tests are in the source packages, so to verify that you have 
correct packages from the cmake point of view, you can do this:

 cd tests/auto/cmake && mkdir build && cd build && cmake .. && ctest

Note that this does not work in general for all unit tests in Qt (as many of 
them require Qt to be configured with -developer-build), but it will work for 
the cmake tests. Please report any failures.

Thanks,

-- 
Stephen Kelly <stephen.kelly at kdab.com> | Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
www.kdab.com || Germany +49-30-521325470 || Sweden (HQ) +46-563-540090
KDAB - Qt Experts - Platform-Independent Software Solutions
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3636 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20121212/a240f171/attachment.bin>


More information about the Development mailing list