mirror of
https://github.com/falcosecurity/falco.git
synced 2025-08-07 09:13:57 +00:00
refactor: Use FetchContent for integrating bundled cpp-httplib
Signed-off-by: Federico Aponte <federico.aponte@sysdig.com>
This commit is contained in:
parent
bc499e191d
commit
c32b7c1246
@ -12,32 +12,15 @@
|
|||||||
# specific language governing permissions and limitations under the License.
|
# specific language governing permissions and limitations under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
#
|
|
||||||
# cpp-httplib (https://github.com/yhirose/cpp-httplib)
|
|
||||||
#
|
|
||||||
|
|
||||||
option(USE_BUNDLED_CPPHTTPLIB "Enable building of the bundled cpp-httplib" ${USE_BUNDLED_DEPS})
|
option(USE_BUNDLED_CPPHTTPLIB "Enable building of the bundled cpp-httplib" ${USE_BUNDLED_DEPS})
|
||||||
|
|
||||||
if(CPPHTTPLIB_INCLUDE)
|
if(USE_BUNDLED_CPPHTTPLIB)
|
||||||
# we already have cpp-httplib
|
include(FetchContent)
|
||||||
elseif(NOT USE_BUNDLED_CPPHTTPLIB)
|
FetchContent_Declare(cpp-httplib
|
||||||
find_package(httplib CONFIG REQUIRED)
|
URL https://github.com/yhirose/cpp-httplib/archive/refs/tags/v0.15.3.tar.gz
|
||||||
get_target_property(CPPHTTPLIB_INCLUDE httplib::httplib INTERFACE_INCLUDE_DIRECTORIES)
|
URL_HASH SHA256=2121bbf38871bb2aafb5f7f2b9b94705366170909f434428352187cb0216124e
|
||||||
|
)
|
||||||
|
FetchContent_MakeAvailable(cpp-httplib)
|
||||||
else()
|
else()
|
||||||
set(CPPHTTPLIB_SRC "${PROJECT_BINARY_DIR}/cpp-httplib-prefix/src/cpp-httplib")
|
find_package(httplib CONFIG REQUIRED)
|
||||||
set(CPPHTTPLIB_INCLUDE "${CPPHTTPLIB_SRC}")
|
|
||||||
|
|
||||||
message(STATUS "Using bundled cpp-httplib in ${CPPHTTPLIB_SRC}")
|
|
||||||
|
|
||||||
ExternalProject_Add(cpp-httplib
|
|
||||||
PREFIX "${PROJECT_BINARY_DIR}/cpp-httplib-prefix"
|
|
||||||
URL "https://github.com/yhirose/cpp-httplib/archive/refs/tags/v0.13.1.tar.gz"
|
|
||||||
URL_HASH "SHA256=9b837d290b61e3f0c4239da0b23bbf14c382922e2bf2a9bac21c1e3feabe1ff9"
|
|
||||||
CONFIGURE_COMMAND ""
|
|
||||||
BUILD_COMMAND ""
|
|
||||||
INSTALL_COMMAND "")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT TARGET cpp-httplib)
|
|
||||||
add_custom_target(cpp-httplib)
|
|
||||||
endif()
|
endif()
|
@ -115,7 +115,6 @@ if(CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT MINIMAL_BUILD)
|
|||||||
|
|
||||||
list(
|
list(
|
||||||
APPEND FALCO_INCLUDE_DIRECTORIES
|
APPEND FALCO_INCLUDE_DIRECTORIES
|
||||||
"${CPPHTTPLIB_INCLUDE}"
|
|
||||||
"${OPENSSL_INCLUDE_DIR}"
|
"${OPENSSL_INCLUDE_DIR}"
|
||||||
"${GRPC_INCLUDE}"
|
"${GRPC_INCLUDE}"
|
||||||
"${GRPCPP_INCLUDE}"
|
"${GRPCPP_INCLUDE}"
|
||||||
@ -128,10 +127,9 @@ if(CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT MINIMAL_BUILD)
|
|||||||
list(APPEND FALCO_LIBRARIES "${GRPC_LIBRARIES}")
|
list(APPEND FALCO_LIBRARIES "${GRPC_LIBRARIES}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
list(APPEND FALCO_DEPENDENCIES cpp-httplib)
|
|
||||||
|
|
||||||
list(
|
list(
|
||||||
APPEND FALCO_LIBRARIES
|
APPEND FALCO_LIBRARIES
|
||||||
|
httplib::httplib
|
||||||
"${GRPCPP_LIB}"
|
"${GRPCPP_LIB}"
|
||||||
"${GRPC_LIB}"
|
"${GRPC_LIB}"
|
||||||
"${GPR_LIB}"
|
"${GPR_LIB}"
|
||||||
@ -151,6 +149,8 @@ if (EMSCRIPTEN)
|
|||||||
target_compile_options(falco_application PRIVATE "-sDISABLE_EXCEPTION_CATCHING=0")
|
target_compile_options(falco_application PRIVATE "-sDISABLE_EXCEPTION_CATCHING=0")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
target_compile_definitions(falco_application PRIVATE CPPHTTPLIB_OPENSSL_SUPPORT)
|
||||||
|
|
||||||
add_dependencies(falco_application ${FALCO_DEPENDENCIES})
|
add_dependencies(falco_application ${FALCO_DEPENDENCIES})
|
||||||
|
|
||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
|
Loading…
Reference in New Issue
Block a user