-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
74 lines (59 loc) · 2.67 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# Filename: CMakeLists.txt
# Created on: November 5, 2023
# Author: Lucas Araújo <[email protected]>
CMAKE_MINIMUM_REQUIRED(VERSION 3.5)
# Set default parameters
PROJECT(SudokuSolver)
SET(CMAKE_CXX_STANDARD 20)
SET(CMAKE_CXX_STANDARD_REQUIRED ON)
SET(CMAKE_CXX_EXTENSIONS OFF)
# Set compiler flags for different build types
IF(CMAKE_BUILD_TYPE STREQUAL "Debug")
SET(EXECUTABLE_NAME "sudoku_debug")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 -Wall -Wextra -pedantic")
ELSE()
SET(EXECUTABLE_NAME "sudoku_solver")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -Wall -Wextra -pedantic")
ENDIF()
MESSAGE(STATUS "C++ Compiler Flags:${CMAKE_CXX_FLAGS}")
SET(SRC_DIR ${CMAKE_SOURCE_DIR}/src)
SET(UNIT_TEST_DIR ${CMAKE_SOURCE_DIR}/test/unit)
SET(INC_DIR ${CMAKE_SOURCE_DIR}/include)
SET(BENCHMARK_DIR ${CMAKE_SOURCE_DIR}/test/benchmark)
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/build/libs)
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_SOURCE_DIR}/bin/Debug)
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_SOURCE_DIR}/bin/Release)
# Manager submodules
## DataStructures
SET(DATA_STRUCT_DIR ${CMAKE_SOURCE_DIR}/submodules/data_structures)
AUX_SOURCE_DIRECTORY(${DATA_STRUCT_DIR}/src DATA_STRUCT_PROGRAM)
INCLUDE_DIRECTORIES(${DATA_STRUCT_DIR}/include)
ADD_LIBRARY(DataStructures ${DATA_STRUCT_PROGRAM})
## DataStructures
SET(GEOMETRIC_ALGORITHMS_DIR ${CMAKE_SOURCE_DIR}/submodules/geometric_algorithms)
AUX_SOURCE_DIRECTORY(${GEOMETRIC_ALGORITHMS_DIR}/src GEOMETRIC_ALGORITHMS_PROGRAM)
INCLUDE_DIRECTORIES(${GEOMETRIC_ALGORITHMS_DIR}/include)
ADD_LIBRARY(GeometricAlgorithms ${GEOMETRIC_ALGORITHMS_PROGRAM})
## Sorting Algorithms
SET(SORT_ALG_DIR ${CMAKE_SOURCE_DIR}/submodules/sorting_algorithms)
AUX_SOURCE_DIRECTORY(${SORT_ALG_DIR}/src SORT_ALG_PROGRAM)
INCLUDE_DIRECTORIES(${SORT_ALG_DIR}/include)
ADD_LIBRARY(SortingAlgorithms ${SORT_ALG_PROGRAM})
# Get all files in the folders SRC_DIR and UNIT_TEST_DIR
AUX_SOURCE_DIRECTORY(${SRC_DIR} PROGRAM)
AUX_SOURCE_DIRECTORY(${UNIT_TEST_DIR} UNIT_TESTS)
INCLUDE_DIRECTORIES(${INC_DIR})
INCLUDE_DIRECTORIES(${INC_DIR}/lib)
# Define the program lib
ADD_LIBRARY(SudokuSolver ${PROGRAM})
# Make executables
ADD_EXECUTABLE(sudoku_solver ${PROGRAM})
ADD_EXECUTABLE(unit_test ${UNIT_TESTS})
# Link libs
TARGET_LINK_LIBRARIES(SortingAlgorithms DataStructures)
TARGET_LINK_LIBRARIES(GeometricAlgorithms SortingAlgorithms DataStructures)
TARGET_LINK_LIBRARIES(GeometricAlgorithms SortingAlgorithms)
TARGET_LINK_LIBRARIES(SudokuSolver GeometricAlgorithms SortingAlgorithms DataStructures)
TARGET_LINK_LIBRARIES(sudoku_solver SudokuSolver)
TARGET_LINK_LIBRARIES(unit_test SudokuSolver)