CMake 64-bit with SFML 64-bit

两盒软妹~` 提交于 2021-02-10 12:34:24

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!