On 2020-05-10, pier paolo bruno <
pierp...@gmail.com> wrote:
> I tried Cmake but it seemed too me too complex.
Indeed. For a small project it's probably not a big deal, but I've seen
it used improperly, and the complexity grows fast.
In reality this applies to any build system. You should really be aware
of how dependencies work.
> At the end i found easier to write manually Makefiles directly, probably
> becouse i am used to them and not to CMake . Just for curiosity, for C
> programs , what build system do you use ? I started with bat/shells and
> ended to standard Makefile but perhaps it is not the right way to follow
A plain Makefile is often great. Just bear in mind that Make is not
intended as a way to check your dependencies, and if you find yourself in
doing so, you are doing it wrong.
Make it only meant as a way to compile a minimal set of files that need to
be compiled.
In fact, CMake is not an alternative to Make. CMake will generate
Makefiles (at least on Unix, on Windows it will generate whatever Windows
uses in place of Makefiles).
If you use pkg-config from within a Makefile you might be able to achieve
a very simple set of dependency checks without relying on anything big and
complex.
DEPS := libevent
CFLAGS += $(shell pkg-config --cflags $(DEPS))
LDADD += $(shell pkg-config --libs $(DEPS))
.PHONY : check_deps
check_deps:
pkg-config --exists $(DEPS)
Should you reach the point in which Make + pkg-config is not enough, I
would recommend GNU Autotools, which might be quite complex, but it is the
least evil.
Autotools is way easier to use nowadays than what it used to be. People
like to bitch about it, but in reality it is the only build system that
manages to produce proper dist packages that do not depend on the build
system. For instance, SCONS would depend on Python, and any Makefile
generated by CMake would force you to install CMake.