[CMake] FIND_LIBRARY and OS X Frameworks

Tanner Lovelace clubjuggler at gmail.com
Fri Mar 31 12:41:30 EST 2006


Greetings,

I have a weird cmake problem.  In the KDE FindQt4.cmake, currently
if we determine Qt has been compiled as OS X frameworks, the library
variables are set by hand to be "-F${QT_LIBRARY_DIR} -framework <frameworkname>"
instead of using FIND_LIBRARY.  I noticed, however, that FIND_LIBRARY
has support for finding frameworks so I tried switching it over to that.
That works and it sets the library variable to the path to the framework
(i.e. /usr/local/Trolltech/Qt-4.1.1/lib/QtCore.framework).  The find_library
documentation says "When a full path to a framework is used as a library,
CMake will use a -framework A and a -F<fullpath> to link the framework
to the target."

Ok, so far so good.  It does indeed do this correctly.  However, when we
get into attempting to link the kdecore library, I run into multiple undefined
symbols.  Looking at the CMakeLists.txt file where libkdecore is defined,
the only thing I think might make a difference is that the libraries we're not
linking to are defined in separate target_link_libraries lines.  For instance
here's the main link line:

target_link_libraries(kdecore  ${QT_QTCORE_LIBRARY}
${QT_QT3SUPPORT_LIBRARY} ${QT_QTGUI_LIBRARY} ${X11_LIBRARIES}
${UTIL_LIBRARY} DCOP ${ZLIB_LIBRARY} ${CARBON_LIBRARY})

and further down we have:

if(BZIP2_FOUND)
   target_link_libraries(kdecore  ${BZIP2_LIBRARIES})
endif(BZIP2_FOUND)

while the BZIP2_FOUND variable is set to true, for some reason when I
use find_library to find the qt frameworks, it doesn't get added correctly
and when the qt frameworks are set manually it does get added to the
link line correctly.

One other note.  Part of the error message I get includes this:

/usr/bin/libtool: internal link edit command failed

Which seems to me like it was trying to edit a link command to add
extra defines, but something failed on it.

So, can anyone explain

a) how the substitution of -F dir -framework name happens and if something
there could be causing a problem
b) is there something wrong because not everything is in the same
target_link_libraries
line?
c) what else have I missed? (could it be something simple?)

Thanks very much in advance.

Cheers,
Tanner


--
Tanner Lovelace
clubjuggler at gmail dot com
http://wtl.wayfarer.org/
(fieldless) In fess two roundels in pale, a billet fesswise and an
increscent, all sable.


More information about the CMake mailing list