This repository has been archived by the owner on Oct 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathCMakeLists.txt
71 lines (57 loc) · 2.75 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
cmake_minimum_required(VERSION 3.10 FATAL_ERROR) # was 3.22 previously
project(alx-checker
VERSION 0.1.0
DESCRIPTION "A checker for alx"
HOMEPAGE_URL "https://github.com/achrafelkhnissi/alx-checker"
LANGUAGES CXX)
set(FATAL_ERROR "CMake version 3.24 or higher is required. Download the latest version from https://cmake.org/download/")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror -g -std=c++17")
# For Debugging
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CONFIG_HPP_IN "${PROJECT_SOURCE_DIR}/inc/config.hpp.in")
set(CONFIG_HPP "${PROJECT_BINARY_DIR}/config.hpp")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin)
# TODO: Remove this after testing
# set(CMAKE_RUNTIME_OUTPUT_DIRECTORY /usr/local/bin)
# Disable in-source builds to prevent source tree corruption.
if(" ${CMAKE_SOURCE_DIR}" STREQUAL " ${CMAKE_BINARY_DIR}")
message(FATAL_ERROR "
FATAL: In-source builds are not allowed.
You should create a separate directory for build files.
")
endif()
# Set the default build type to Release
# cmake -DCMAKE_BUILD_TYPE=Debug -H. -Bbuild/Debug
# cmake -DCMAKE_BUILD_TYPE=Release -H. -Bbuild/Release
if(${CMAKE_BUILD_TYPE} MATCHES Debug)
message("Debug Build")
elseif(${CMAKE_BUILD_TYPE} MATCHES Release)
message("Release Build")
endif()
message(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
include_directories(${PROJECT_BINARY_DIR})
include_directories(${PROJECT_SOURCE_DIR}/inc)
include_directories(${PROJECT_SOURCE_DIR}/src/checker)
include_directories(${PROJECT_SOURCE_DIR}/src/installer)
include_directories(${PROJECT_SOURCE_DIR}/src/printer)
include_directories(${PROJECT_SOURCE_DIR}/src/animation)
configure_file(${CONFIG_HPP_IN} ${CONFIG_HPP})
add_executable(${PROJECT_NAME} ${CMAKE_SOURCE_DIR}/src/main.cpp src/checker/initMaps.cpp)
target_sources(${PROJECT_NAME} PRIVATE
${CMAKE_SOURCE_DIR}/src/checker/Checker.cpp
${CMAKE_SOURCE_DIR}/src/checker/checkerUtils.cpp
${CMAKE_SOURCE_DIR}/src/installer/Installer.cpp
${CMAKE_SOURCE_DIR}/src/installer/installerUtils.cpp
${CMAKE_SOURCE_DIR}/src/installer/installMethods.cpp
${CMAKE_SOURCE_DIR}/src/installer/dependencies.cpp
${CMAKE_SOURCE_DIR}/src/printer/Printer.cpp
${CMAKE_SOURCE_DIR}/src/animation/Animation.cpp)
target_include_directories(${PROJECT_NAME} PUBLIC
${PROJECT_BINARY_DIR}
${PROJECT_SOURCE_DIR}/inc
${PROJECT_SOURCE_DIR}/src/checker
${PROJECT_SOURCE_DIR}/src/installer
${PROJECT_SOURCE_DIR}/src/printer
${PROJECT_SOURCE_DIR}/src/animation)