Skip to content

default-features of port always used in another port dependency  #20925

@Azrod-afk

Description

@Azrod-afk

Describe the bug

I have a port with default-features :

{
  "name": "foo",
  "version": "1.1.2.2",
  "description": "Foo lib",
  "dependencies": [],
  "default-features": ["json", "protobuf"]
  "features": {
    "json": {
      "description": "Activate json support",
      "dependencies": [
        "jsoncpp"
      ]
    },
    "protobuf": {
      "description": "Activate protobuf support",
      "dependencies": [
        "protobuf"
      ]
    }
  }
}

I have another port that will use this port but only a specific feature :

{
  "name": "bar",
  "version": "13.4.0.1",
  "description": "Bar library",
  "dependencies": [],
  "default-features": ["foo"],
  "features": {
    "foo": {
      "description": "Use Foo library to support json",
      "dependencies": [
        {
          "name": "foo",
          "default-features": off,
          "features": [
            "json"
          ]
        }
      ]
    }
  }
}

When i want to fetch bar library, vcpkg fetch foo library with default-features (json and protobuf).
It's not correct because i specified that i don't want default features of foo library.

{
  "name": "myapp",
  "version": "1.4.3.127",
  "description": "Amazing application",
  "dependencies": [
    "bar"
  ]
}

vcpkg output:

The following packages will be rebuilt:
jsoncpp[core]:x64-linux-dynamic -> XXX -- /home/azrod/.cache/XXX
protobuf[core]:x64-linux-dynamic -> XXX -- /home/azrod/.cache/XXX
foo[core, json, protobuf]:x64-linux-dynamic -> 1.1.2.2 -- /home/azrod/.cache/XXX
bar[core, foo]:x64-linux-dynamic -> 13.4.0.1 -- /home/azrod/.cache/XXX

Environment

  • OS: Centos 7.9 x64
  • Compiler: g++ (GCC) 9.3.1 20200408 (Red Hat 9.3.1-2)
  • CMake: cmake version 3.20.3

To Reproduce
Steps to reproduce the behavior:
With all ports defined in a local registry :

  1. ./vcpkg install bar

output:
protobuf[core]:x64-linux-dynamic -> XXX -- /home/azrod/.cache/XXX
foo[core, json, protobuf]:x64-linux-dynamic -> 1.1.2.2 -- /home/azrod/.cache/XXX

protobuf feature of foo library is activate but bar library explicitly set default-features: off when fetching foo port

Expected behavior
Only json feature of foo library is activated when fetching bar port

Failure logs
We don't have error logs but it fetch unused port

Additional context
I use vcpkg with Cmake integration so i use cmake toolchain to be plugged in directly in cmake

Metadata

Metadata

Assignees

Labels

category:vcpkg-featureThe issue is a new capability of the tool that doesn’t already exist and we haven’t committed

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions