getting vcpkg to build only release version
Asked Answered
U

1

6

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?

Unexceptional answered 30/9, 2018 at 14:47 Comment(0)
H
12

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.

Horseback answered 12/10, 2018 at 14:35 Comment(4)
Could it also be set on the command prompt before running vcpkg.exe? set VCPKG_BUILD_TYPE=release?Meteorology
I don't think so. A quick search in vcpkg seems to suggest it doesn't check VCPKG_BUILD_TYPE in environment variable.Horseback
Looks like VCPKG_BUILD_TYPE is not well supported. E.g., OpenCV's build fails if you set it since parts of the build scripts expect both release and debug are being built.Meteorology
What if I want to let system detect triplet itself, and set only VCPKG_BUILD_TYPE?Goth

© 2022 - 2024 — McMap. All rights reserved.