1

I would like to use CMake to build my own libraries executables. I have installed both dynamic and static x64 versions of 3rd party libraries like boost. When I compile my own projects with cmake I can't get it to use the static versions. Here is my setup:

  • cmake 3.18.1
  • vcpkg pulled from master branch (Aug 11, 2020)
  • Visual Studio 2019 16.6.1.0
  • Running in a docker container with Windows Server Core 2019

When I just do cmake .. and cmake --build . it defaults to x64-windows as expected. I have one 3rd party library that only exist as a static library (x64-windows-static) so then I try this: cmake .. "-DVCPKG_TARGET_TRIPLET=x64-windows-static" "-DCMAKE_TOOLCHAIN_FILE=C:/Tools/vcpkg/scripts/buildsystems/vcpkg.cmake" according to other posts. I have done different experiments and versions of these commands and the result is either:

  • vcpkg is not enabled
  • using x64-windows

But never "using x64-windows-static" which is what I want. I just can't make this to work. I have tried to set environment variables or adding the commands to the cmake files as well. But the result is the same, it refuses to use the "x64-windows-static" triplet. All third party libraries that I have used, have been compiled and installed properly with both versions.

Any ideas what I do wrong?

Niklas
  • 11
  • 2
  • Did you clean the cmake cache when switching triplets and adding the toolchain? Are you using the VS integration? Do you use CMake to generate a VS project? – Alexander Neumann Aug 29 '20 at 21:35
  • I think the issue is solved now. I updated both cmake and Vcpkg and it started working. I then reverted to older version and the issue was back. Not sure which update made the trick or if it was a combination of both. I also made the mistake of thinking that my non Vcpkg projects would use the Vcpkg architecture and link settings so that also got me confused. Thanks! – Niklas Aug 31 '20 at 05:49

0 Answers0