Hello!
- I cloned vcpkg from git repo it created “vcpkg” directory in E:\
- I launched a bootstrap-vcpkg.bat and it downloaded vcpkg.exe
PS E:\vcpkg> .\bootstrap-vcpkg.bat
Downloading https://github.com/microsoft/vcpkg-tool/releases/download/2024-03-14/vcpkg.exe -> E:\vcpkg\vcpkg.exe... done.
Validating signature... done.
vcpkg package management program version 2024-03-14-7d353e869753e5609a1f1a057df3db8fd356e49d
See LICENSE.txt for license information.
- then I integrated vcpkg
PS E:\vcpkg> .\vcpkg.exe integrate install
CMake projects should use: "-DCMAKE_TOOLCHAIN_FILE=E:/vcpkg/scripts/buildsystems/vcpkg.cmake"
All MSBuild C++ projects can now #include any installed libraries. Linking will be handled automatically. Installing new libraries will make them instantly available.
then I installed gtk package:
PS E:\vcpkg> .\vcpkg.exe install gtk
it was 1 hour process and it went without errors, it created “x64-windows” directory in
“E:\vcpkg\installed”
After that I created CMake project in Visual Studio 2022 17.9.4 (CMake is 3.29 version)
I added that line to CMakePresets.json
“CMAKE_TOOLCHAIN_FILE”: “$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake”
at the bottom of a cacheVariables:
"cacheVariables": { "CMAKE_C_COMPILER": "cl.exe", "CMAKE_CXX_COMPILER": "cl.exe", "CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" },
I set user env variable
name: VCPKG_ROOT
value: E:\vcpkg
I checked that file “vcpkg.cmake” is there according to that above path.
this apparently doesn’t work
cmake_minimum_required (VERSION 3.8)
project(GTKTest1)find_package(GTK REQUIRED)
add_executable (Main “Main.cpp” )
target_link_libraries(Main PRIVATE GTK)
What else I need to do to make CMake find all GTK package, what I’m doing wrong ?