[CMake] Compile only, no link

Alexander Neundorf a.neundorf-work at gmx.net
Thu Feb 28 18:31:03 EST 2008


On Wednesday 27 February 2008, jean-daniel.michaud at uk.bnpparibas.com wrote:
> Hello,
>
>   I'd like to know if it's possible to create a project, add source files
> to it, make those sources compile to objects, but do not create any
> executable or library.
>   Something like:
>
> PROJECT(someproject)
> ADD_SOURCE_FILE(this.cpp that.cpp)
> # define some c flags here
> COMPILE_SOURCE
>
>   And after the make, I would end up with this.o and that.o, but no
> executable.
>   I can't use custom command, because, I'd like the CMakeFiles to produce
> some proper IDE project files, with the source files in it.
>   Can't find anything in the mailing list or doc to do this trivial thing.

You could build a static library, which is basically just a container for 
object files. Would that help ?

Alex


More information about the CMake mailing list