File: CMakeLists.txt

package info (click to toggle)
syslog-ng 3.19.1-5
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 13,176 kB
  • sloc: ansic: 114,472; makefile: 4,697; sh: 4,391; python: 4,282; java: 4,047; xml: 2,435; yacc: 1,108; lex: 426; perl: 193; awk: 184
file content (83 lines) | stat: -rw-r--r-- 2,318 bytes parent folder | download
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
71
72
73
74
75
76
77
78
79
80
81
82
83
if (PYTHONLIBS_FOUND)
  option(ENABLE_PYTHON "Enable Python module" ON)
else()
  option(ENABLE_PYTHON "Enable Python module" OFF)
endif()

if (NOT ENABLE_PYTHON)
  return()
endif ()

if (NOT PYTHONLIBS_FOUND)
  message(FATAL_ERROR "Python module enabled, but python library not found.")
endif()

MESSAGE(STATUS "Found python ${PYTHONLIBS_VERSION_STRING}")

set(PYTHON_SOURCES
    python-module.h
    python-config.h
    python-config.c
    python-helpers.h
    python-helpers.c
    python-main.h
    python-main.c
    python-plugin.c
    python-value-pairs.c
    python-value-pairs.h
    python-dest.c
    python-dest.h
    python-tf.c
    python-tf.h
    python-parser.c
    python-parser.h
    python-logmsg.h
    python-logmsg.c
    python-logtemplate.h
    python-logtemplate.c
    python-logtemplate-options.h
    python-logtemplate-options.c
    python-global-code-loader.h
    python-global-code-loader.c
    python-debugger.c
    python-debugger.h
    python-logparser.h
    python-logparser.c
    python-integerpointer.h
    python-integerpointer.c
    python-source.h
    python-source.c
    python-fetcher.h
    python-fetcher.c
    compat/compat-python.c
    ${CMAKE_CURRENT_BINARY_DIR}/python-grammar.c
    ${CMAKE_CURRENT_BINARY_DIR}/python-grammar.h
)

set (PYTHON_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")

generate_y_from_ym(modules/python/python-grammar)

bison_target(PythonGrammar
    ${CMAKE_CURRENT_BINARY_DIR}/python-grammar.y
    ${CMAKE_CURRENT_BINARY_DIR}/python-grammar.c
    COMPILE_FLAGS ${BISON_FLAGS})

add_subdirectory(pylib)
add_library(mod-python SHARED ${PYTHON_SOURCES})
target_include_directories (mod-python PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_include_directories (mod-python PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories (mod-python PRIVATE ${PYTHON_INCLUDE_DIRS})
target_link_libraries(mod-python PRIVATE syslog-ng ${PYTHON_LIBRARIES} ${Eventlog_LIBRARIES} ${IVYKIS_LIBRARIES})

include(CheckFunctionExists)
if (PYTHONLIBS_VERSION_STRING VERSION_LESS 3)
  target_compile_definitions(mod-python PRIVATE SYSLOG_NG_ENABLE_PYTHONv2=1)
else ()
  target_compile_definitions(mod-python PRIVATE SYSLOG_NG_ENABLE_PYTHONv3=1)
endif ()

add_dependencies(mod-python SetupPylib)
install(TARGETS mod-python DESTINATION lib/syslog-ng/)

add_test_subdirectory(tests)