[Development] 答复: Qt static compiler error

Matthew Woehlke mwoehlke.floss at gmail.com
Tue Oct 27 15:48:13 CET 2015


(Apologies for reposting information, but my other message is stuck
somewhere in the moderation queue...)

On 2015-10-26 22:58, Thiago Macieira via Development wrote:
> On Tuesday 27 October 2015 09:05:34 kl222 via Development wrote:
>> Thiago Macieira:
>>
>> 1. I think this is a bug. When using cmake project file, it has the
>> responsibility to deal with it automatic dependency, rather than by the user
>> to deal with.
> 
> That might be. So please report it so this isn't forgotten.

Please compare https://bugreports.qt.io/browse/QTBUG-38913 before
reporting a bug.

>> 2. No bug for qt. How to use .prl and .pc in cmake or pro file?
> 
> In the .pro file, the .prl file is used automatically. You don't have to do 
> anything. You won't see this problem with qmake.
> 
> Your problem is exclusive to cmake because the information is missing from our 
> generated files. Matthew says there's a place to save them, but he doesn't 
> know how Qt's buildsystem generates such files.
> 
> That's done in mkspecs/features/create_cmake.prf in qtbase using 
> mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in as a template. If anyone 
> can figure out how to save LIBS and LIBS_PRIVATE in the cmake file, that 
> should fix the problem.

https://codereview.qt-project.org/#/c/33193/4 ?

Looking a bit more closely, it looks like that may be stale beyond being
able to apply.

Looking at create_cmake.prf, I still don't understand what's going on
:-). It looks like what needs to happen, though, is somewhere about
where CMAKE_QT5_MODULE_DEPS is filled, another variable needs to be
filled with the private dependencies. Then in Qt5BasicConfig.cmake.in
where this is used, there needs to be an additional PP conditional to
choose between just the public deps or both the public and private deps,
depending if Qt is static. (There is already such PP conditionals for
using the correct add_library(), so there is no issue with such an
addition.)

Very rough patch for the CMake side attached. (This won't fix the
problem, it's just to demonstrate what I'm trying to say above.) If
someone knows how to modify create_cmake.prf to stuff the appropriate
private dependencies into CMAKE_QT5_MODULE_STATIC_DEPS, I think this
should work.

-- 
Matthew
-------------- next part --------------
A non-text attachment was scrubbed...
Name: qt5-cmake-static.patch
Type: text/x-patch
Size: 831 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20151027/fb4bc57f/attachment.bin>


More information about the Development mailing list