1
General / Solved: Can't get CMake to find config files
« on: February 03, 2020, 09:04:02 am »
I am struggling to get CMake to work with SFML on Windows for my personal project or on any other SFML project that uses CMake. For reference I cloned this repo: https://github.com/ifexception/sfml-modern-cmake-example
Upon running `cmake -G "Visual Studio 16 2019" ..` I get the following error:
SFML is installed in the directory `C:/SFML-2-5.1`. It should be using the file `SFMLConfig.cmake` within that directory to find the SFML libraries but CMake keeps rejecting it.
Solved! Turns out with the generator for Visual Studio 19 is 64bit by default. Using the 32bit generator allows CMake to use the config file.
Upon running `cmake -G "Visual Studio 16 2019" ..` I get the following error:
Quote
CMake Error at CMakeLists.txt:4 (find_package):
Could not find a configuration file for package "SFML" that is compatible
with requested version "2.5".
The following configuration files were considered but not accepted:
C:/MinGW/lib/cmake/SFML/SFMLConfig.cmake, version: 2.5.1 (32bit)
C:/SFML-2.5.1/lib/cmake/SFML/SFMLConfig.cmake, version: 2.5.1 (32bit)
SFML is installed in the directory `C:/SFML-2-5.1`. It should be using the file `SFMLConfig.cmake` within that directory to find the SFML libraries but CMake keeps rejecting it.
Solved! Turns out with the generator for Visual Studio 19 is 64bit by default. Using the 32bit generator allows CMake to use the config file.