Reputation: 16841
I am trying to figure out how to get SFML to work with CMake and Visual Studio 2022 on Windows 10.
So far I have
There is a file in my sfml folder SFMLConfig.cmake
. I need to use this in combination with find_package
(cmake) but I have no idea how to do this.
add_subdirectory
.I've added a screenshot of VS and the sfml folder containing the .cmake
files.
The sfml folder is structured something like this - if you've used SFML before you are probably familiar with it.
sfml/
bin/
openal32.dll
...
include/
sfml/
Audio/
Graphics/
...
lib/
cmake/
SFML/
SFMLConfig.cmake
...
sfml-audio.lib
sfml-audio-d.lib
...
share/
Upvotes: 0
Views: 2443
Reputation: 19926
You just need to set SFML_ROOT
to X:\REDACTED\source\repos\REDACTED\REDACTED\sfml
. It is not appropriate to hard-code such a path in the CMakeLists.txt, but you can put it in a preset. This works either as a CMake variable or as an environment variable.
Please read the full documentation for find_package
, the Config-Mode Search Procedure in particular: https://cmake.org/cmake/help/latest/command/find_package.html
Also worth noting: it is much easier to manage dependencies on Windows using vcpkg than littering dubious ("what I believe to be") binaries across your filesystem.
Upvotes: 1