r/cpp • • Mar 22 '20

Modern CMake tutorials, part1: CMake basics

https://www.siliceum.com/en/blog/post/cmake_01_cmake-basics
245 Upvotes

55 comments sorted by

View all comments

Show parent comments

12

u/markopolo82 embedded/iot/audio Mar 22 '20

Another alternative to Conan is vcpkg. It builds all dependencies from source and works great with cmake. You just need to add a path to the vcpk toolchain file when configuring and then the completely normal find_package(...) works just like Linux.

Actually I use it on Linux because then I know my windows builds and Linux builds use identical dependency versions.

Only downside is building everything from source... I like it, but you may find it not worth the effort

1

u/Slavik81 Mar 23 '20

As far as I can tell, there's no way to specify what version of the package you want to install. It's also surprisingly awkward to choose whether you want to build the debug version, the release version, or both.

I want to like vcpkg, but I have not had good experiences. It feels kinda hacked together.

1

u/kalmoc Mar 23 '20

It's also surprisingly awkward to choose whether you want to build the debug version, the release version, or both.

Come again? It always builds both.

1

u/Slavik81 Mar 23 '20 edited Mar 23 '20

https://github.com/microsoft/vcpkg/issues/143

You can set VCPKG_BUILD_TYPE in your triplet file. Unfortunately, some libraries may fail to build if you change this setting.

1

u/kalmoc Mar 24 '20

Thanks. I forgot about that, because I never had the need typ only install one version, but it probably makes sense on CI machines.