Re:Afraid of Makefiles? Don't be
by brian-armstrong on Friday August 18, 2017 @12:13AM
(#15043501)
Using Cmake is so much nicer than make, and it's deeply cross-platform. Cmake makes cross-compiling really easy, while with make you have to be careful and preserve flags correctly. Much nicer to just include a cmake module that sets up everything for you. Plus it can generate xcode and visual studio configs for you. Doing make by hand just seems unncessary.
[ Parent
| on HN ]
Re:Afraid of Makefiles? Don't be
by cbcoutinho on Friday August 18, 2017 @12:27AM
(#15043559)
I'm not sure why people compare cmake and make - cmake is essentially a makefile generator to handle automatic dependency tracking. You can even generate other types other types of build files (ninja, visual studio, etc). Not to just point your comment out because I see this all the time, but I don't understand where this confusion is coming from.
Re:Afraid of Makefiles? Don't be
by brian-armstrong on Friday August 18, 2017 @01:22AM
(#15043788)
Well, if anything, I think it demonstrates that Makefile is something that should be compiled, not written by hand
edit: and for context, this is usually what happens anyway, since autoconf does it too. it's hard to think of a major project with a manually edited Makefile
Re:Afraid of Makefiles? Don't be
by humanrebar on Friday August 18, 2017 @12:57AM
(#15043689)
> I'm not sure why people compare cmake and make
You can declare your project structure, metadata, and other build/install/test logic in either. They're thinking about their use cases, not the language and workflow used to achieve them.
I always felt that for small setups, makefiles are much more concise and easy to understand. And more generic.
Cmakefile.txt seems always really messy and introduce concepts such as project and exes and dlls. But of course Cmake is super-portable I know.
Is
project(my_software CXX)
add_library(my_lib foo.cpp bar.cpp)
target_include_directories(my_lib PUBLIC include/lib)
add_executable(my_app bluh.cpp)
target_link_libraries(my_app my_lib)
really more complicated than the equivalent makefile ? Especially given that:* this can generate ninja files instead of make
* it adds the common targets such as make help, make clean, make install
* dependency graphs can be generated with cmake --graphviz
* solutions for various IDEs
* etc...
Re:Afraid of Makefiles? Don't be
by brian-armstrong on Friday August 18, 2017 @01:21AM
(#15043785)
Every time I think this, I end up going back later and wishing I had just done Cmake. If you just want to compile all the .c files it's easy enough to GLOB and make a couple targets, then come back and make it more sophisticated later
Re:Afraid of Makefiles? Don't be
by everheardofc on Friday August 18, 2017 @03:28AM
(#15044248)
Except with make most small setups are at least 20-40 lines of nontrivial code becaue you have to redo everything from scratch
include std.mk
TARGET=foo
HFILES=bar.h
OFILES=main.o foo.o baz.o
include cmd.mk
This is what Makefiles tend to look like in some places.May I kindly plug my upcoming book [1] for writing CMake in an effective and straightforward manner :-)
I was just porting a large Makefile based build system over to CMake and had the 'pleasure' to find out why recursive Make really is the root of all evil and just doesn't scale well enough for large software systems. At least to my mind.