[CMake] Compiling without linking

Dizzy dizzy at roedu.net
Wed Oct 3 09:52:55 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).

If you want to reproduce what cmake does just use "make source.o VERBOSE=1", 
notice the compilation command and do the same.

-- 
Mihai RUSU					Email: dizzy at roedu.net
			"Linux is obsolete" -- AST


More information about the CMake mailing list