pkg-config generation doesn't work as expected when installing it with --prefix flag. The $prefix and $exec_prefix of the generated pc file still contain the default value. This will be fine if installed normally.
To compile and generate the required file for CMake use
cmake -S . -Bbuild
You can later use the command below to build a release version or use cmake --open build to open it in Visual Studio to build. The command below just uses MSBuild in the background and --config Debug flag can be passed to generate a debug build.
cmake --build build --config Release
For installation you can use
cmake --install build
Not that this requires admin privileges because it tries to install it at C:\Program (x86)\ViGEmClient directory. This can be overridden with --prefix flags to specify other locations.
To make find_package works you need to have the path to where ViGEmClientConfig.cmake file is generated in an environment variable list called CMAKE_PREFIX_PATH, this tells cmake where to find the library. If the library is installed at the default location then it should be located at C:\Program Files (x86)\ViGEmClient\lib\cmake\ViGEmClient. Just append this path to the environment variable and it should work.
As I'm still new to cmake the location might not be 100% correct but it serves as a start :)
Configure CMake to generate the required config files for
fing_package
to work.Usage:
pkg-config generation doesn't work as expected when installing it with
--prefix
flag. The$prefix
and$exec_prefix
of the generated pc file still contain the default value. This will be fine if installed normally.To compile and generate the required file for CMake use
You can later use the command below to build a release version or use
cmake --open build
to open it in Visual Studio to build. The command below just uses MSBuild in the background and--config Debug
flag can be passed to generate a debug build.For installation you can use
Not that this requires admin privileges because it tries to install it at
C:\Program (x86)\ViGEmClient
directory. This can be overridden with--prefix
flags to specify other locations.To make
find_package
works you need to have the path to whereViGEmClientConfig.cmake
file is generated in an environment variable list calledCMAKE_PREFIX_PATH
, this tellscmake
where to find the library. If the library is installed at the default location then it should be located atC:\Program Files (x86)\ViGEmClient\lib\cmake\ViGEmClient
. Just append this path to the environment variable and it should work.As I'm still new to
cmake
the location might not be 100% correct but it serves as a start :)