File: CMakeLists.txt

package info (click to toggle)
tango 10.0.2%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 89,484 kB
  • sloc: cpp: 201,245; sh: 1,645; python: 953; java: 800; perl: 467; javascript: 447; xml: 325; makefile: 269; sql: 72; ruby: 24
file content (69 lines) | stat: -rw-r--r-- 2,036 bytes parent folder | download | duplicates (2)
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
cmake_minimum_required(VERSION 3.18...3.26 FATAL_ERROR)

project(DataBase VERSION 5.22.0 LANGUAGES CXX)

if(NOT DEFINED CMAKE_CXX_STANDARD)
    set(CMAKE_CXX_STANDARD 17)
endif()

set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

include(configure/CMakeLists.txt)
include(test/CMakeLists.txt)

configure_file(cmake_config.h.in cmake_config.h @ONLY)

set(SOURCES DataBase.cpp
            DataBaseClass.cpp
            DatabaseConnectionHandle.cpp
            DatabaseConnectionPool.cpp
            DataBaseStateMachine.cpp
            ClassFactory.cpp
            main.cpp)

set(ADDITIONAL_SOURCES  DataBaseUtils.cpp
                        update_starter.cpp)

add_executable(Databaseds ${SOURCES} ${ADDITIONAL_SOURCES})
target_include_directories(Databaseds PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
target_link_libraries(Databaseds PUBLIC Tango::Tango MySQL::MySQL)

if (WIN32 AND (Tango_IS_STATIC OR Tango_FORCE_STATIC))
    set_target_properties(Databaseds PROPERTIES
        MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>"
    )
endif()

if (MSVC)
    target_compile_options(Databaseds PUBLIC /W3)
else()
    target_compile_options(Databaseds PUBLIC -Wall -Wextra -D_FORTIFY_SOURCE=2 -O1)
endif()


if(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
    set_target_properties(Databaseds PROPERTIES LINK_FLAGS "-bind_at_load")
elseif(NOT MSVC)
    target_compile_options(Databaseds PUBLIC -fpie)
    set_target_properties(Databaseds PROPERTIES LINK_FLAGS "-Wl,-z,now -pie")
endif()


if(TDB_ENABLE_COVERAGE)
  target_link_options(Databaseds PUBLIC --coverage)
  target_compile_options(Databaseds PUBLIC --coverage)
endif()

install(TARGETS Databaseds
        RUNTIME DESTINATION "${CMAKE_INSTALL_FULL_BINDIR}")

option(TANGO_WARNINGS_AS_ERRORS "Treat compiler warnings as errors" OFF)

if(TANGO_WARNINGS_AS_ERRORS)
    if (MSVC)
        target_compile_options(Databaseds PUBLIC /WX)
    else()
        target_compile_options(Databaseds PUBLIC -Werror -Wformat -Werror=format-security -pedantic)
    endif()
endif()