-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
54 lines (44 loc) · 1.62 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
cmake_minimum_required(VERSION 3.16)
set(PROJECT_NAME PnC)
project(${PROJECT_NAME} LANGUAGES CXX)
file(GLOB source_files
"src/main/*.cpp"
"src/main/Activities/*.cpp"
"src/main/UIElements/*.cpp"
"src/main/Actors/*.cpp"
"src/main/Animations/*.cpp"
"src/main/UIObjects/*.cpp"
"src/main/FightStates/*.cpp"
)
set(SOURCES ${source_files})
set(CMAKE_INSTALL_PREFIX ${PROJECT_SOURCE_DIR}/project_build)
message (STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}")
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
include(FetchContent)
FetchContent_Declare(SFML
GIT_REPOSITORY https://github.com/SFML/SFML.git
GIT_TAG 2.6.x)
FetchContent_MakeAvailable(SFML)
add_executable (
${PROJECT_NAME}
${SOURCES}
)
target_include_directories(${PROJECT_NAME} PRIVATE "src/include")
target_link_libraries(${PROJECT_NAME} PUBLIC sfml-graphics sfml-audio)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)
if(WIN32)
add_custom_command(
TARGET ${PROJECT_NAME}
COMMENT "Copy OpenAL DLL"
PRE_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/openal32.dll $<TARGET_FILE_DIR:${PROJECT_NAME}>
VERBATIM)
endif()
add_custom_command(
TARGET ${PROJECT_NAME}
COMMENT "Copy resources"
PRE_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/src/resources $<TARGET_FILE_DIR:${PROJECT_NAME}>/resources
VERBATIM)
install(TARGETS ${PROJECT_NAME})
install(DIRECTORY ${PROJECT_SOURCE_DIR}/src/resources DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)