Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

getting vcpkg to build only release version

Tags:

cmake

vcpkg

I'm trying to build only the release version of packages because creating debug versions takes too long / too much space. Vcpkg docs state that:

Adding set(VCPKG_BUILD_TYPE release) in a triplet: will cause most ports to only build release

In terminal when I run set(VCPKG_BUILD_TYPE release) I get

syntax error near unexpected token 'VCPKG_BUILD_TYPE'

How do I fix this?

like image 527
Carl Avatar asked Sep 30 '18 14:09

Carl


People also ask

How do I find vcpkg version?

builtin-baseline This field declares the versioning baseline for all ports. Setting a baseline is required to enable versioning, otherwise you will get the current versions on the ports directory. You can run 'git rev-parse HEAD' to get the current commit of vcpkg and set it as the builtin-baseline.

How to use vcpkg in CMake?

The best way to use installed libraries with cmake is via the toolchain file scripts\buildsystems\vcpkg. cmake . To use this file, you simply need to add it onto your CMake command line as: -DCMAKE_TOOLCHAIN_FILE=D:\src\vcpkg\scripts\buildsystems\vcpkg.


1 Answers

You probably need to set it in your triplet file. Make a copy and rename one of those default triplet files, say "x64-windows.cmake" to "x64-windows-rel.cmake". Then add a line so that:

 
set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE dynamic)
set(VCPKG_BUILD_TYPE release)

I think this will work on some libraries but not all, as it requires the libraries' own build files (CMakeLists.txt) to deal with it.

like image 72
kjpus Avatar answered Sep 28 '22 00:09

kjpus