-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
58 lines (46 loc) · 1.66 KB
/
CMakeLists.txt
File metadata and controls
58 lines (46 loc) · 1.66 KB
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
55
56
57
58
# set minimum CMake required version
cmake_minimum_required(VERSION 3.20.0)
# Configure project name
project(games CXX)
# Add some extra flags to be taken into account in build time
set(CMAKE_CXX_FLAGS "-Wall")
set(CMAKE_C_COMPILER "gcc")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
# find all include headers
include_directories(${CMAKE_SOURCE_DIR}/include)
# set the common source files
set(COMMON_SOURCES
"${CMAKE_SOURCE_DIR}/src/board.cpp"
"${CMAKE_SOURCE_DIR}/src/event.cpp"
)
# set the mancala source files
set(MANCALA_SOURCES
"${CMAKE_SOURCE_DIR}/src/mancala/mancala_board.cpp"
"${CMAKE_SOURCE_DIR}/src/mancala/mancala_board.hpp"
"${CMAKE_SOURCE_DIR}/src/mancala/mancala_minmax.hpp"
)
# set the tic tac toe source files
set(TIC_TAC_TOE_SOURCES
"${CMAKE_SOURCE_DIR}/src/tic_tac_toe/tic_tac_toe_board.cpp"
"${CMAKE_SOURCE_DIR}/src/tic_tac_toe/tic_tac_toe_board.hpp"
"${CMAKE_SOURCE_DIR}/src/tic_tac_toe/tic_tac_toe_minmax.hpp"
)
# set the executables with all sources
add_executable(mancala
"${CMAKE_SOURCE_DIR}/src/mancala/mancala.cpp"
${COMMON_SOURCES}
${MANCALA_SOURCES}
)
add_executable(tic_tac_toe
"${CMAKE_SOURCE_DIR}/src/tic_tac_toe/tic_tac_toe.cpp"
${COMMON_SOURCES}
${TIC_TAC_TOE_SOURCES}
)
# include directories
target_include_directories(mancala PRIVATE ${CMAKE_SOURCE_DIR}/include)
target_include_directories(tic_tac_toe PRIVATE ${CMAKE_SOURCE_DIR}/include)
# install the executable
install(TARGETS mancala DESTINATION ${CMAKE_INSTALL_NAME_DIR})
install(TARGETS tic_tac_toe DESTINATION ${CMAKE_INSTALL_NAME_DIR})
# install header files
install(DIRECTORY ${CMAKE_SOURCE_DIR}/include/ DESTINATION include)