projects
/
project
/
firewall3.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
build: disable the format-truncation warning error to fix gcc 7 build errors
[project/firewall3.git]
/
CMakeLists.txt
diff --git
a/CMakeLists.txt
b/CMakeLists.txt
index
1998190
..
3799bc7
100644
(file)
--- a/
CMakeLists.txt
+++ b/
CMakeLists.txt
@@
-1,29
+1,34
@@
cmake_minimum_required(VERSION 2.6)
PROJECT(firewall3 C)
cmake_minimum_required(VERSION 2.6)
PROJECT(firewall3 C)
-ADD_DEFINITIONS(-Os -Wall -Werror --std=gnu99 -g3 -Wmissing-declarations)
+ADD_DEFINITIONS(-Os -Wall -Werror --std=gnu99 -g3 -Wmissing-declarations -Wno-error=format-truncation)
+
+SET(iptc_libs ip4tc)
SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
-IF(APPLE)
- INCLUDE_DIRECTORIES(/opt/local/include)
- LINK_DIRECTORIES(/opt/local/lib)
+IF (NOT DISABLE_STATIC_EXTENSIONS)
+ LIST(APPEND ext_libs iptext)
+ LIST(APPEND ext_libs iptext4)
+ IF (NOT DISABLE_IPV6)
+ LIST(APPEND ext_libs iptext6)
+ ENDIF()
+ELSE()
+ ADD_DEFINITIONS(-DDISABLE_STATIC_EXTENSIONS)
ENDIF()
ENDIF()
-
ADD_LIBRARY(ext STATIC IMPORTED
)
-
SET_PROPERTY(TARGET ext PROPERTY IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/libext.a
)
-
-
ADD_LIBRARY(ext4 STATIC IMPORTED
)
-
SET_PROPERTY(TARGET ext4 PROPERTY IMPORTED_LOCATION "${CMAKE_SOURCE_DIR}/libext4.a"
)
+
IF (NOT DISABLE_IPV6
)
+
LIST(APPEND iptc_libs ip6tc
)
+ELSE()
+
ADD_DEFINITIONS(-DDISABLE_IPV6
)
+
ENDIF(
)
-
ADD_LIBRARY(ext6 STATIC IMPORTED
)
-
SET_PROPERTY(TARGET ext6 PROPERTY IMPORTED_LOCATION "${CMAKE_SOURCE_DIR}/libext6.a"
)
+
FIND_PATH(uci_include_dir uci.h
)
+
INCLUDE_DIRECTORIES(${uci_include_dir}
)
-ADD_EXECUTABLE(firewall3 main.c options.c defaults.c zones.c forwards.c rules.c redirects.c utils.c ubus.c ipsets.c includes.c iptables.c)
-TARGET_LINK_LIBRARIES(firewall3 uci ubox ubus
ip4tc ip6tc xtables m -Wl,--whole-archive ext ext4 ext6 -Wl,--no-whole-archive
)
+ADD_EXECUTABLE(firewall3 main.c options.c defaults.c zones.c forwards.c rules.c redirects.c
snats.c
utils.c ubus.c ipsets.c includes.c iptables.c)
+TARGET_LINK_LIBRARIES(firewall3 uci ubox ubus
xtables m dl ${iptc_libs} ${ext_libs}
)
SET(CMAKE_INSTALL_PREFIX /usr)
SET(CMAKE_INSTALL_PREFIX /usr)
-INSTALL(TARGETS firewall3
- RUNTIME DESTINATION sbin
-)
+INSTALL(TARGETS firewall3 RUNTIME DESTINATION sbin)