-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
62 lines (45 loc) · 1.31 KB
/
CMakeLists.txt
File metadata and controls
62 lines (45 loc) · 1.31 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
59
60
61
62
cmake_minimum_required(VERSION 3.24)
project(db_soci_orm_cpp
VERSION "0.1.0"
LANGUAGES CXX
)
option(ENABLE_PCH "Enable Precompiled Headers" False)
option(ENABLE_TESTS "Enable tests" True)
set(SOURCES src/main.cpp)
add_executable(${PROJECT_NAME} ${SOURCES})
## Compiler options
include(cmake/CompilerOptions.cmake)
set_compiler_options(${PROJECT_NAME})
## Find third-party packages
find_package(fmt REQUIRED)
find_package(SOCI REQUIRED)
## Target
target_include_directories(${PROJECT_NAME}
SYSTEM PRIVATE # These directories must be placed before other non-system directories
${fmt_INCLUDE_DIRS}
${SOCI_INCLUDE_DIRS}
PUBLIC
include
)
target_link_libraries(${PROJECT_NAME}
PRIVATE
${fmt_LIBRARIES}
${SOCI_LIBRARIES}
)
## Check custom options
if (ENABLE_PCH) # Since CMake 3.15
target_precompile_headers(${PROJECT_NAME} INTERFACE <vector> <string> <map> <utility>)
message("PCH enabled")
endif ()
if (ENABLE_TESTS)
message(STATUS "Tests enabled")
enable_testing() # Must be placed before add_subdirectory
add_subdirectory(test)
endif ()
## Install commands
install(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION "/opt/${PROJECT_NAME}"
)
set(CPACK_GENERATOR "DEB")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Juan Jose Castellanos <juancho.312@hotmail.com>")
include(CPack)