Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find GTK installed by vcpkg in CMake

I install the GTK packages with:

vcpkg install gtk:x64-windows

I also set the environment variable CMAKE_TOOLCHAIN_FILE to C:\vcpkg\scripts\buildsystems\vcpkg.cmake, but find_package can't find GTK. How do I find GTK in CMake?

like image 665
Glavo Avatar asked Sep 19 '25 21:09

Glavo


1 Answers

Have you made sure to run .\vcpkg integrate install via Powershell-Admin after you have built GTK? Are you building your project with the x64-windows triplet defined (VCPKG_TARGET_TRIPLET)?

^ Once you do that, delete CMakeCache, and/or test regeneration to another folder and try Configuring again.

On the CMake side, check that your CMakeLists has find_package (GTK) somewhere in there as well. You'll probably also have to define GTK_INCLUDE_DIR and link GTK via target_link_libraries on the CMake side.

like image 177
Cora Avatar answered Sep 21 '25 20:09

Cora