-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
68 lines (55 loc) · 2.31 KB
/
CMakeLists.txt
File metadata and controls
68 lines (55 loc) · 2.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
63
64
65
66
67
68
cmake_minimum_required(VERSION 3.14)
project(squidlogparser LANGUAGES CXX VERSION 1.0 DESCRIPTION "Squid-cache Log Parser")
#set(CMAKE_CXX_COMPILER "/usr/bin/clang++")
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS_RELEASE "-O2")
add_definitions("-Wall -Wextra -pedantic")
# -----------------------------------------------------------------------------
# Enable this extension allows the parsed data to be recorded
# directly on tables in MariaDB(tm)
#
# Note: See README_SLPDatabase.md for more details.
#
# Note: MySQL Connector C++ must be compiled and installed.
# https://mariadb.com/docs/connect/programming-languages/
# https://github.com/mariadb-corporation/mariadb-connector-cpp
#
# Enabled: ON
# Disabled: OFF (DEFAULT)
option(DATABASE_EXTENSION "Database Extension" OFF)
# -----------------------------------------------------------------------------
# These macros make the 'parser' functions print the values of the retrieved
# fields to stdout.
#
# Important: Only activate these macros for testing. In production environment
# they must be disabled.
# Uncomment to activate.
#add_definitions("-DDEBUG_PARSER_SQUID")
#add_definitions("-DDEBUG_PARSER_COMMON")
#add_definitions("-DDEBUG_PARSER_COMBINED")
#add_definitions("-DDEBUG_PARSER_REFERRER")
#add_definitions("-DDEBUG_PARSER_USERAGENT")
file(WRITE "${CMAKE_SOURCE_DIR}/QtCreatorDeployment.txt" "<deployment/prefix>\n")
add_library(squidlogparser SHARED
squidlogparser.h
squidlogparser.cc
)
find_package(tinyxml2 REQUIRED)
set_target_properties(squidlogparser PROPERTIES VERSION ${PROJECT_VERSION}
SOVERSION 1
PUBLIC_HEADER squidlogparser.h)
target_include_directories(squidlogparser PRIVATE .)
set_target_properties(squidlogparser PROPERTIES PUBLIC_HEADER squidlogparser.h)
if(DATABASE_EXTENSION)
add_definitions("-DDATABASE_EXTENSION")
target_link_libraries(squidlogparser PRIVATE -ltinyxml2 -lboost_regex -lmariadbcpp -lpthread)
else()
target_link_libraries(squidlogparser PRIVATE -ltinyxml2 -lboost_regex -lpthread)
endif(DATABASE_EXTENSION)
unset(DATABASE_EXTENSION CACHE)
target_compile_definitions(squidlogparser PRIVATE squidlogparser_LIBRARY)
# Uncomment to install (root)
#install(TARGETS squidlogparser DESTINATION /lib64)
#install(FILES squidlogparser.h DESTINATION /usr/include)