Skip to content

Specifying options for dependencies #6127

Answered by waruqi
davidchisnall asked this question in Q&A
Discussion options

You must be logged in to vote

I still don't quite understand your question and requirements, but if my previous understanding is correct, it is not a good practice to modify the configuration in the dependent target by the parent target.

Of course, if you really want to do this, you can do everything in the script scope, there is no need to use option, it is global.

option("ipv6", {default = false})

target("tcpip")
    if has_config("ipv6") then
        set_values("properties.ipv6", true)
    end
    on_config(function (target)
        if target:values("properties.ipv6") then
            add_defines("IPV6_ENABLE=1")
        end
    end)

target("myProgram")
    add_deps("tcpip")
    on_load(function (target)
        t…

Replies: 1 comment 17 replies

Comment options

You must be logged in to vote
17 replies
@waruqi
Comment options

@davidchisnall
Comment options

@davidchisnall
Comment options

@waruqi
Comment options

Answer selected by davidchisnall
@davidchisnall
Comment options

@davidchisnall
Comment options

@waruqi
Comment options

@davidchisnall
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants