Qt5 cmake stuff

David Faure faure at kde.org
Mon May 14 21:27:52 UTC 2012


On Monday 14 May 2012 23:22:09 Alexander Neundorf wrote:
> On Monday 14 May 2012, Alexander Neundorf wrote:
> ...
> 
> > For now, you can change the code e.g. to
> > if (NOT TARGET Qt5::Core)
> > 
> >   message(STATUS "DF: Qt5CoreConfig.cmake add_library(Qt5::Core)")
> >   add_library(Qt5::Core SHARED IMPORTED)
> > 
> > endif()
> > 
> > OR
> > 
> > if (NOT _qt5CoreTargetExists)
> > 
> >   set(_Qt5Core_target TRUE)
> 
> Should be:
> set(_qt5CoreTargetExists TRUE)

Yes but this solution is basically the one that this commit moved away from:

commit 2b735ac8e6b36c66444986a381cc56cd65a2bf7c
Author: Stephen Kelly <stephen.kelly at kdab.com>
Date:   Sun May 13 19:48:47 2012 +0200

    Use directory property instead of variable to determine target existance.
    
    This is more resilient to calling find_package in a scope such
    as a function.
    
    Change-Id: I17e69a416f4aed3102fa6195d239bcf4ce0b306b
    Reviewed-by: Alexander Neundorf <neundorf at kde.org>
    Reviewed-by: Stephen Kelly <stephen.kelly at kdab.com>

diff --git a/mkspecs/cmake/Qt5BasicConfig.cmake.in b/mkspecs/cmake/Qt5BasicConfig.cmake.in
index 60024e5..a6e39b6 100644
--- a/mkspecs/cmake/Qt5BasicConfig.cmake.in
+++ b/mkspecs/cmake/Qt5BasicConfig.cmake.in
@@ -109,8 +109,9 @@ list(APPEND _Qt5Gui_LIB_DEPENDENCIES ${JPEG_LIBRARIES})
 
 !!ENDIF # Static
 
-if (NOT _Qt5$${CMAKE_MODULE_NAME}_target)
-    set(_Qt5$${CMAKE_MODULE_NAME}_target 1)
+get_property(_qt5$${CMAKE_MODULE_NAME}TargetExists DIRECTORY PROPERTY _Qt5$${CMAKE_MODULE_NAME}_target)
+if (NOT _qt5$${CMAKE_MODULE_NAME}TargetExists)
+    set_property(DIRECTORY PROPERTY _Qt5$${CMAKE_MODULE_NAME}_target TRUE)
 !!IF !isEmpty(CMAKE_STATIC_TYPE)
     add_library(Qt5::$${CMAKE_MODULE_NAME} STATIC IMPORTED)
 !!ELSE


-- 
David Faure, faure at kde.org, http://www.davidfaure.fr
Sponsored by Nokia to work on KDE, incl. KDE Frameworks 5



More information about the Kde-frameworks-devel mailing list