Skip to content

Commit 8dfcb34

Browse files
committed
fix(cmake): enable webserver deps on macOS (httplib include/link)
Root CMake skipped openssl/curl/cpp-httplib and c-ares on APPLE while state.h still included webserver.h on all non-Windows Unix builds, causing missing httplib.h on Darwin. Align userspace/falco targets with those conditions, fix FALCO_INCLUDE_DIRECTORIES typo, and gate CPPHTTPLIB_OPENSSL_SUPPORT with the webserver block. Signed-off-by: Mike Yoder <myoder@roblox.com>
1 parent 514470a commit 8dfcb34

2 files changed

Lines changed: 7 additions & 13 deletions

File tree

CMakeLists.txt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@ include(njson)
174174
include(yaml-cpp)
175175

176176
if(NOT WIN32
177-
AND NOT APPLE
178177
AND NOT MINIMAL_BUILD
179178
AND NOT EMSCRIPTEN
180179
)
@@ -184,7 +183,7 @@ if(NOT WIN32
184183
# libcurl
185184
include(curl)
186185

187-
# todo(jasondellaluce,rohith-raju): support webserver for non-linux builds too cpp-httlib
186+
# cpp-httplib (health/metrics webserver; used on all non-Windows Unix, e.g. Linux and macOS)
188187
include(cpp-httplib)
189188
endif()
190189

@@ -203,10 +202,7 @@ if(USE_GPERFTOOLS)
203202
include(gperftools)
204203
endif()
205204
if(NOT MINIMAL_BUILD)
206-
if(NOT WIN32
207-
AND NOT APPLE
208-
AND NOT EMSCRIPTEN
209-
)
205+
if(NOT WIN32 AND NOT EMSCRIPTEN)
210206
include(cares)
211207
endif()
212208
endif()

userspace/falco/CMakeLists.txt

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,30 +81,28 @@ if(NOT WIN32)
8181
target_sources(falco_application PRIVATE outputs_program.cpp outputs_syslog.cpp)
8282
endif()
8383

84-
if(CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT MINIMAL_BUILD)
84+
if(NOT WIN32 AND NOT EMSCRIPTEN AND NOT MINIMAL_BUILD)
8585
target_sources(falco_application PRIVATE outputs_http.cpp falco_metrics.cpp webserver.cpp)
8686

87-
list(APPEND FALCO_INCLUDE_DIRECTORIES FALCO_INCLUDE_DIRECTORIES "${OPENSSL_INCLUDE_DIR}"
88-
"${CARES_INCLUDE}"
89-
)
87+
list(APPEND FALCO_INCLUDE_DIRECTORIES "${OPENSSL_INCLUDE_DIR}" "${CARES_INCLUDE}")
9088

9189
if(TARGET c-ares)
9290
list(APPEND FALCO_DEPENDENCIES c-ares)
9391
endif()
9492

95-
if(CMAKE_SYSTEM_NAME MATCHES "Linux" AND USE_BUNDLED_CURL)
93+
if(USE_BUNDLED_CURL)
9694
list(APPEND FALCO_DEPENDENCIES curl)
9795
endif()
9896

9997
list(APPEND FALCO_LIBRARIES httplib::httplib "${CURL_LIBRARIES}" "${CARES_LIB}")
98+
99+
target_compile_definitions(falco_application PRIVATE CPPHTTPLIB_OPENSSL_SUPPORT)
100100
endif()
101101

102102
if(EMSCRIPTEN)
103103
target_compile_options(falco_application PRIVATE "-sDISABLE_EXCEPTION_CATCHING=0")
104104
endif()
105105

106-
target_compile_definitions(falco_application PRIVATE CPPHTTPLIB_OPENSSL_SUPPORT)
107-
108106
add_dependencies(falco_application ${FALCO_DEPENDENCIES})
109107

110108
target_link_libraries(falco_application ${FALCO_LIBRARIES})

0 commit comments

Comments
 (0)