-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathCMakeLists.txt
37 lines (27 loc) · 1.15 KB
/
CMakeLists.txt
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
cmake_minimum_required(VERSION 3.12)
project(CloneCraft)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
file(GLOB_RECURSE sources Src/*.cpp Src/*.c Src/*.h Src/*.hpp)
file(GLOB_RECURSE external External/*.cpp External/*.c External/*.h External/*.hpp)
file(GLOB_RECURSE data data/*)
add_executable(clonecraft ${sources} ${external} ${data})
target_include_directories(clonecraft PUBLIC Src External)
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/Data DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
find_package(SFML 2.5 COMPONENTS graphics REQUIRED)
target_link_libraries(clonecraft PRIVATE sfml-graphics)
if(UNIX)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
target_link_libraries(clonecraft PRIVATE Threads::Threads)
endif()
find_package(OpenGL REQUIRED)
target_include_directories(clonecraft PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>
$<INSTALL_INTERFACE:include>)
target_link_libraries(clonecraft PUBLIC OpenGL::GL ${CMAKE_DL_LIBS})
if(MSVC)
target_compile_options(clonecraft PRIVATE /W3)
else()
target_compile_options(clonecraft PRIVATE -Wall -Wextra)
endif()