-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
48 lines (34 loc) · 1.22 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
cmake_minimum_required(VERSION 3.22)
project(CRYSTAL)
# Setting C++ version
set (CMAKE_CXX_STANDARD 17)
# Adding Project files
file(GLOB_RECURSE SRCS "src/*.cpp")
file(GLOB_RECURSE HDRS "src/*.h")
add_library(${PROJECT_NAME}
${SRCS}
${HDRS}
)
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_SOURCE_DIR}/src)
# Only build the example if Crystal is directly called add tests and examples else exclude
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
# Building example
add_subdirectory(example)
# Building test
enable_testing()
add_subdirectory(tests)
endif()
# Define Build type if not present
if(NOT CMAKE_BUILD_TYPE)
message(STATUS "No build type selected, default to Release")
set(CMAKE_BUILD_TYPE "Release")
endif()
# set(WFLAGS "-Wall -Wextra -Werror -Wshadow")
set(CMAKE_CXX_FLAGS "-DFREQUENT_RESTART")
set(CMAKE_CXX_FLAGS_DEBUG "${WFLAGS} -Og -g -DDEVELOPMENT_ENVIRONMENT")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
# Adding SQLite3 library
find_package(SQLite3 REQUIRED)
target_include_directories(${PROJECT_NAME} PRIVATE ${SQLite3_INCLUDE_DIRS})
target_link_directories(${PROJECT_NAME} PRIVATE ${SQLite3_LIBRARY_DIR})
target_link_libraries(${PROJECT_NAME} ${SQLite3_LIBRARIES})