I am working with a relatively old code base which has a lot of header files with duplicate names. For example:
dir
↪ subdir1
↪ header1.h
↪ header2.h
↪ subdir2
↪ header2.h
For reasons I won't get into here, this structure must remain as-is. I am looking for a way to build/install these headers in such a way that:
for all headers:
if header in subdir2: use it
else: use header from subdir1
From my example, this would mean I use subdir1/header1.h and subdir2/header2.h, while ignoreing subdir1/header2.h completely.
I wrote some functions to handle this in my cmake files (basically following the pseudo-code provided above), but they are sloppy. I am looking for a built-in way to handle this type of thing, rather then DIY bandaids.