How do I use nested vcpkg manifests in submodules/sub-projects? #18122
Replies: 11 comments 9 replies
-
Thanks for posting this issue. You might forget to add Could you please refer to the usage of
|
Beta Was this translation helpful? Give feedback.
-
Please let me know if the above suggestion can work for you. |
Beta Was this translation helpful? Give feedback.
-
@NancyLi1013
In my case, Frozen is a dep of the It is only when the I also noticed something else particular. The |
Beta Was this translation helpful? Give feedback.
-
@mikepricedev, does this still be a question for you? From manifests.md, when invoked from any subdirectory of the directory containing vcpkg.json, vcpkg install with no package arguments will install all manifest dependencies into /vcpkg_installed/. |
Beta Was this translation helpful? Give feedback.
-
I'm running into this problem too.. But I'm relying on visual studio 2019 cmake support to use vcpkg. It seems to be ignoring the sub directory/sub directory. Is there support for add_subdirectory and sub directories with their own vcpkg.json? (And just using the main project without opening separate visual studio 2019 instances with their own cmakelists.txt). |
Beta Was this translation helpful? Give feedback.
-
@cyraid there is currently no support for having multiple top level manifests. We have considered some ways to solve this, but none of them very good. If you're interested in solving this issue, please open a discussion topic about it. Otherwise, writing a top-level vcpkg.json that contains all of the dependencies your subdirectories need, or alternatively using vcpkg to manage these dependencies as well, are the two solutions we see right now. |
Beta Was this translation helpful? Give feedback.
-
Hi @strega-nil ! Thank you for the reply! Where would you guys like to discuss this? I mean, I don't have much time to talk about it but my quick input would be to add a ADD_TARGET_VCPKG in the sub directory inside that CMakeLists.txt. So, ADD_LIBRARY(MyPlugin), and then ADD_TARGET_VCPKG(MyPlugin). This way you could add the appropriate includes and properties etc. for that target. This would of course also call vcpkg in that directory too, but perhaps with the same cache directory and out from CMakeSettings.json? |
Beta Was this translation helpful? Give feedback.
-
We'd also like to have nested We have many projects in a small monorepo. Some of the projects require some larger dependencies (OpenCV, Qt), while some only requires header only libraries. The projects can be added/excluded from the solution by CMake option toggles. It would be nice to only acquire/build, say Qt and OpenCV, if the projects that uses those dependencies are being configured and built. |
Beta Was this translation helpful? Give feedback.
-
Vcpkg doesn't support separate |
Beta Was this translation helpful? Give feedback.
-
CMakePresets.json uses an include section to solve this issue.
Could that be an option to solve the issue for vcpkg.json too ? |
Beta Was this translation helpful? Give feedback.
-
In the above folder structure the "sub_project" submodule uses vcpkg and a vcpkg.json manifest to manage its deps. The root project also uses vcpkg and a vcpkg.json manifest to manage deps.
However, when the project is configured the sub_project's CMakeLists.txt vcpkg wiring no longer finds packages installed in
sub_project/vcpkg_installed
dir.Steps taken:
vcpkg install
ran insub_project
dir.vcpkg_installed
dir was created as expected.find_package
in submodule cmake. (in my case using the frozen lib)'frozen/map.h' file not found #include <frozen/map.h>
not an issue in sub_project standalone.Note: using vcpkg as a submodule technique in both i.e.
Beta Was this translation helpful? Give feedback.
All reactions