问题
I'm trying to build a C++ project with CMake 64-bit for Windows and SFML 2.5.1 64-bit. When I run cmake on the project I'm getting an error message.
The only way I can get it to work is to change the CMAKE_PREFIX_PATH
to point to a 32-bit version of SFML but that's not what I want.
CMakeLists.txt:
cmake_minimum_required (VERSION 3.8)
#project(GameOfLife)
set(CMAKE_PREFIX_PATH "D:\\Program Files\\SFML-2.5.1\\lib\\cmake\\SFML")
find_package(SFML 2.5 COMPONENTS graphics window REQUIRED)
# Add source to this project's executable.
add_executable (GameOfLife "GameOfLife.cpp" "GameOfLife.h")
# Link SFML
target_link_libraries(GameOfLife sfml-graphics sfml-window)
Error message:
CMake Error at CMakeLists.txt:16 (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:
D:/Program Files/SFML-2.5.1/lib/cmake/SFML/SFMLConfig.cmake, version: 2.5.1 (64bit)
回答1:
I faced with the same problem and after some investigation I understood that Stanley's comment was correct. To use a 64-bit toolchain just run:
cmake -G "Visual Studio 15 2017 Win64" ..
For 32-bit SFML version it is enough to run simply: cmake ..
来源:https://stackoverflow.com/questions/54699430/cmake-64-bit-with-sfml-64-bit