[CMake] Compiling without linking

Baptiste Derongs baptiste.derongs at etu.utc.fr
Thu Oct 4 04:24:45 EDT 2007


> On Wednesday 03 October 2007 16:27:14 Baptiste Derongs wrote:
> > Hello all,
> >
> > I just begin in using Cmake (but I'm going faster than I never went
> > with any configure.in), and I am wondering how to get a '.o' file (how
> > to call gcc -c in fact).
> >
> > I tried to set CMAKE_C_FLAGS to "-c", it kind of worked, but it doest
> > seem very generic
> >
> > Is there any better solution ?
>
> For each source file (say named source.c) cmake creates a source.o makefile
> target. So just do make source.o inside the build directory of the
> corresponding source file (and some people where wondering quite recently on
> this mailing list why are those targets useful at all hehe).

The point is that I want a MakeFile that creates only the .o file,
doesnt try to get binary. Next that same Makefile (and other ones)
need the .o file to make other binaries.

By the solution I wrote, cmake told the Makefile to create .o files,
but it saves them in CMakeFiles dir, I dont know where I can tell to
save in obj/ directory...


More information about the CMake mailing list