Skip to content

Clash with vcpkg exported package using a preset. #39

@adamryczkowski

Description

@adamryczkowski

Hi!

We have a project with large dependencies produced by vcpkg export. We use that with CMake presets, defined as

{
  "version": 3,
  "configurePresets": [
    {
      "name": "vcpkg",
      "cacheVariables": {
        "CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
        "VCPKG_MANIFEST_MODE": "true"
      }
    },
    {
      "name": "exported",
      "cacheVariables": {
        "CMAKE_TOOLCHAIN_FILE": "dep/scripts/buildsystems/vcpkg.cmake",
        "VCPKG_MANIFEST_MODE": "false"
      }
    }

  ]
}

We build with cmake .. --preset exported. Here's the CMakeLists.txt:

cmake_minimum_required(VERSION 3.29)

include(FetchContent)

FetchContent_Declare(CMakeExtraUtils
        GIT_REPOSITORY https://github.com/LecrisUT/CMakeExtraUtils
        GIT_TAG v0.4.1)
FetchContent_MakeAvailable(CMakeExtraUtils) # <-- Here's where the error is thrown

include(DynamicVersion)
dynamic_version(PROJECT_PREFIX MyPOC_)

project(MyPOC VERSION ${PROJECT_VERSION} LANGUAGES CXX)

# Nothing below matters, as the error is thrown before this point.

We get the following error on Ubuntu 22.04:

/usr/bin/cmake --preset exported -S <repo root> -B <repo root>/cmake-build-debug
Preset CMake variables:

  CMAKE_TOOLCHAIN_FILE="dep/scripts/buildsystems/vcpkg.cmake"
  VCPKG_MANIFEST_MODE="false"

-- Found Git: /usr/bin/git (found version "2.34.1")
CMake Error at /usr/share/cmake-3.29/Modules/CMakeDetermineSystem.cmake:152 (message):
  Could not find toolchain file: dep/scripts/buildsystems/vcpkg.cmake
Call Stack (most recent call first):
  cmake-build-debug/_deps/cmakeextrautils-src/CMakeLists.txt:22 (project)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions