LWN.net Logo

Advertisement

Front, Kernel, Security, Distributions, Development. See your byline here on LWN.net.

Advertise here

LCA: Disintermediating distributions

LCA: Disintermediating distributions

Posted Feb 7, 2008 22:38 UTC (Thu) by aleXXX (subscriber, #2742)
In reply to: LCA: Disintermediating distributions by stevenj
Parent article: LCA: Disintermediating distributions

I agree, but not completely.

Having students write makefiles like:

foo: main.c foo.c
    gcc -Wall -O2 main.c foo.c -o foo

is ok, splitting this into separate rules for compiling and linking may 
still be ok. Actually I think it is a good thing if they learn how 
makefiles work.
But this is only acceptable for very simple projects (maybe I have become 
lazy). The next step from that to autotools is huge IMO. The step to 
cmake is small:

add_library(foolib SHARED foo.c bar.c)
add_executable(hello main.c)
target_link_libraries(hello foolib)

install(TARGETS hello DESTINATION bin)
install(TARGETS foolib DESTINATION lib)
install(FILES foo.h DESTINATION include)

I really think this is doable. I'd say that this is understandable even 
without reading documentation. 
It works on all platforms, including the shared lib. It creates MSVC 
projects if you want it, or Eclipse projects if you want that. It builds 
also out-of-source. It gives you complete targets: all, foolib, hello, 
install, clean, help (!), foo.o, foo.s, foo.E (!).
The good thing is basic things are very simple with cmake, and building 
on that you can add functionality/required configure checks one by one 
(not students, but if somebody actually wants to have the software 
portable).

Alex


(Log in to post comments)

Copyright © 2012, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds