From 0539e948c856f7bc8583ab6b83b86e4d312f7dfb Mon Sep 17 00:00:00 2001 From: Federico Di Pierro Date: Thu, 11 Nov 2021 15:27:04 +0100 Subject: [PATCH] update(build): moved civetweb to its own cmake module. Moved its patch too. Signed-off-by: Federico Di Pierro --- CMakeLists.txt | 31 ++---------------- cmake/modules/civetweb.cmake | 35 +++++++++++++++++++++ cmake/modules/civetweb/patch/civetweb.patch | 16 ++++++++++ 3 files changed, 54 insertions(+), 28 deletions(-) create mode 100644 cmake/modules/civetweb.cmake create mode 100644 cmake/modules/civetweb/patch/civetweb.patch diff --git a/CMakeLists.txt b/CMakeLists.txt index 33a57cc5..2bf258ae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -143,6 +143,9 @@ if(NOT MINIMAL_BUILD) # libcurl include(curl) + + # civetweb + include(civetweb) endif() # Lpeg @@ -157,34 +160,6 @@ include(lyaml) # One TBB include(tbb) -if(NOT MINIMAL_BUILD) - # civetweb - - # Used internally by our patched civetweb cmakelists - set(OPENSSL_LIBRARIES "${OPENSSL_LIBRARY_SSL} ${OPENSSL_LIBRARY_CRYPTO}") - - set(CIVETWEB_SRC "${PROJECT_BINARY_DIR}/civetweb-prefix/src/civetweb/") - set(CIVETWEB_LIB "${CIVETWEB_SRC}/install/lib/libcivetweb.a") - SET(CIVETWEB_CPP_LIB "${CIVETWEB_SRC}/install/lib/libcivetweb-cpp.a") - set(CIVETWEB_INCLUDE_DIR "${CIVETWEB_SRC}/install/include") - message(STATUS "Using bundled civetweb in '${CIVETWEB_SRC}'") - ExternalProject_Add( - civetweb - URL "https://github.com/civetweb/civetweb/archive/v1.15.tar.gz" - URL_HASH "SHA256=90a533422944ab327a4fbb9969f0845d0dba05354f9cacce3a5005fa59f593b9" - INSTALL_DIR ${CIVETWEB_SRC}/install - CMAKE_ARGS - -DBUILD_TESTING=off - -DCIVETWEB_BUILD_TESTING=off - -DCIVETWEB_ENABLE_CXX=on - -DCIVETWEB_ENABLE_SERVER_EXECUTABLE=off - -DCIVETWEB_ENABLE_SSL_DYNAMIC_LOADING=off - -DCIVETWEB_SERVE_NO_FILES=on - -DCMAKE_INSTALL_PREFIX=${CIVETWEB_SRC}/install - BUILD_BYPRODUCTS ${CIVETWEB_LIB} ${CIVETWEB_CPP_LIB} - PATCH_COMMAND patch -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/civetweb.patch) -endif() - #string-view-lite include(DownloadStringViewLite) diff --git a/cmake/modules/civetweb.cmake b/cmake/modules/civetweb.cmake new file mode 100644 index 00000000..080787ff --- /dev/null +++ b/cmake/modules/civetweb.cmake @@ -0,0 +1,35 @@ +# +# Copyright (C) 2021 The Falco Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the +# specific language governing permissions and limitations under the License. +# +# Used internally by our patched civetweb cmakelists +set(OPENSSL_LIBRARIES "${OPENSSL_LIBRARY_SSL} ${OPENSSL_LIBRARY_CRYPTO}") + +set(CIVETWEB_SRC "${PROJECT_BINARY_DIR}/civetweb-prefix/src/civetweb/") +set(CIVETWEB_LIB "${CIVETWEB_SRC}/install/lib/libcivetweb.a") +SET(CIVETWEB_CPP_LIB "${CIVETWEB_SRC}/install/lib/libcivetweb-cpp.a") +set(CIVETWEB_INCLUDE_DIR "${CIVETWEB_SRC}/install/include") +message(STATUS "Using bundled civetweb in '${CIVETWEB_SRC}'") +ExternalProject_Add( + civetweb + URL "https://github.com/civetweb/civetweb/archive/v1.15.tar.gz" + URL_HASH "SHA256=90a533422944ab327a4fbb9969f0845d0dba05354f9cacce3a5005fa59f593b9" + INSTALL_DIR ${CIVETWEB_SRC}/install + CMAKE_ARGS + -DBUILD_TESTING=off + -DCIVETWEB_BUILD_TESTING=off + -DCIVETWEB_ENABLE_CXX=on + -DCIVETWEB_ENABLE_SERVER_EXECUTABLE=off + -DCIVETWEB_ENABLE_SSL_DYNAMIC_LOADING=off + -DCIVETWEB_SERVE_NO_FILES=on + -DCMAKE_INSTALL_PREFIX=${CIVETWEB_SRC}/install + BUILD_BYPRODUCTS ${CIVETWEB_LIB} ${CIVETWEB_CPP_LIB} + PATCH_COMMAND patch -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/civetweb/patch/civetweb.patch) \ No newline at end of file diff --git a/cmake/modules/civetweb/patch/civetweb.patch b/cmake/modules/civetweb/patch/civetweb.patch new file mode 100644 index 00000000..66115aee --- /dev/null +++ b/cmake/modules/civetweb/patch/civetweb.patch @@ -0,0 +1,16 @@ +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 43f3a77e..92664b79 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -53,7 +53,10 @@ if (CIVETWEB_ENABLE_SSL) + target_link_libraries(civetweb-c-library -ldl) + endif() + else() +- find_package(OpenSSL) ++ # Let it use our own provided openssl ++ if (NOT OPENSSL_INCLUDE_DIR) ++ find_package(OpenSSL) ++ endif() + include_directories(${OPENSSL_INCLUDE_DIR}) + message(STATUS "OpenSSL include directory: ${OPENSSL_INCLUDE_DIR}") + target_link_libraries(civetweb-c-library ${OPENSSL_LIBRARIES})