forked from Annihil/mod_defender
-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
47 lines (36 loc) · 1.41 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
cmake_minimum_required(VERSION 3.2)
project(mod_defender)
set(CMAKE_BUILD_TYPE Release)
set(CMAKE_SHARED_LIBRARY_PREFIX "")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules")
set(CMAKE_CXX_FLAGS "-W -Wall -Wextra")
message("FLAGS = ${CMAKE_CXX_FLAGS}")
find_package(Apache)
find_package(Apr)
include_directories(deps ${APACHE_INC} ${APR_INC})
set(CMAKE_CXX_STANDARD 11)
file(GLOB SOURCE_FILES *.cpp deps/libinjection/*.c)
add_library(mod_defender SHARED ${SOURCE_FILES})
if (AUTO)
set(STOP_APACHE_CMD sudo systemctl stop apache2)
set(START_APACHE_CMD sudo systemctl start apache2)
set(AP_MODS_AV /etc/apache2/mods-available)
set(AP_MODS_DIR /usr/lib/apache2/modules)
if (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
set(STOP_APACHE_CMD service apache24 restart)
set(START_APACHE_CMD service apache24 restart)
set(AP_MODS_DIR /usr/local/libexec/apache24/)
if (EXISTS "/usr/local/etc/rc.d/vulture")
set(STOP_APACHE_CMD "")
set(START_APACHE_CMD "")
set(AP_MODS_DIR /usr/home/vlt-sys/Engine/modules/)
endif ()
endif ()
add_custom_command(
TARGET mod_defender
POST_BUILD
COMMAND ${STOP_APACHE_CMD}
COMMAND cp $<TARGET_FILE:mod_defender> ${AP_MODS_DIR}
COMMAND ${START_APACHE_CMD}
COMMENT "Copying module then restarting Apache")
endif ()