CMake 64位和SFML 64位 [英] CMake 64-bit with SFML 64-bit

查看:78
本文介绍了CMake 64位和SFML 64位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用适用于Windows的CMake 64位和SFML 2.5.1 64位来构建C ++项目.当我在项目上运行cmake时,我收到一条错误消息.

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.

我要使其正常工作的唯一方法是将 CMAKE_PREFIX_PATH 更改为指向SFML的32位版本,但这不是我想要的.

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)

错误消息:

CMakeLists.txt:16(find_package)的CMake错误:找不到与软件包"SFML"兼容的配置文件请求的版本为"2.5".

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,版本:2.5.1(64bit)

D:/Program Files/SFML-2.5.1/lib/cmake/SFML/SFMLConfig.cmake, version: 2.5.1 (64bit)

推荐答案

我遇到了同样的问题,经过一番调查,我了解到斯坦利的评论是正确的.要使用64位工具链,只需运行:

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" ..

对于32位SFML版本,只需简单运行即可: cmake ..

For 32-bit SFML version it is enough to run simply: cmake ..

这篇关于CMake 64位和SFML 64位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆