diff --git a/CMakeLists.txt b/CMakeLists.txt index 4198f4015e2..827ce24dc40 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -174,7 +174,6 @@ include(njson) include(yaml-cpp) if(NOT WIN32 - AND NOT APPLE AND NOT MINIMAL_BUILD AND NOT EMSCRIPTEN ) @@ -184,7 +183,7 @@ if(NOT WIN32 # libcurl include(curl) - # todo(jasondellaluce,rohith-raju): support webserver for non-linux builds too cpp-httlib + # cpp-httplib (health/metrics webserver; used on all non-Windows Unix, e.g. Linux and macOS) include(cpp-httplib) endif() @@ -203,10 +202,7 @@ if(USE_GPERFTOOLS) include(gperftools) endif() if(NOT MINIMAL_BUILD) - if(NOT WIN32 - AND NOT APPLE - AND NOT EMSCRIPTEN - ) + if(NOT WIN32 AND NOT EMSCRIPTEN) include(cares) endif() endif() diff --git a/userspace/falco/CMakeLists.txt b/userspace/falco/CMakeLists.txt index 39e48753c34..91b1fea8870 100644 --- a/userspace/falco/CMakeLists.txt +++ b/userspace/falco/CMakeLists.txt @@ -81,30 +81,38 @@ if(NOT WIN32) target_sources(falco_application PRIVATE outputs_program.cpp outputs_syslog.cpp) endif() -if(CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT MINIMAL_BUILD) +if(NOT WIN32 + AND NOT EMSCRIPTEN + AND NOT MINIMAL_BUILD +) target_sources(falco_application PRIVATE outputs_http.cpp falco_metrics.cpp webserver.cpp) - list(APPEND FALCO_INCLUDE_DIRECTORIES FALCO_INCLUDE_DIRECTORIES "${OPENSSL_INCLUDE_DIR}" - "${CARES_INCLUDE}" - ) + list(APPEND FALCO_INCLUDE_DIRECTORIES "${OPENSSL_INCLUDE_DIR}" "${CARES_INCLUDE}") if(TARGET c-ares) list(APPEND FALCO_DEPENDENCIES c-ares) endif() - if(CMAKE_SYSTEM_NAME MATCHES "Linux" AND USE_BUNDLED_CURL) + if(USE_BUNDLED_CURL) list(APPEND FALCO_DEPENDENCIES curl) endif() - list(APPEND FALCO_LIBRARIES httplib::httplib "${CURL_LIBRARIES}" "${CARES_LIB}") + if(USE_BUNDLED_OPENSSL) + list(APPEND FALCO_DEPENDENCIES openssl) + endif() + + # libcurl (static) and cpp-httplib SSL pull in OpenSSL; falco_engine only links it on Linux. + list(APPEND FALCO_LIBRARIES httplib::httplib "${CURL_LIBRARIES}" "${OPENSSL_LIBRARIES}" + "${CARES_LIB}" + ) + + target_compile_definitions(falco_application PRIVATE CPPHTTPLIB_OPENSSL_SUPPORT) endif() if(EMSCRIPTEN) target_compile_options(falco_application PRIVATE "-sDISABLE_EXCEPTION_CATCHING=0") endif() -target_compile_definitions(falco_application PRIVATE CPPHTTPLIB_OPENSSL_SUPPORT) - add_dependencies(falco_application ${FALCO_DEPENDENCIES}) target_link_libraries(falco_application ${FALCO_LIBRARIES})