[CMake] Where is QT_USE_IMPORTED_TARGETS not safe to use?
Stephen Kelly
steveire at gmail.com
Wed Jun 22 08:56:23 EDT 2011
Clinton Stimpson wrote:
> It means the target must be created again with something like
> add_library(Qt4::QtCore UNKNOWN IMPORTED)
>
> If GrantleeConfig.cmake were to do this:
> SET(QT_USE_IMPORTED_TARGETS 1)
> find_package(Qt4 REQUIRED)
>
> then the imported targets would satisfy the Qt4::QtCore reference and
> others from your GrantleeTargets-debug.
>
>>
>> > The GrantleeConfig.cmake could set QT_USE_IMPORTED_TARGETS and a
>> > find_package(Qt4) to recreated those imported targets.
>>
>> Ok, so maybe setting cis the thing that needs to
>> be done 'again' by project B?
>
> Yes, or preferably in your GrantleeConfig.cmake so project B doesn't have
> to do it.
>
I tried creating the error scenario, but it does work even if the downstream
does not set QT_USE_IMPORTED_TARGETS and even if I don't put it in
GrantleeConfig either. Qt4::QtCore is never interpreted as a file path
because FindQt4.cmake sets it unconditionally, and only conditionally sets
QT_QTCORE_LIBRARY to Qt4::QtCore based on QT_USE_IMPORTED_TARGETS.
That means that if Grantlee uses
More information about the CMake
mailing list