diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2021-05-11 17:51:57 +0200 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2021-05-11 17:51:57 +0200 |
commit | 50f9c1bba149e6cd5cb512087f60ad6e293ea542 (patch) | |
tree | 3948b4d632c2538a7fee71581513f8cfe749a7a1 | |
parent | 98a6dc5d3bacc5bf797d64eebd426fbcf23bdb95 (diff) |
OpenWrt compatible build system.1.2
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
-rw-r--r-- | CMakeLists.txt | 45 |
1 files changed, 32 insertions, 13 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index eeb5cce1a..93ec301e6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,6 +8,7 @@ option(ENABLE_SANITIZER_THREAD "Enable TSAN (does not work together with ASAN)." option(ENABLE_MEMORY_PROFILING "Enable dynamic memory tracking." OFF) option(BUILD_EXAMPLES "Build C examples." ON) option(BUILD_NDPI "Clone and build nDPI from github." OFF) +option(NDPI_NO_PKGCONFIG "Do not use pkgconfig to search for libnDPI." OFF) set(STATIC_LIBNDPI_INSTALLDIR "" CACHE STRING "Path to a installation directory of libnDPI e.g. /opt/libnDPI/usr") @@ -43,7 +44,7 @@ if(ENABLE_SANITIZER_THREAD) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined -fsanitize=enum -fsanitize=thread") endif() -if(BUILD_NDPI) +if(STATIC_LIBNDPI_INSTALLDIR STREQUAL "" AND BUILD_NDPI) include(ExternalProject) ExternalProject_Add( libnDPI @@ -60,7 +61,7 @@ if(BUILD_NDPI) add_dependencies(nDPId-test libnDPI) endif() -if(NOT STATIC_LIBNDPI_INSTALLDIR STREQUAL "" OR BUILD_NDPI) +if(NOT STATIC_LIBNDPI_INSTALLDIR STREQUAL "" OR BUILD_NDPI OR NDPI_NO_PKGCONFIG) option(NDPI_WITH_GCRYPT "Link static libndpi library against libgcrypt." ON) option(NDPI_WITH_PCRE "Link static libndpi library against libpcre." OFF) option(NDPI_WITH_MAXMINDDB "Link static libndpi library against libmaxminddb." OFF) @@ -72,16 +73,28 @@ if(NOT STATIC_LIBNDPI_INSTALLDIR STREQUAL "" OR BUILD_NDPI) if(NDPI_WITH_PCRE) pkg_check_modules(PCRE REQUIRED libpcre>=8.39) endif() + if(NDPI_WITH_MAXMINDDB) pkg_check_modules(MAXMINDDB REQUIRED libmaxminddb) endif() +endif() +if(NOT STATIC_LIBNDPI_INSTALLDIR STREQUAL "" OR BUILD_NDPI) set(STATIC_LIBNDPI_INC "${STATIC_LIBNDPI_INSTALLDIR}/include/ndpi") set(STATIC_LIBNDPI_LIB "${STATIC_LIBNDPI_INSTALLDIR}/lib/libndpi.a") else() - pkg_check_modules(NDPI REQUIRED libndpi>=3.5.0) - set(STATIC_LIBNDPI_INC "") - set(STATIC_LIBNDPI_LIB "") + if(NOT NDPI_NO_PKGCONFIG) + pkg_check_modules(NDPI REQUIRED libndpi>=3.5.0) + + set(STATIC_LIBNDPI_INC "") + set(STATIC_LIBNDPI_LIB "") + else() + set(LIBNDPI_INC "" CACHE STRING "/usr/include/ndpi") + set(LIBNDPI_LIB "" CACHE STRING "/usr/lib/libndpi.a") + + set(STATIC_LIBNDPI_INC "${LIBNDPI_INC}") + set(STATIC_LIBNDPI_LIB "${LIBNDPI_LIB}") + endif() endif() find_package(PCAP "1.8.1" REQUIRED) @@ -152,15 +165,21 @@ endif() message(STATUS "ENABLE_SANITIZER.........: ${ENABLE_SANITIZER}") message(STATUS "ENABLE_SANITIZER_THREAD..: ${ENABLE_SANITIZER_THREAD}") message(STATUS "ENABLE_MEMORY_PROFILING..: ${ENABLE_MEMORY_PROFILING}") -if(NOT BUILD_NDPI) +if(NOT BUILD_NDPI AND NOT STATIC_LIBNDPI_INSTALLDIR STREQUAL "") message(STATUS "STATIC_LIBNDPI_INSTALLDIR: ${STATIC_LIBNDPI_INSTALLDIR}") -if(NOT STATIC_LIBNDPI_INSTALLDIR STREQUAL "") -message(STATUS "`- STATIC_LIBNDPI_INC....: ${STATIC_LIBNDPI_INC}") -message(STATUS "`- STATIC_LIBNDPI_LIB....: ${STATIC_LIBNDPI_LIB}") -message(STATUS "`- NDPI_WITH_GCRYPT......: ${NDPI_WITH_GCRYPT}") -message(STATUS "`- NDPI_WITH_PCRE........: ${NDPI_WITH_PCRE}") -message(STATUS "`- NDPI_WITH_MAXMINDDB...: ${NDPI_WITH_MAXMINDDB}") -endif() endif() message(STATUS "BUILD_NDPI...............: ${BUILD_NDPI}") +message(STATUS "NDPI_NO_PKGCONFIG........: ${NDPI_NO_PKGCONFIG}") +if(NDPI_NO_PKGCONFIG) +message(STATUS "LIBNDPI_INC..............: ${LIBNDPI_INC}") +message(STATUS "LIBNDPI_LIB..............: ${LIBNDPI_LIB}") +endif() +if(NOT STATIC_LIBNDPI_INSTALLDIR STREQUAL "" OR BUILD_NDPI OR NDPI_NO_PKGCONFIG) +message(STATUS "--------------------------") +message(STATUS "- STATIC_LIBNDPI_INC....: ${STATIC_LIBNDPI_INC}") +message(STATUS "- STATIC_LIBNDPI_LIB....: ${STATIC_LIBNDPI_LIB}") +message(STATUS "- NDPI_WITH_GCRYPT......: ${NDPI_WITH_GCRYPT}") +message(STATUS "- NDPI_WITH_PCRE........: ${NDPI_WITH_PCRE}") +message(STATUS "- NDPI_WITH_MAXMINDDB...: ${NDPI_WITH_MAXMINDDB}") +endif() message(STATUS "--------------------------") |