[CMake] How to specify certain lib to be linked with before others? (QtOpenGL related)

michael kapelko kornerr at gmail.com
Tue Feb 9 00:58:59 EST 2010


2010/2/9 michael kapelko <kornerr at gmail.com>:
> Hello.
> I'm building an app with Qt4 that uses Horde3D under Linux. This app
> only works when -lHorde3D is specified *before* -lGL for linkage. By
> default, CMake puts -lGL before -lHorde3D, probably because I link
> with -lHorde3D as TARGET_LINK_LIBRARIES(test Horde3D) and -lGL is
> added by Qt4 CMake module.
> Is there any way to make -lHorde3D appear *before* -lGL?
> Thanks.
>

I found out that I simply need to replace this:
TARGET_LINK_LIBRARIES(test ${QT_LIBRARIES} Horde3D Horde3DUtils)
with this
TARGET_LINK_LIBRARIES(test Horde3D Horde3DUtils ${QT_LIBRARIES})


More information about the CMake mailing list