本文介绍了SFML 2.5+ 和 CMake的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
随着 SFML 2.5 中 FindSFML.cmake
的删除,导入它的首选方式是什么?
With the removal of FindSFML.cmake
in SFML 2.5, what is the preferred way of importing it?
我试过了,但是找不到SFMLConfig.cmake
cmake_minimum_required(VERSION 3.17)
project(untitled)
set(CMAKE_CXX_STANDARD 20)
find_package(SFML 2.5.1 COMPONENTS graphics REQUIRED)
add_executable(untitled "main.cpp")
target_link_libraries(untitled sfml-graphics)
SFML 目录在项目内.我在 macOS Catalina 上使用 CMake 和 CLion
The SFML directory is inside the project. I am using CMake with CLion on macOS Catalina
推荐答案
我也在项目目录中使用 clion 和 SFML,这就是我通常所做的:
I'm also using clion and SFML inside a project directory and that's what I'm usually doing:
if(WIN32)
set(LIB_DIR libraries/win)
set(SHRD_EXT dll)
else()
set(LIB_DIR libraries/unix)
set(SHRD_EXT so)
endif(WIN32)
# find SFML 2.5
set(SFML_DIR ${LIB_DIR}/SFML-2.5.1/lib/cmake/SFML/)
find_package(SFML 2.5 COMPONENTS graphics window system audio network REQUIRED)```
在 libraries/win
和 libraries/unix
中,我有特定于平台的 sfml 库.
In libraries/win
and libraries/unix
I have platform-specific sfml library.
这篇关于SFML 2.5+ 和 CMake的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!