-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
104 lines (89 loc) · 3.06 KB
/
CMakeLists.txt
File metadata and controls
104 lines (89 loc) · 3.06 KB
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
cmake_minimum_required(VERSION 3.14)
project(litehttpd C CXX)
# C11 for module source, C++17 for tests
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Shared library output
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# Include directories
include_directories(${CMAKE_SOURCE_DIR}/include)
# Explicitly list all C source files (preferred over GLOB for reliable builds)
set(MODULE_SOURCES
src/htaccess_cache.c
src/htaccess_cidr.c
src/htaccess_directive.c
src/htaccess_dirwalker.c
src/htaccess_exec_acl.c
src/htaccess_exec_auth.c
src/htaccess_exec_brute_force.c
src/htaccess_exec_dirindex.c
src/htaccess_exec_encoding.c
src/htaccess_exec_env.c
src/htaccess_exec_error_doc.c
src/htaccess_exec_expires.c
src/htaccess_exec_files_match.c
src/htaccess_exec_forcetype.c
src/htaccess_exec_handler.c
src/htaccess_exec_header.c
src/htaccess_exec_limit.c
src/htaccess_exec_options.c
src/htaccess_exec_php.c
src/htaccess_exec_redirect.c
src/htaccess_exec_require.c
src/htaccess_exec_rewrite.c
src/htaccess_expr.c
src/htaccess_expires.c
src/htaccess_parser.c
src/htaccess_printer.c
src/htaccess_shm.c
src/lsiapi_shim.c
src/mod_htaccess.c
src/ols_native_api.c
)
# Build the shared library (.so)
if(MODULE_SOURCES)
add_library(litehttpd_htaccess SHARED ${MODULE_SOURCES})
target_include_directories(litehttpd_htaccess PUBLIC ${CMAKE_SOURCE_DIR}/include)
target_compile_definitions(litehttpd_htaccess PRIVATE MNAME=litehttpd_htaccess)
target_link_libraries(litehttpd_htaccess crypt dl)
set_target_properties(litehttpd_htaccess PROPERTIES
OUTPUT_NAME "litehttpd_htaccess"
PREFIX ""
SUFFIX ".so"
)
endif()
# Testing dependencies — only when BUILD_TESTING is ON (default).
# Use -DBUILD_TESTING=OFF to build only the .so without network access.
option(BUILD_TESTING "Build tests (requires network for googletest/rapidcheck)" ON)
if(BUILD_TESTING)
include(FetchContent)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG v1.14.0
)
FetchContent_Declare(
rapidcheck
GIT_REPOSITORY https://github.com/emil-e/rapidcheck.git
GIT_TAG master # rapidcheck has no tagged releases
)
# Prevent GoogleTest from overriding compiler/linker settings on Windows
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
# Enable RapidCheck Google Test integration (extras/gtest)
set(RC_ENABLE_GTEST ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest rapidcheck)
# Enable testing
enable_testing()
# Add test subdirectory
add_subdirectory(tests)
endif()
# Apache config converter tool (litehttpd-confconv)
add_executable(litehttpd-confconv
tools/ols-confconv.c
tools/apacheconf_parser.c
tools/ols_config_writer.c
)
target_include_directories(litehttpd-confconv PRIVATE ${CMAKE_SOURCE_DIR}/tools)
install(TARGETS litehttpd-confconv DESTINATION bin)