Skip to content

[Bug] vcpkg fails to reinstall vcpkg-cmake if it has been deleted from share/ directory #48473

@osipxd

Description

@osipxd

Describe the bug

After deleting of ${CURRENT_HOST_INSTALLED_DIR}/share/vcpkg-cmake/, it is not being reinstalled and CMake helper functions from it are not available to the port, resulting in "Unknown CMake command" errors.

Steps to reproduce

  1. Create a manifest with some dependency (which uses vcpkg_cmake_configure):

    {
      "dependencies": [
        "curl"
      ]
    }
  2. Create an overlay port for the declared depdendency:

    mkdir "my-ports"
    cp -r "$VCPKG_ROOT/ports/curl" "my-ports/"
  3. Run vcpkg install with custom install-root and the created overlay port:

    vcpkg install --x-install-root=./build --x-manifest-root=./ --overlay-ports=./my-ports/curl
  4. Remove the share/vcpkg-cmake/ directory:

    rm -rf ./build/*/share/vcpkg-cmake/
  5. Modify the portfile (e.g., add a comment) to invalidate it

  6. Rerun install (see the step 3)

Expected behavior

It would be great if vcpkg either:

  1. Verify that installed packages' files actually exist before trusting the status file
  2. Detect missing files and automatically repair the installation

Actual behavior

Error: CMake Error at portfile.cmake:XX (vcpkg_cmake_configure): Unknown CMake command "vcpkg_cmake_configure".

The vcpkg-cmake package is marked as installed in the status file, but its CMake modules are not available to the overlay port.

Environment

  • vcpkg version: 2025.10.17 (commit bd52fac)
  • OS: macOS (Darwin 23.6.0)
  • Compiler: Apple Clang

Additional context

I do not understand why vcpkg-cmake had been deleted from my install root. So I'm not sure how vcpkg ended up in this state. But it took quite some time to figure out the root cause and fix it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions