OpenCV 4.12.0 CMake Shows freetype2: NO / harfbuzz: NO (vcpkg, VS2022, Windows 11)

OS: Windows 11
OpenCV version: 4.12.0
CMake GUI: 4.0.3
Generator: Visual Studio 17 2022 (x64)
Compiler: MSVC (Visual Studio 2022)
Architecture: x64
(Build type: (e.g. Release + Debug) – can add if needed)

Goal: Enable FreeType (and optionally HarfBuzz) support.
Problem: CMake keeps showing: – freetype2: NO – harfbuzz: NO even after enabling WITH_FREETYPE=ON (and having opencv_contrib modules path set).

What I did:

  1. Installed libraries via vcpkg (freetype, harfbuzz, etc.).
    (Commands used, for example – can add exact ones if helpful: vcpkg install freetype:x64-windows harfbuzz:x64-windows )

  2. Before the first configure I set:

    • CMAKE_TOOLCHAIN_FILE (vcpkg toolchain file)

    • OPENCV_EXTRA_MODULES_PATH (pointing to opencv_contrib/modules)

  3. Ran Configure.

  4. Set:

    • WITH_FREETYPE = ON (Also tried explicitly setting BUILD_opencv_freetype = ON)
  5. Re-configured, but the summary still shows: – freetype2: NO – harfbuzz: NO

Tried manually setting (no effect):

  • PKG_CONFIG_EXECUTABLE

  • PKG_CONFIG_PATH

  • FREETYPE_INCLUDE_DIR_ft2build

  • FREETYPE_INCLUDE_DIR_freetype2

  • HARFBUZZ_INCLUDE_DIRS (Also tried clearing cache and re-configuring from a fresh build directory.)

Questions:

  1. What is the correct way to make OpenCV detect FreeType (and HarfBuzz) with vcpkg on Windows (VS2022)?

  2. Do I need to set additional variables such as FREETYPE_LIBRARY / HARFBUZZ_LIBRARIES manually, or should find_package() work automatically with the vcpkg toolchain file?

  3. Is pkg-config actually required for this detection on Windows in OpenCV 4.12.0?

  4. Does the order of enabling WITH_FREETYPE or clearing the CMake cache matter?

  5. Is there any known issue with OpenCV 4.12.0 + vcpkg regarding freetype/harfbuzz detection?

Can provide if needed:

  • Full CMake output (config + generation)

  • Relevant excerpts from CMakeCache.txt (FREETYPE / HARFBUZZ entries)

  • Exact vcpkg triplet (currently assuming x64-windows)

  • vcpkg list output

  • Command-line (non-GUI) CMake attempt

Any guidance appreciated. Thanks.