[CMake] FIND_LIBRARY and OS X Frameworks

Tanner Lovelace clubjuggler at gmail.com
Fri Mar 31 15:35:32 EST 2006


On 3/31/06, Tanner Lovelace <clubjuggler at gmail.com> wrote:
> On 3/31/06, William A. Hoffman <billlist at nycap.rr.com> wrote:
>
> > You could also post your CMakeCache.txt it might have some information.

Here's the relevant link line from the build.make files:

working:
-----------------------
	@echo "Linking CXX shared library ../lib/libkdecore.dylib"
	cd /Users/lovelace/src/kdelibs-working/kdecore && $(CMAKE_COMMAND) -P
CMakeFiles/kdecore.dir/cmake_clean_target.cmake
	cd /Users/lovelace/src/kdelibs-working/kdecore && /usr/bin/c++   
-fno-common -O2 -g -dynamiclib -headerpad_max_install_names
-single_module -multiply_defined suppress -o
../lib/libkdecore.dylib.5.0.0 -install_name
/Users/lovelace/src/kdelibs-working/lib/libkdecore.dylib.5
$(kdecore_OBJECTS) $(kdecore_EXTERNAL_OBJECTS)
-L/Users/lovelace/src/kdelibs-working/lib
-L/Users/lovelace/src/kdelibs-working/lib/. -L/fink/lib
-L/usr/local/lib -F/opt/qt4/lib -framework QtCore -lpthread -framework
Qt3Support -framework QtGui -lDCOP -lz -framework Carbon -lresolv
-lbz2 -ldl -F/opt/qt4/lib -framework QtCore -lpthread
-----------------------
not-working:
-----------------------
	@echo "Linking CXX shared library ../lib/libkdecore.dylib"
	cd /Users/lovelace/src/kdelibs-build2/kdecore && $(CMAKE_COMMAND) -P
CMakeFiles/kdecore.dir/cmake_clean_target.cmake
	cd /Users/lovelace/src/kdelibs-build2/kdecore && /usr/bin/c++   
-fno-common -O2 -g -dynamiclib -headerpad_max_install_names
-single_module -multiply_defined suppress -o
../lib/libkdecore.dylib.5.0.0 -install_name
/Users/lovelace/src/kdelibs-build2/lib/libkdecore.dylib.5
$(kdecore_OBJECTS) $(kdecore_EXTERNAL_OBJECTS)
-L/Users/lovelace/src/kdelibs-build2/lib
-L/Users/lovelace/src/kdelibs-build2/lib/. -L/usr/local/lib
-F/opt/qt4/lib -framework QtCore -lpthread -framework Qt3Support
-framework QtGui -lDCOP -framework Carbon -lresolv -ldl -framework
QtCore -lpthread

-----------------------

Note that besides the different build directories, the only differences
between the link lines are that the working one contains:

-L/fink/lib [...] -lz [...] -lbz2 [...] -F/opt/qt4/lib

Note that the -F/opt/qt4/lib is repeated twice in the working command
(probably because the qtcore library variable was set to that specifically
in the working version and was set by cmake in the non-working version).

I don't know if it makes any difference at all, but the zlib definition
is given in the first target_link_libraries call for this library and bzip2
is given in a later one (if configured to use it).

Obviously there's something converting from the framework directory path
to the framework parameters (-F/path/to/framework -framework A) and there's
also something converting from a library path to library parameters (-lz -lbz2).
It almost looks like only one of these routines is being run to create the
link line and since the frameworks are first the one to convert library
paths to library parameters isn't getting called.  Does this sound feasible?

Note that although -lpthread exists in both lines, it's that way in the
dependency line in the CMakeCache.txt files.  Here are the relevant
dependency lines:

working
---------------------
//Dependencies for the target
kdecore_LIB_DEPENDS:STATIC=-F/opt/qt4/lib -framework
QtCore;-lpthread;-framework Qt3Support;-framework
QtGui;DCOP;/usr/lib/libz.dylib;-framework
Carbon;resolv;/fink/lib/libbz2.dylib;dl;
---------------------
not working:
---------------------
//Dependencies for the target
kdecore_LIB_DEPENDS:STATIC=/opt/qt4/lib/QtCore.framework;-lpthread;/opt/qt4/lib/Qt3Support.framework;/opt/qt4/lib/QtGui.framework;DCOP;/usr/lib/libz.dylib;-framework
Carbon;resolv;/fink/lib/libbz2.dylib;dl;
---------------------

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