Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to force qmake not to create symbolic links to target when TEMPLATE=lib?

Tags:

linux

qt

qt4

qmake

I have a (partial) qmake project file like this:

TEMPLATE=lib
TARGET=whatever
SOURCES=whatever.cpp
HEADERS=whatever.h

This will - atleast by default - create a library and few symbolic links like this:

libwhatever.so -> libwhatever.so.0.1.0
libwhatever.so.0 -> libwhatever.so.0.1.0
libwhatever.so.0.1 -> libwhatever.so.0.1.0
libwhatever.so.0.1.0

libwhatever.so.0.1.0 is the actual library binary, the rest of them are just symbolic links.

What i would like to achieve is that no symbolic links are created at all or the order what be other way around so that libwhatever.so would be the actual binary and rest are the symbolic links.

like image 431
rasjani Avatar asked Jul 02 '09 12:07

rasjani


4 Answers

You can add below to your pro file:

CONFIG += unversioned_libname unversioned_soname

I have tested succeed.

like image 142
Hellomap Avatar answered Nov 30 '22 10:11

Hellomap


If you override the QMAKE_LN_SHLIB variable with a no-op, it will not make the symbolic links.

QMAKE_LN_SHLIB       = :
like image 39
swarfrat Avatar answered Nov 30 '22 12:11

swarfrat


I tried to suggestion posted by swarfrat and it works but it outputs an error with a (rather helpful) message:

Error 1 (ignored)

So, here is another way of deleting the symlinks without generating any errors:

unix: QMAKE_POST_LINK = find $$DESTDIR -maxdepth 1 -type l -exec rm -f {} \;

More information about this qmake variable can be found here.

like image 44
metator Avatar answered Nov 30 '22 10:11

metator


I studied the qmake sources and the mkspecs, but it seems that the generation of the symbolic links is rather hardwired.

From what I found in the sources, it seems that if you add plugin to CONFIG, only the library will be generated, without the symbolic links.

I can't tell you if doing so has any other side effects, though. But it seems to be the only way to get rid of the symbolic links without having to write a script that runs after building.

like image 24
BastiBen Avatar answered Nov 30 '22 10:11

BastiBen