add_library NO_PREFIX

Alexander Neundorf neundorf at kde.org
Thu Nov 29 08:36:33 UTC 2012


On Thursday 29 November 2012, David Faure wrote:
> On Thursday 29 November 2012 09:08:05 Alexander Neundorf wrote:
> > In KDE4 we do it this way because we did it this way in KDE3. ;-)
> > Personally I don't care much whether plugins have a "lib" prefix or not.
> > Not having the "lib" prefix can be interpreted as a hint that this file
> > is not a normal shared library.
> > Technically it shouldn't matter I think.
> 
> It's more than a hint, it's a strong guarantee, that nobody will ever
> succeed in linking to a plugin as if it was a shared lib.

At least it is possible:
~/src/test/$ g++  main.cpp  /usr/lib/audacious/Output/filewriter.so -o test
~/src/test/$ ldd test
        linux-gate.so.1 =>  (0xffffe000)
        /usr/lib/audacious/Output/filewriter.so (0xb76eb000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb75da000)
        libm.so.6 => /lib/libm.so.6 (0xb75b4000)
        libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0xb7598000)
        libc.so.6 => /lib/libc.so.6 (0xb7434000)
        libaudcore.so.1 => /usr/lib/libaudcore.so.1 (0xb7423000)
        libaudgui.so.1 => /usr/lib/libaudgui.so.1 (0xb73f6000)
        libgtk-x11-2.0.so.0 => /usr/lib/libgtk-x11-2.0.so.0 (0xb7024000)
...

> 
> > I just had a look at the gimp plugin dir, those seem to be executables
> > (no prefix, no suffix, and they say "compose is a GIMP plug-in and must
> > be run by GIMP to be used" when executed.
> 
> Unusual :)
> 
> At least that makes the lookup cross-platform, without having to mess with
> extensions.

Maybe they are .exe's on Windows...
 
> > The following packages installed on my system use plugins without "lib"
> > prefix: ghostscript, audacious, slang, zsh, gegl, gconv, egl, pango.
> > 
> > The only plugins I found which clearly seemed to be plugins and not
> > shared libs which have the "lib" prefix are from CodeBlocks.
> > 
> > So at least it seems to be quite common to have no prefix for plugins.
> 
> Right.

Simply changing the default in cmake is probably not possible, since this 
would break projects which expect to have the "lib" prefix in their plguins.

But e.g. by introducing a new cmake policy (e.g. CMP0020: do not set a prefix 
for MODULE libraries) this should be possible.
So whoever says 
cmake_minimum_required(VERSION 2.8.11)
would automatically get this policy activated, and the modules wouldn't have 
the prefix anymore. This is usually acceptable behaviour for cmake since 
stating "I need cmake 2.8.11" is interpreted to imply that this users knows 
what he is doing and that he explicitely asked for the behaviour as it is in 
2.8.11.

Alex


More information about the Kde-buildsystem mailing list