MantisBT - CMake
View Issue Details
0011484CMakeModulespublic2010-11-19 05:172010-11-19 14:14
David Coppa 
Clinton Stimpson 
normalmajoralways
closedno change required 
All
CMake 2.8.3 
 
0011484: Issue into Qt4ConfigDependentSettings.cmake
There was a wrong commit for Modules/Qt4ConfigDependentSettings.cmake:

http://cmake.org/gitweb?p=cmake.git;a=commit;h=5e1a2408fedd379467693b3548d46dad464f72ad [^]

Starting at line 66:

IF(NOT QT_IS_STATIC)
 RETURN()
ENDIF(NOT QT_IS_STATIC)

This is incorrect and it should be the opposite.
By now, QT_QT*_LIB_DEPENDENCIES usage is broken due to this.

I've attached a simple diff that fixes the problem.

Ciao,
David
No tags attached.
diff Qt4ConfigDependentSettings.diff (514) 2010-11-19 05:17
https://public.kitware.com/Bug/file/3515/Qt4ConfigDependentSettings.diff
Issue History
2010-11-19 05:17David CoppaNew Issue
2010-11-19 05:17David CoppaFile Added: Qt4ConfigDependentSettings.diff
2010-11-19 07:43Brad KingAssigned To => Clinton Stimpson
2010-11-19 07:43Brad KingStatusnew => assigned
2010-11-19 09:58Clinton StimpsonNote Added: 0023432
2010-11-19 10:12David CoppaNote Added: 0023433
2010-11-19 10:18David CoppaNote Added: 0023434
2010-11-19 10:26David CoppaNote Edited: 0023433bug_revision_view_page.php?bugnote_id=23433#r16
2010-11-19 10:33David CoppaNote Edited: 0023434bug_revision_view_page.php?bugnote_id=23434#r18
2010-11-19 10:43David CoppaNote Edited: 0023433bug_revision_view_page.php?bugnote_id=23433#r19
2010-11-19 12:20Clinton StimpsonNote Added: 0023438
2010-11-19 14:05David CoppaNote Added: 0023449
2010-11-19 14:14Clinton StimpsonStatusassigned => closed
2010-11-19 14:14Clinton StimpsonResolutionopen => no change required

Notes
(0023432)
Clinton Stimpson   
2010-11-19 09:58   
Can you tell me what your problem is?
As far as I can see, your suggestion will break builds against static Qt and cause overlinking against shared Qt.
(0023433)
David Coppa   
2010-11-19 10:12   
(edited on: 2010-11-19 10:43)
Libraries that should be brought in as dependencies of Qt4 libraries are not registered into ELF headers.

See http://pastie.org/1308360 [^]
Notice the difference between "objdump -p" output and ldd output.

You have "extra" libs, namely ICE.9 SM.8 X11.14 Xext.11 Xi.11 Xinerama.5 Xrender.5 fontconfig.7 freetype.17 glib-2.0.2600 gobject-2.0.2600 gthread-2.0.2600 iconv.6 intl.5 png.10 z.4

And this is a problem for a ports system like the OpenBSD one that needs to take trace of inter libraries dependencies (to update a package from one version to a newer one).

This used to work well with cmake 2.8.1:

When, in a CMakeLists.txt, you have:

TARGET_LINK_LIBRARIES(foo
  ...
  ${QT_QTCORE_LIBRARY} ${QT_QTCORE_LIB_DEPENDENCIES}
  ${QT_QTGUI_LIBRARY} ${QT_QTGUI_LIB_DEPENDENCIES}
  ${QT_QTNETWORK_LIBRARY} ${QT_QTNETWORK_LIB_DEPENDENCIES}

Now ${QT_QTCORE_LIB_DEPENDENCIES}, ${QT_QTGUI_LIB_DEPENDENCIES}, and ${QT_QTNETWORK_LIB_DEPENDENCIES} are empty.

(0023434)
David Coppa   
2010-11-19 10:18   
(edited on: 2010-11-19 10:33)
If I have understood the implications with static Qt correctly, maybe just removing that check would be a better approach...

(0023438)
Clinton Stimpson   
2010-11-19 12:20   
The pastie.org link doesn't work for me.

First of all, QT_QT*_LIB_DEPENDENCIES are not documented as part of the FindQt4 api, and are therefore internal to FindQt4.cmake/UseQt4.cmake. They should not be used in any CMakeLists.txt file.

Here's an example of what is preferable:
If foo depends on QtOpenGL, and makes calls into the OpenGL library, then the CMakeLists.txt for foo should do:
find_package(Qt4)
find_package(OpenGL)
...
target_link_libraries(foo ${QT_QTOPENGL_LIBRARY} ${OPENGL_LIBRARIES})
and link with only the libraries that foo makes calls to.

The problem with using QT_QT*_LIB_DEPENDENCIES is that one links foo against libraries that foo doesn't use. I thought this overlinking was a problem for package maintainers because it causes too many packages to be updated that don't really need to be. If this is not true for package maintainers, then can you respond with how it is supposed to work?
(0023449)
David Coppa   
2010-11-19 14:05   
Ok. I've understood. You can close this issue.

Sorry for the noise,
David