-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
39 lines (33 loc) · 837 Bytes
/
Copy pathCMakeLists.txt
File metadata and controls
39 lines (33 loc) · 837 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
cmake_minimum_required(VERSION 3.16)
project(MyProject)
set(CMAKE_CXX_STANDARD 17)
set(SFML_DIR "E:/SFML-2.5.1/lib/cmake/SFML")
find_package(SFML REQUIRED COMPONENTS audio network graphics window system)
if (NOT SFML_FOUND)
message(FATAL_ERROR "SFML NOT FOUND!")
else()
message("SFML FOUND!")
endif()
include_directories(${SFML_INCLUDE_DIR})
add_executable(MyProject main.cpp)
# 链接SFML库和XInput库
target_link_libraries(MyProject
sfml-audio
sfml-network
sfml-graphics
sfml-window
sfml-system
XInput9_1_0
)
# 在Windows上添加其他系统库
if (WIN32)
target_link_libraries(MyProject
XInput9_1_0
user32
sfml-graphics
sfml-window
sfml-system
sfml-audio
sfml-network
)
endif()