Qt5 cmake stuff

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


On Monday 14 May 2012 23:05:01 Alexander Neundorf wrote:
> On Monday 14 May 2012, David Faure wrote:
> > On Monday 14 May 2012 18:10:19 David Faure wrote:
> > > Hi (Steve),
> > > 
> > > It seems that updating Qt5 to the latest master broke my
> > > kdelibs-frameworks-qt5 build?
> > > 
> > > CMake Error at
> > > /d/qt/5/qtbase-master/lib/cmake/Qt5Core/Qt5CoreConfig.cmake:60
> > > (add_library): add_library cannot create imported target "Qt5::Core"
> > > because another target with the same name already exists.
> > > Call Stack (most recent call first):
> > > 
> > > /d/kde/inst/kde_frameworks-qt5/share/ECM-0.0.4/find-modules/FindQt5Trans
> > > i
> > > ti onal.cmake:2 (find_package) tier1/itemmodels/CMakeLists.txt:19
> > > (find_package)
> > > 
> > > (and many more such errors about duplicate targets)
> > > 
> > > Unfortunately cmake doesn't say *where* it saw the target the first
> > > time,
> > > so I have no clue how to debug this.
> > 
> > Actually it seems to happen both times in the same file.
> > It's trying to prevent calling add_library(Qt5::Core SHARED IMPORTED)
> > twice, but the mechanism to prevent that is not working...
> > 
> > Qt5CoreConfig.cmake says:
> > 
> > get_property(_qt5CoreTargetExists DIRECTORY PROPERTY _Qt5Core_target)
> > if (NOT _qt5CoreTargetExists)
> > 
> >     set_property(DIRECTORY PROPERTY _Qt5Core_target TRUE)
> >     message(STATUS "DF: Qt5CoreConfig.cmake add_library(Qt5::Core SHARED
> > 
> > IMPORTED)") add_library(Qt5::Core SHARED IMPORTED)
> > endif()
> > 
> > but the output from make says
> > [...]
> > -- DF: Qt5CoreConfig.cmake add_library(Qt5::Core SHARED IMPORTED)
> > [...]
> > -- DF: Qt5CoreConfig.cmake add_library(Qt5::Core SHARED IMPORTED)
> > [...]
> > 
> > so clearly this "directory property" stuff isn't working.
> 
> I'm quite sure it, but maybe not as we think it does ;-)

I was hoping that the above would be enough information for you to find what 
the problem was, actually :-)

> > Steve, Alex: help ;-)
> > 
> > Which directory is this supposed to be about?
> 
> To see where output comes from you can run cmake with --debug-output:

Thanks for that hint, but my "message(STATUS ...)" above already took care of 
that: I'm sure now that the contents of that if is executed twice.
My question was rather:
 when doing set_property(DIRECTORY PROPERTY foo TRUE), which directory is 
getting that property set?
Maybe the issue is that it's not the same directory, between the two 
invocations of Qt5CoreConfig.cmake.

-- 
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