[Marble-devel] Review Request 111769: switch from qt4_automoc to cmake automoc

Dennis Nienhüser earthwings at gentoo.org
Tue Aug 13 11:44:28 UTC 2013


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/111769/#review37680
-----------------------------------------------------------


Thanks, looks good. Two suggestions:
- Use the global CMAKE_AUTOMOC property instead of target specific ones
- Only enable CMAKE_AUTOMOC for Qt5

Using the global automoc property works around a problem with kde4_add_plugin which also fiddles around with automoc and only respects the global property. With target specific automoc plugins do not build in the KDE version, but cmake generates an error. Another approach would be to get rid of kde4_add_plugin which I have in mind as well, but let's keep that separate of this patch. A nice side effect of using CMAKE_AUTOMOC is that the marble_cmake_automoc macro is not needed.

I'd prefer using cmake builtin automoc only for Qt5 to avoid the sheer mass of warnings which occur because of us using cmake automotoc relaxed mode. Once we do not need to support older cmake versions anymore (which don't have builtin automoc), we can rename our moc inclusion scheme to the cmake builtin style and get rid of relaxed mode.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index ee8e667..e18b726 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -271,6 +271,12 @@ IF ( NOT QT_QTDECLARATIVE_FOUND )
   include_directories(${QT_QTDECLARATIVE_INCLUDE_DIR})
 ENDIF()
 
+if( NOT ${CMAKE_VERSION} STRLESS "2.8" AND NOT QT4_FOUND)
+  SET(CMAKE_AUTOMOC TRUE)
+  SET(CMAKE_AUTOMOC_RELAXED_MODE TRUE)
+endif()
+
+
 if(QTONLY)
   # add a flag to be able to distinguish between qt 
   # and kde mode in the sources
diff --git a/MarbleMacros.cmake b/MarbleMacros.cmake
index 5a0aedc..4c3c121 100644
--- a/MarbleMacros.cmake
+++ b/MarbleMacros.cmake
@@ -19,6 +19,15 @@ else()
   endmacro()
 endif()
 
+
+macro( marble_qt4_automoc )
+  if( ${CMAKE_VERSION} STRLESS "2.8" OR QT4_FOUND)
+    qt4_automoc( ${ARGN} )
+  else()
+    # Just ignore it
+  endif()
+endmacro()
+
 # the place to put in common cmake macros
 # this is needed to minimize the amount of errors to do
 macro( marble_add_plugin _target_name )

- Dennis Nienhüser


On Aug. 4, 2013, 2:33 p.m., Michael Zanetti wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/111769/
> -----------------------------------------------------------
> 
> (Updated Aug. 4, 2013, 2:33 p.m.)
> 
> 
> Review request for Marble.
> 
> 
> Description
> -------
> 
> This commit switches from qt4_automoc to cmake automoc.
> 
> This is one more step on the way to make Marble work with Qt5.
> 
> 
> Diffs
> -----
> 
>   MarbleMacros.cmake 5a0aedc 
>   src/CMakeLists.txt b2a3e09 
>   src/lib/CMakeLists.txt 16c7fab 
>   src/plugins/declarative/CMakeLists.txt 300ebed 
>   src/plugins/positionprovider/geoclue/GeoCute/CMakeLists.txt abde4f2 
>   src/plugins/render/aprs/CMakeLists.txt 4896a8e 
>   src/plugins/render/earthquake/CMakeLists.txt 6a4704e 
>   src/plugins/render/elevationprofilefloatitem/CMakeLists.txt 872e5e1 
>   src/plugins/render/elevationprofilemarker/CMakeLists.txt bbe043e 
>   src/plugins/render/fileview/CMakeLists.txt adfa961 
>   src/plugins/render/foursquare/CMakeLists.txt 0b62efd 
>   src/plugins/render/license/CMakeLists.txt 90c0097 
>   src/plugins/render/navigation/CMakeLists.txt b0597aa 
>   src/plugins/render/opendesktop/CMakeLists.txt 50da329 
>   src/qt-components/marble-touch/CMakeLists.txt 52940a6 
>   src/routing-instructions/CMakeLists.txt c1e6386 
>   src/tilecreator/CMakeLists.txt f1eed44 
>   tools/tilecreator-srtm2/CMakeLists.txt 8088187 
> 
> Diff: http://git.reviewboard.kde.org/r/111769/diff/
> 
> 
> Testing
> -------
> 
> Tested on Ubuntu with Qt4 and -DQTONLY=1
> 
> 
> Thanks,
> 
> Michael Zanetti
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/marble-devel/attachments/20130813/117a15d4/attachment.html>


More information about the Marble-devel mailing list