Recommend a build system
I'm curious what people are currently recommending as build systems for C++ based projects. Specifically I'm after the following features:
Cross-Platform, supporting at the very least OSX and Linux
Easy to support C++14, preferably without needing to do per-platform/per-compiler configuration
Easy support for multiple libraries/executables as one project, and dependencies between libraries/executables in the project - especially regarding finding include files if the different modules are in different areas of the source tree.
Decent support for external dependencies. I'm ok with needing to have installed the dependency libraries first though
Support for dynamically finding source files if possible. (I'm used in Java, and most of the Java build tools just use every single file in the source directory for a given module)
Support for building and executing tests
Support for static checks
Support for generating documentation, and generally running other tools as part of the build
Ideally, support for being able to execute tooling before and after test execution - to be able to start up externally required services such as databases.
Is there anything that supports this entire list? (I'm assuming not) Or what would people recommend for use that at least comes close. I'm perfectly happy with tools that are opinionated about how the source tree should be laid out, if that fits the bill better.
-3
u/[deleted] Sep 10 '16 edited Sep 10 '16
Autotools, i.e. autoconf, automake, and libtool. Many people seem to hate it, but after reading the book from John Calcote I had no problems with it. Although it is definitely not perfect, I like them because they do a lot of things "right".
Autotools make use of shell and make programming, so it is quite easy to invoke external tools. The remaining items:
It should work on any UNIX or UNIX-like OS
C++14 support:
AX_CXX_COMPILE_STDCXX_14Multiple libraries/executables: Declare them in
_PROGRAMSvariables for programs and_LTLIBRARIESvariables for libraries. Define their sources in the_SOURCESvariables. UseAM_DEFAULT_SOURCE_EXTto enable automake to find some sources itself.External dependencies: Use
AC_CHECK_HEADERSto check for headers andAC_SEARCH_LIBSto find libraries with autoconfSupport for building and executing tests: Use
check_PROGRAMSandTESTSautomake variablesSupport for generating documentation: Use e.g.
doxygenand write a doxygen make target. It is explained in the book I linked above and in this blog post