2

We have some libraries written in Visual Studio that we would like to share with other projects in different solutions in different repos.

I liked the idea of using an internal vcpkg registry to distribute those libraries to those other solutions/projects.

My concern here is that the libraries we'd like to share are vcxproj projects, and I believe vcpkg requires "ports" (packages) to be Cmake projects.

Is my understanding correct? If we want to expose those libraries via an internal vcpkg registry we'd have to convert those projects to Cmake projects?

WBuck
  • 5,162
  • 2
  • 25
  • 36
  • 1
    vcpkg _prefers_ CMake, but there's nothing stopping you from writing just enough CMake (in the vcpkg portfile) to wrap your build. Certainly not all of their ports have CMake builds. – Alex Reinking Apr 28 '22 at 19:05

1 Answers1

1

Vcpkg has built-in support for wrapping MSBuild (ie. sln/vcxproj) projects. See the function vcpkg_install_msbuild

Many projects still use the deprecated vcpkg_build_msbuild, though. Using git grep I can find a few portfiles that will work as examples:

Alex Reinking
  • 16,724
  • 5
  • 52
  • 86
  • OK, this is really promising. I didn't think there would be a chance in hell that I could convince the rest of the team to use Cmake for projects that we wanted to share via the internal registry. – WBuck Apr 28 '22 at 19:18
  • 1
    So it looks like `vcpkg_build_msbuild` was replaced by [vcpkg_install_msbuild](https://github.com/microsoft/vcpkg/blob/master/docs/maintainers/vcpkg_install_msbuild.md). Functionality appears to be the same though. – WBuck Apr 28 '22 at 19:20
  • @WBuck - thanks for catching that! I improved my answer. – Alex Reinking Apr 28 '22 at 20:35
  • Be aware that the MSBuild scripts lack setup of compiler flags from the toolchain – Alexander Neumann Apr 29 '22 at 13:17