mirror of
https://github.com/falcosecurity/falco.git
synced 2025-09-11 11:39:32 +00:00
new(build): add options to use system libcxxopts and libcpp-httplib
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
This commit is contained in:
committed by
poiana
parent
60ef759c70
commit
0fd3732422
@@ -15,14 +15,23 @@
|
|||||||
#
|
#
|
||||||
# cpp-httplib (https://github.com/yhirose/cpp-httplib)
|
# cpp-httplib (https://github.com/yhirose/cpp-httplib)
|
||||||
#
|
#
|
||||||
|
|
||||||
|
option(USE_BUNDLED_CPPHTTPLIB "Enable building of the bundled cpp-httplib" ON)
|
||||||
|
|
||||||
if(CPPHTTPLIB_INCLUDE)
|
if(CPPHTTPLIB_INCLUDE)
|
||||||
# we already have cpp-httplib
|
# we already have cpp-httplib
|
||||||
|
elseif(NOT USE_BUNDLED_CPPHTTPLIB)
|
||||||
|
find_path(CPPHTTPLIB_INCLUDE NAMES httplib.h)
|
||||||
|
|
||||||
|
if(CPPHTTPLIB_INCLUDE)
|
||||||
|
message(STATUS "Found cpp-httplib: include: ${CPPHTTPLIB_INCLUDE}")
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "Couldn't find system cpp-httplib")
|
||||||
|
endif()
|
||||||
else()
|
else()
|
||||||
set(CPPHTTPLIB_SRC "${PROJECT_BINARY_DIR}/cpp-httplib-prefix/src/cpp-httplib")
|
set(CPPHTTPLIB_SRC "${PROJECT_BINARY_DIR}/cpp-httplib-prefix/src/cpp-httplib")
|
||||||
set(CPPHTTPLIB_INCLUDE "${CPPHTTPLIB_SRC}")
|
set(CPPHTTPLIB_INCLUDE "${CPPHTTPLIB_SRC}")
|
||||||
|
|
||||||
message(STATUS "Using bundled cpp-httplib in '${CPPHTTPLIB_SRC}'")
|
|
||||||
|
|
||||||
ExternalProject_Add(cpp-httplib
|
ExternalProject_Add(cpp-httplib
|
||||||
PREFIX "${PROJECT_BINARY_DIR}/cpp-httplib-prefix"
|
PREFIX "${PROJECT_BINARY_DIR}/cpp-httplib-prefix"
|
||||||
URL "https://github.com/yhirose/cpp-httplib/archive/refs/tags/v0.13.1.tar.gz"
|
URL "https://github.com/yhirose/cpp-httplib/archive/refs/tags/v0.13.1.tar.gz"
|
||||||
@@ -31,3 +40,7 @@ else()
|
|||||||
BUILD_COMMAND ""
|
BUILD_COMMAND ""
|
||||||
INSTALL_COMMAND "")
|
INSTALL_COMMAND "")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(NOT TARGET cpp-httplib)
|
||||||
|
add_custom_target(cpp-httplib)
|
||||||
|
endif()
|
@@ -12,9 +12,28 @@
|
|||||||
# specific language governing permissions and limitations under the License.
|
# specific language governing permissions and limitations under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
# cxxopts (https://github.com/jarro2783/cxxopts)
|
||||||
|
#
|
||||||
|
|
||||||
|
option(USE_BUNDLED_CXXOPTS "Enable building of the bundled cxxopts" ON)
|
||||||
|
|
||||||
|
if(CXXOPTS_INCLUDE_DIR)
|
||||||
|
# we already have cxxopts
|
||||||
|
elseif(NOT USE_BUNDLED_CXXOPTS)
|
||||||
|
find_path(CXXOPTS_INCLUDE_DIR NAMES cxxopts.hpp)
|
||||||
|
|
||||||
|
if(CXXOPTS_INCLUDE_DIR)
|
||||||
|
message(STATUS "Found cxxopts: include: ${CXXOPTS_INCLUDE_DIR}")
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "Couldn't find system cxxopts")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
set(CXXOPTS_SRC "${PROJECT_BINARY_DIR}/cxxopts-prefix/src/cxxopts/")
|
set(CXXOPTS_SRC "${PROJECT_BINARY_DIR}/cxxopts-prefix/src/cxxopts/")
|
||||||
set(CXXOPTS_INCLUDE_DIR "${CXXOPTS_SRC}/include")
|
set(CXXOPTS_INCLUDE_DIR "${CXXOPTS_SRC}/include")
|
||||||
|
|
||||||
|
message(STATUS "Using bundled cxxopts in ${CXXOPTS_SRC}")
|
||||||
|
|
||||||
ExternalProject_Add(
|
ExternalProject_Add(
|
||||||
cxxopts
|
cxxopts
|
||||||
URL "https://github.com/jarro2783/cxxopts/archive/refs/tags/v3.0.0.tar.gz"
|
URL "https://github.com/jarro2783/cxxopts/archive/refs/tags/v3.0.0.tar.gz"
|
||||||
@@ -22,3 +41,8 @@ ExternalProject_Add(
|
|||||||
CONFIGURE_COMMAND ""
|
CONFIGURE_COMMAND ""
|
||||||
BUILD_COMMAND ""
|
BUILD_COMMAND ""
|
||||||
INSTALL_COMMAND "")
|
INSTALL_COMMAND "")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT TARGET cxxopts)
|
||||||
|
add_custom_target(cxxopts)
|
||||||
|
endif()
|
||||||
|
Reference in New Issue
Block a user