I have added this to some of my qt5 projects and it worked: add_definitions(-fPIC)
2013/10/9 Sebastian Kügler <se...@kde.org>: > Hi, > > While porting libnm-qt to Qt5, I'm running into the following problem when > building the tests. I've not seen this error before, and I'd like advice how > to fix it. > > [ 59%] Building CXX object > tests/CMakeFiles/test_8021xsetting.dir/8021xsetting.cpp.o > In file included from /home/sebas/kf5/qt5/qtbase/include/QtCore/qglobal.h:1:0, > from > /home/sebas/kf5/qt5/qtbase/include/QtCore/../../src/corelib/global/qnamespace.h:45, > from > /home/sebas/kf5/qt5/qtbase/include/QtCore/qnamespace.h:1, > from > /home/sebas/kf5/qt5/qtbase/include/QtCore/../../src/corelib/kernel/qobjectdefs.h:45, > from > /home/sebas/kf5/qt5/qtbase/include/QtCore/qobjectdefs.h:1, > from > /home/sebas/kf5/qt5/qtbase/include/QtCore/../../src/corelib/kernel/qobject.h:48, > from /home/sebas/kf5/qt5/qtbase/include/QtCore/qobject.h:1, > from /home/sebas/kf5/qt5/qtbase/include/QtCore/QObject:1, > from /home/sebas/kf5/src/libnm-qt/tests/8021xsetting.h:24, > from /home/sebas/kf5/src/libnm-qt/tests/8021xsetting.cpp:21: > /home/sebas/kf5/qt5/qtbase/include/QtCore/../../src/corelib/global/qglobal.h:991:4: > error: #error "You must build your code with position independent code if Qt > was built with -reduce-relocations. " "Compile your code with -fPIC or -fPIE." > make[2]: *** [tests/CMakeFiles/test_8021xsetting.dir/8021xsetting.cpp.o] Error > 1 > > This error comes up for a whole slew of tests. I've tried adding "-fpie" and > "PIE" to the CMAKE_EXE_LINKER_FLAGS (also tried CMAKE_LIBRARY_LINKER_FLAGS) by > just setting this variable, but to no avail. The rest of libnm-qt builds fine. > > Could anyone give me a hint how to fix this? > > Code is in the qt5 branch of libnm-qt. > > Cheers, > -- > sebas > > http://www.kde.org | http://vizZzion.org | GPG Key ID: 9119 0EF9 > _______________________________________________ > Kde-hardware-devel mailing list > Kde-hardware-devel@kde.org > https://mail.kde.org/mailman/listinfo/kde-hardware-devel -- Daniel Nicoletti KDE Developer - http://dantti.wordpress.com _______________________________________________ Kde-hardware-devel mailing list Kde-hardware-devel@kde.org https://mail.kde.org/mailman/listinfo/kde-hardware-devel