Friday, October 4, 2019

Digest for comp.lang.c++@googlegroups.com - 25 updates in 5 topics

Hergen Lehmann <hlehmann.expires.5-11@snafu.de>: Oct 04 11:27AM +0200

Am 04.10.19 um 10:49 schrieb David Brown:
 
> embedded target would use all *.c *.cpp files in the "common" and
> "embedded" directories, while a simulator build would use all files in
> the "common" and "simulator" directories.
 
That's again a bill of materials, just with directory names instead of
file names. Not much different...
 
> There is no one solution that fits all projects, of course.
 
I can agree to that.
Paavo Helde <myfirstname@osa.pri.ee>: Oct 04 12:36PM +0300

On 4.10.2019 10:45, Hergen Lehmann wrote:
 
> In any non-trivial project, you will quickly run into a state, where you
> actually NEED to use the makefile as a "bill of materials" rather than
> throwing in every file there is.
 
This is just making the life complicated for anyone trying to compile
your code, in particular on those different OS platforms, and in
particular for those who would prefer to use some other build system.
 
The solution is simple: each source file which is to be conditionally
compiled, e.g. on Mac only, should look like this:
 
#include "myconfig.h" // defines HAVE_DARWIN and other such macros
#ifdef HAVE_DARWIN
#import <Foundation/NSProcessInfo.h>
// ... rest of Mac specific code

No comments: