Skip to content

Commit d342580

Browse files
committed
improve CMake build to detect global vcpkg install and to include vcpkg scripts in CPAC archive
1 parent 4b0d2c2 commit d342580

3 files changed

Lines changed: 8 additions & 2 deletions

File tree

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ elseif(APPLE)
88
else()
99
set(VCPKG_TARGET_TRIPLET "x64-linux" CACHE STRING "Vcpkg triplet")
1010
endif()
11+
if("$ENV{VCPKG_ROOT}" STREQUAL "")
12+
set(VCPKG_ROOT_TMP "${sourceDir}/vcpkg/bin")
13+
else()
14+
set(VCPKG_ROOT_TMP "$ENV{VCPKG_ROOT}")
15+
endif()
16+
set(VCPKG_ROOT_ACTIVE "${VCPKG_ROOT_TMP}" CACHE STRING "Configured VCPKG root to find toolchain")
1117

1218
project(${_name} VERSION ${_version})
1319
option(ENABLE_FRONTEND_API "Use obs-frontend-api for UI functionality" OFF)

CMakePresets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
{
1010
"name": "template",
1111
"hidden": true,
12-
"toolchainFile": "vcpkg/bin/scripts/buildsystems/vcpkg.cmake",
12+
"toolchainFile": "$env{VCPKG_ROOT_ACTIVE}/scripts/buildsystems/vcpkg.cmake",
1313
"cacheVariables": {
1414
"ENABLE_FRONTEND_API": true,
1515
"ENABLE_QT": true,

cmake/linux/defaults.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ set(
3838
build_.*
3939
cmake/\\.CMakeBuildNumber
4040
release/
41-
vcpkg/
41+
vcpkg/bin/
4242
)
4343

4444
set(CPACK_VERBATIM_VARIABLES YES)

0 commit comments

Comments
 (0)