-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
37 lines (28 loc) · 1.33 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.5.0)
project(Space-Invaders VERSION 0.1.0)
# As std::auto_ptr was removed in C++17, sfml-audio fails to compile
# with following CXX standards. So instead of setting a global standard
# this template sets CXX_STANDARD to 17 using set_property.
# set(CMAKE_CXX_STANDARD 17)
# set(CMAKE_CXX_STANDARD_REQUIRED True)
# Copy all the required SFML libs and main executable to bin/
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin/)
# Build SFML
add_subdirectory(vendors/sfml/)
# Collect all the source and header files
file(GLOB_RECURSE ALL_SOURCE_FILES "${CMAKE_SOURCE_DIR}/src/*.cpp")
file(GLOB_RECURSE ALL_HEADER_FILES "${CMAKE_SOURCE_DIR}/include/*.hpp")
# Add the main target.
add_executable(${PROJECT_NAME} ${ALL_SOURCE_FILES} ${ALL_HEADER_FILES})
# Use C++17 standards
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17)
# Include directories for main target
target_include_directories(
${PROJECT_NAME}
PRIVATE ${PROJECT_SOURCE_DIR}/include/
PRIVATE ${PROJECT_SOURCE_DIR}/vendors/sfml/include/
)
# Link required libraries (add sfml-audio and sfml-network if needed)
target_link_libraries(${PROJECT_NAME} sfml-audio sfml-graphics sfml-window sfml-system)
# Copy resources folder to the binary output directory
file(COPY ${CMAKE_SOURCE_DIR}/resources DESTINATION ${CMAKE_BINARY_DIR}/bin)