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:
-
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 ) -
Before the first configure I set:
-
CMAKE_TOOLCHAIN_FILE (vcpkg toolchain file)
-
OPENCV_EXTRA_MODULES_PATH (pointing to opencv_contrib/modules)
-
-
Ran Configure.
-
Set:
- WITH_FREETYPE = ON (Also tried explicitly setting BUILD_opencv_freetype = ON)
-
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:
-
What is the correct way to make OpenCV detect FreeType (and HarfBuzz) with vcpkg on Windows (VS2022)?
-
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?
-
Is pkg-config actually required for this detection on Windows in OpenCV 4.12.0?
-
Does the order of enabling WITH_FREETYPE or clearing the CMake cache matter?
-
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.