]> granicus.if.org Git - icinga2/blob - lib/config/CMakeLists.txt
Merge branch 'support/2.8'
[icinga2] / lib / config / CMakeLists.txt
1 # Icinga 2
2 # Copyright (C) 2012-2018 Icinga Development Team (https://www.icinga.com/)
3 #
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software Foundation
16 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
17
18 find_package(BISON 2.3.0 REQUIRED)
19 find_package(FLEX 2.5.31 REQUIRED)
20
21 bison_target(config_parser config_parser.yy ${CMAKE_CURRENT_BINARY_DIR}/config_parser.cc)
22 set_property(SOURCE ${CMAKE_CURRENT_BINARY_DIR}/config_parser.cc PROPERTY EXCLUDE_UNITY_BUILD TRUE)
23
24 flex_target(config_lexer config_lexer.ll ${CMAKE_CURRENT_BINARY_DIR}/config_lexer.cc)
25 set_property(SOURCE ${CMAKE_CURRENT_BINARY_DIR}/config_lexer.cc PROPERTY EXCLUDE_UNITY_BUILD TRUE)
26
27 if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
28   set_property(SOURCE ${CMAKE_CURRENT_BINARY_DIR}/config_parser.cc PROPERTY COMPILE_FLAGS "-Wno-deprecated-register -Wno-parentheses-equality -Wno-unused-function")
29   set_property(SOURCE ${CMAKE_CURRENT_BINARY_DIR}/config_lexer.cc PROPERTY COMPILE_FLAGS "-Wno-deprecated-register -Wno-null-conversion")
30 endif()
31
32 add_flex_bison_dependency(config_lexer config_parser)
33
34 include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
35
36 set(config_SOURCES
37   i2-config.hpp
38   activationcontext.cpp activationcontext.hpp
39   applyrule.cpp applyrule.hpp
40   configcompiler.cpp configcompiler.hpp
41   configcompilercontext.cpp configcompilercontext.hpp
42   configfragment.hpp
43   configitem.cpp configitem.hpp
44   configitembuilder.cpp configitembuilder.hpp
45   expression.cpp expression.hpp
46   objectrule.cpp objectrule.hpp
47   vmops.hpp
48   ${FLEX_config_lexer_OUTPUTS} ${BISON_config_parser_OUTPUTS}
49 )
50
51 if(ICINGA2_UNITY_BUILD)
52     mkunity_target(config config config_SOURCES)
53 endif()
54
55 add_library(config OBJECT ${config_SOURCES})
56
57 add_dependencies(config base)
58
59 set_target_properties (
60   config PROPERTIES
61   FOLDER Lib
62 )