[CMake] add_library without source code

Alexander Neundorf a.neundorf-work at gmx.net
Tue Jul 27 14:01:42 EDT 2010


On Tuesday 27 July 2010, Matthias Gwein wrote:
> Hello!
>
> I'm using cmake 2.8.2 and I'd like to build a library of libraries and
> i have no additional source code.
> I tried something like that:
>
> add_library(mylib )
> target_link_libraries(mylib lib1 lib2)
>
> But that doesn't work, because add_library needs at least a source file.
>
> Is there any way to get that work, without creating a dummy source file?

AFAIK no.
If you want, you can create that dummy file e.g. with file(WRITE ...), so it 
doesn't have to go into version control.

lib1 and lib2 are shared libs, right ?

Alex


More information about the CMake mailing list