mcgoo / cargo-vcpkg

Get external dependencies in one step by specifying vcpkg details in Cargo.toml
Apache License 2.0
39 stars 6 forks source link

fixes(#23): ignore vcpkg config of crates dependencies #24

Open jonatino opened 5 months ago

kornelski commented 5 months ago

Are you sure parent() is a robust check? What about crates nested in subdirectories?

Cargo metadata has workspace_members array.

jonatino commented 5 months ago

@kornelski depends on what the intended behavior should be (I agree there could be a better alternative to parent()). Should cargo vcpkg build crawl to nested subdirectories and build those vcpkg's as well or just build inside the folder where the command is ran?

In my specific case with bug #23, sdl2 install was coming from a dependency of an optional dependency that was not even in use due to it targeting a different platform entirely.

I think the behavior of the tool is more predictable if the scope is limited to the current folder similar to how cargo build works. If you for some reason need to build a vcpkg for a dependency, it would make sense to add that to your vcpkg metadata config in the Cargo.toml file of the project that needs it. If cargo vcpkg build crawls the entire dependency tree, I can see it leading to a lot of unpredictable behavior such as my bug #23.