target_link_libraries not linking requested libraries?

Benjamin Reed rangerrick at gmail.com
Sun Apr 2 06:51:56 CEST 2006


When building kdesu, for some reason it's not linking against -lkdesu.
 The CMakeFile.txt in kdesu/kdesu specifies:

---(snip!)---
set(kdesu_SRCS kdesu.cpp sudlg.cpp )
kde4_automoc(${kdesu_SRCS})
kde4_add_executable(kdesu ${kdesu_SRCS})
target_link_libraries(kdesu ${KDE4_KIO_LIBS} kdesu )
install_targets(/bin kdesu )
---(snip!)---

...and yet, when linking, I get the following:

---(snip!)---
Linking CXX executable kdesu.app/Contents/MacOS/kdesu
cd /Users/ranger/cvs/build/kdebase/kdesu/kdesu && /opt/cmake/bin/cmake
-P CMakeFiles/kdesu.dir/cmake_clean_target.cmake
cd /Users/ranger/cvs/build/kdebase/kdesu/kdesu && /fink/bin/c++    
-fno-common -O2 -g -headerpad_max_install_names -fPIC
"CMakeFiles/kdesu.dir/kdesu.o" "CMakeFiles/kdesu.dir/sudlg.o"   -o
kdesu.app/Contents/MacOS/kdesu  -L/fink/lib -L/opt/kde4/lib
-L/usr/local/lib -F/opt/qt4/lib -framework QtCore -lpthread -lkdecore
-framework Qt3Support -lkdeui -lkwalletclient -lz -lkio -framework
QtXml -lkdefx -lkdecore -framework QtGui -lDCOP -F/opt/qt4/lib
-framework QtCore -lpthread -framework Carbon -lresolv -lbz2 -ldl
/usr/bin/ld: warning suggest use of -bind_at_load, as lazy binding may
result in errors or different symbols being used
/usr/bin/ld: Undefined symbols:
PtyProcess::setEnvironment(QList<QByteArray> const&)
KDEsuClient::stopServer()
KDEsuClient::setPriority(int)
KDEsuClient::startServer()
KDEsuClient::isServerSGID()
KDEsuClient::setScheduler(int)
KDEsuClient::exec(QByteArray const&, QByteArray const&, QByteArray
const&, QList<QByteArray> const&)
KDEsuClient::ping()
KDEsuClient::setPass(char const*, int)
KDEsuClient::exitCode()
KDEsuClient::KDEsuClient()
KDEsuClient::~KDEsuClient()
StubProcess::setPriority(int)
SuProcess::checkNeedPassword()
SuProcess::exec(char const*, int)
SuProcess::SuProcess(QByteArray const&, QByteArray const&)
SuProcess::~SuProcess()
SuProcess::checkInstall(char const*)
symbol QDataStream& operator>><QString, QVariant>(QDataStream&,
QMap<QString, QVariant>&)used from dynamic library
/opt/kde4/lib/libkio.dylib(single module) not from earlier dynamic
library /opt/kde4/lib/libkdecore.dylib.5(single module)
symbol QDataStream& operator<< <QString, QVariant>(QDataStream&,
QMap<QString, QVariant> const&)used from dynamic library
/opt/kde4/lib/libkio.dylib(single module) not from earlier dynamic
library /opt/kde4/lib/libkdecore.dylib.5(single module)
collect2: ld returned 1 exit status
make[2]: *** [kdesu/kdesu/kdesu.app/Contents/MacOS/kdesu] Error 1
make[1]: *** [kdesu/kdesu/CMakeFiles/kdesu.dir/all] Error 2
make: *** [all] Error 2
---(snip!)---

If I add "-lkdesu" to the end of the link line, it builds.  Is
something getting confused by linking against an out-of-tree (in
/opt/kde4 from a "make install" in kdelibs) library named the same as
the binary?  Or is this some other kind of cmake bug?

This is cmake CVS as of a few hours ago.


More information about the Kde-buildsystem mailing list