[CMake] Static Modules

Markus Raab usenet at markus-raab.org
Fri Mar 12 05:42:14 EST 2010


Hello!

Michael Wild wrote:
> IMHO it would be simpler and safer to have a function which collects all
> the file names, adds them to a global property and then allows you to
> compile a static library from that. E.g (completely untested):

Yeah, you are right, this approach sounds much better.

But there is still a small missing piece. Modules have at least one entry
point (or symbol) which is the same, so that they can be loaded.

This is perfectly ok for modules, but raises a problem when you want to link
them together statically.

Elektra has solved this issue by having defined:
#ifdef ELEKTRA_STATIC
        #define KDBEXPORT(module) KDB
*libelektra_##module##_LTX_kdbBackendFactory(void)      
#else
        #define KDBEXPORT(module) KDB *kdbBackendFactory(void)
#endif

and Modules use
KDBEXPORT(modulename)
{
        return kdbBackendExport(BACKENDNAME, ...
}

to export this symbol which changes for the module and static case.


Which is the cmake way to solve this issue?

thank you
Markus


-- 
http://www.markus-raab.org | I can't believe that life's so complex,
                      -o)  | when I just want to sit here and watch you 
Kernel 2.6.24-1-a      /\  | undress   
on a x86_64           _\_v | 



More information about the CMake mailing list