3
votes

I'm using a Cmake for a cross-platform project that use glibmm. Under Linux, the project build successfully without any problem (and works fine when executed).

But with Windows 10, Visual Studio 2019 (pro), I can't find how to build the project. I installed glibmm with vcpkg ("vcpkg install glibmm:x64-windows" and "vcpkg install glibmm:x86-windows")

I add to my cmake command the parameter -DCMAKE_TOOLCHAIN_FILE=D:\vcpkg\scripts\buildsystems\vcpkg.cmake

In the main CMakeLists.txt file, the following lines do not do their job.

find_package(PkgConfig REQUIRED)
pkg_check_modules(glibmm REQUIRED glibmm-2.4)
cmake -S D:\MachDrivetoolkit\libMachDrive -DCMAKE_TOOLCHAIN_FILE=D:\vcpkg\scripts\buildsystems\vcpkg.cmake -DPKG_CONFIG_EXECUTABLE:STRING="D:\vcpkg\downloads\tools\msys2\c809757c94447846\mingw32\bin\pkg-config.exe" -B D:\MachDrivetoolkit\libMachDriveVS
-- Building for: Visual Studio 16 2019
-- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.19041.
-- The CXX compiler identification is MSVC 19.28.29334.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.28.29333/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PkgConfig: D:\vcpkg\downloads\tools\msys2\c809757c94447846\mingw32\bin\pkg-config.exe (found version "0.29.2") 
-- Checking for module 'glibmm-2.4'
--   No package 'glibmm-2.4' found
CMake Error at C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.18/Modules/FindPkgConfig.cmake:545 (message):
  A required package was not found
Call Stack (most recent call first):
  C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.18/Modules/FindPkgConfig.cmake:733 (_pkg_check_modules_internal)
  libipc/CMakeLists.txt:37 (pkg_check_modules)

Then I modify the name of the glibmm library in the script to match the name of the installed file

find_package(PkgConfig REQUIRED)
pkg_check_modules(glibmm REQUIRED glibmm)

but it fail the same.

What parameters or what instruction should I use to link glibmm to my project ?