Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add includes and links from target deps automatically #87

Closed
waruqi opened this issue May 12, 2017 · 3 comments
Closed

Add includes and links from target deps automatically #87

waruqi opened this issue May 12, 2017 · 3 comments
Milestone

Comments

@waruqi
Copy link
Member

waruqi commented May 12, 2017

xmake (dev) will add includedirs, links, linkdirs and rpathdirs to target automatically if it's target deps is static/shared library.

Before:

target("library1")
    set_kind("static")
    add_files("*.c")
    add_headers("inc1/*.h")

target("library2")
    set_kind("static")
    add_deps("library1")
    add_files("*.c")
    add_headers("inc2/*.h")
    add_includes("$(buildir)/inc1")

target("test")
    set_kind("binary")
    add_deps("library2")
    add_includes("$(buildirs)/inc2")
    add_links("library2", "library1")
    add_linkdirs("$(buildir)")

Now:

target("library1")
    set_kind("static")
    add_files("*.c")
    add_headers("inc1/*.h")

target("library2")
    set_kind("static")
    add_deps("library1")
    add_files("*.c")
    add_headers("inc2/*.h")

target("test")
    set_kind("binary")
    add_deps("library2")
@ghost
Copy link

ghost commented May 12, 2017

This makes me recall Cascading Style Sheets 👍

But, better to have a way to let users disable inheriting. To use or not use a feature should be decided by users

*{all:initial;}

@waruqi
Copy link
Member Author

waruqi commented May 12, 2017

@titansnow ok, I will consider it

@waruqi waruqi added this to the v2.1.5 milestone Jun 3, 2017
@waruqi waruqi closed this as completed Aug 2, 2017
@waruqi
Copy link
Member Author

waruqi commented Aug 16, 2017

We can also set inherit attribute to disable the default inheritance behavior in v2.1.6

add_deps("dep1", "dep2", {inherit = false})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant