Trick-17 / clang-build

Clang-based cross platform build system written in Python
https://clang-build.readthedocs.io
MIT License
8 stars 3 forks source link

More granular inheritance of flags #66

Closed GPMueller closed 6 years ago

GPMueller commented 6 years ago

As far as I know, currently, when we link a library its include paths are placed in the dependent compile flags and its output directory and its output (archive or shared object) are placed into the dependent link flags.

However (see also https://stackoverflow.com/a/31981843/4069571), there are cases where the dependent target should

I believe our default is sensible (corresponding to CMake PRIVATE flags. We could add two subcategories to the flags keyword:

[mylib.flags]
compile = ["-DSOMETHING_PRIVATE"]
[mylib.flags.public]
compile = ["-DSOMETHING_PUBLIC"]
[mylib.flags.interface]
link = ["-lOpenGL"]

However, maybe we can think of a better name than interface... It's not obvious what that is supposed to mean.

GPMueller commented 6 years ago

Implemented with 2d54e0a5ff0dbd391b4112634cd2cecc4e1ab6df on feature-improved-config.

GPMueller commented 6 years ago

Added public-include-directories with ff0cfe4cb293c8b8e4a81781ea34ba84e228827b. Maybe we can think up something better or more intuitive, but it's definitely necessary to distinguish between include directories, which should or should not be inherited by dependent targets. If it exists, the include directory of a target folder is automatically public.