forked from fwbuilder/fwbuilder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
123 lines (101 loc) · 3.57 KB
/
CMakeLists.txt
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
cmake_minimum_required(VERSION 3.5)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9"
CACHE STRING "Minimum macOS deployment version"
)
find_program(CCACHE_PROGRAM ccache)
if(CCACHE_PROGRAM)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
endif()
project(firewallbuilder LANGUAGES CXX C)
### Version variables and include file
include(VERSION)
configure_file("${CMAKE_SOURCE_DIR}/src/version.h.in" "${CMAKE_BINARY_DIR}/src/version.h" @ONLY)
include_directories(${CMAKE_BINARY_DIR}/src)
### Build type
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING
"Choose the type of build, options are: Debug or Release."
FORCE)
endif()
include( CTest )
### Dependencies
find_package(Qt5Widgets REQUIRED)
find_package(Qt5Network REQUIRED)
find_package(Qt5PrintSupport REQUIRED)
find_package(LibXml2 REQUIRED)
find_package(LibXslt REQUIRED)
find_package(NetSNMP)
if(NETSNMP_FOUND)
add_definitions(-DHAVE_LIBSNMP -DNET_SNMP -DHAVE_SNPRINT_OBJID)
endif()
### Compiler options
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CXX_DEFAULT_FLAGS # clang/GCC warnings
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:GNU>>:-Wall;-Wextra;-Werror;-Wno-overloaded-virtual>
# MSVC warnings
$<$<CXX_COMPILER_ID:MSVC>:/WX;/W4>)
add_definitions(-D__STDC_FORMAT_MACROS)
if(WIN32)
#add_definitions(-DIN_LIBXML) # Enable for static build
add_definitions(-DWIN32_LEAN_AND_MEAN)
endif()
### Install
if(APPLE)
set(APP_ICON_FILE fwbuilder-macosx.icns)
set(APP_ICON "${PROJECT_SOURCE_DIR}/src/gui/${APP_ICON_FILE}")
set(APPLICATION_NAME fwbuilder)
set(MACOSX_BUNDLE_ICON_FILE ${APP_ICON_FILE})
set(MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_GENERATION})
set(MACOSX_BUNDLE_VERSION ${VERSION})
set(MACOSX_BUNDLE_LONG_VERSION_STRING ${VERSION})
set_source_files_properties(${APP_ICON} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install")
set(FWB_INSTALL_DATADIR ${APPLICATION_NAME}.app/Contents/Resources)
set(FWB_INSTALL_DOCDIR ${FWB_INSTALL_DATADIR}/doc)
set(FWB_INSTALL_BINDIR ${APPLICATION_NAME}.app/Contents/MacOS)
elseif(WIN32)
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR})
set(FWB_INSTALL_DATADIR release/resources)
set(FWB_INSTALL_DOCDIR release/doc)
set(FWB_INSTALL_BINDIR release)
else()
include(GNUInstallDirs)
set(FWB_INSTALL_DATADIR ${CMAKE_INSTALL_DATADIR}/fwbuilder-${PROJECT_VERSION})
set(FWB_INSTALL_DOCDIR ${CMAKE_INSTALL_DATADIR}/doc/fwbuilder-${PROJECT_VERSION})
set(FWB_INSTALL_BINDIR ${CMAKE_INSTALL_BINDIR})
endif()
### Sources
add_subdirectory(src/libfwbuilder/src/fwcompiler)
add_subdirectory(src/libfwbuilder/src/fwbuilder)
add_subdirectory(src/common)
add_subdirectory(src/antlr)
add_subdirectory(src/compiler_lib)
add_subdirectory(src/cisco_lib)
add_subdirectory(src/juniper_lib)
add_subdirectory(src/pflib)
add_subdirectory(src/iptlib)
add_subdirectory(src/ipt)
add_subdirectory(src/pf)
add_subdirectory(src/ipf)
add_subdirectory(src/ipfw)
add_subdirectory(src/iosacl)
add_subdirectory(src/nxosacl)
add_subdirectory(src/junosacl)
add_subdirectory(src/pix)
add_subdirectory(src/procurve_acl)
add_subdirectory(src/libgui)
add_subdirectory(src/import)
add_subdirectory(src/parsers)
add_subdirectory(src/gui)
add_subdirectory(src/fwbedit)
add_subdirectory(src/libfwbuilder/etc)
add_subdirectory(src/libfwbuilder/migration)
add_subdirectory(src/res)
add_subdirectory(doc)
if(UNIX AND NOT APPLE)
add_subdirectory(src/unit_tests)
endif()
### Packaging
add_subdirectory(packaging)