mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Moved the logic to build BinPAC locally to FindBinPAC module.
This commit is contained in:
parent
47de996544
commit
afb5bd8ce7
3 changed files with 38 additions and 35 deletions
|
@ -58,7 +58,7 @@ set(ENABLE_PERFTOOLS false
|
||||||
# Uncomment to prefer building BinPAC from existing sources rather than
|
# Uncomment to prefer building BinPAC from existing sources rather than
|
||||||
# use an existing installation (i.e. you have initialized Bro's BinPAC
|
# use an existing installation (i.e. you have initialized Bro's BinPAC
|
||||||
# git submodule and updated sources local to the Bro source tree)
|
# git submodule and updated sources local to the Bro source tree)
|
||||||
#set(BinPAC_PREFER_LOCAL_BUILD true)
|
#set(BinPAC_PREFER_BUILD true)
|
||||||
|
|
||||||
# Comment this if local build of BinPAC should be scheduled for installation
|
# Comment this if local build of BinPAC should be scheduled for installation
|
||||||
set(BinPAC_SKIP_INSTALL true)
|
set(BinPAC_SKIP_INSTALL true)
|
||||||
|
|
|
@ -70,25 +70,7 @@ find_package(BISON REQUIRED)
|
||||||
find_package(PCAP REQUIRED)
|
find_package(PCAP REQUIRED)
|
||||||
find_package(OpenSSL REQUIRED)
|
find_package(OpenSSL REQUIRED)
|
||||||
find_package(BIND REQUIRED)
|
find_package(BIND REQUIRED)
|
||||||
|
find_package(BinPAC REQUIRED)
|
||||||
# This test is for when the user would like to use rebuild BinPAC
|
|
||||||
# rather than use an existing installation
|
|
||||||
if (NOT BinPAC_PREFER_LOCAL_BUILD)
|
|
||||||
find_package(BinPAC)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
if (NOT BINPAC_FOUND)
|
|
||||||
# check if we can build BinPAC locally
|
|
||||||
if (EXISTS ${CMAKE_SOURCE_DIR}/binpac/CMakeLists.txt)
|
|
||||||
add_subdirectory(binpac)
|
|
||||||
# find_package called just to set the _FOUND variable
|
|
||||||
find_package(BinPAC)
|
|
||||||
message(STATUS "Building local version of BinPAC")
|
|
||||||
else ()
|
|
||||||
message(FATAL_ERROR "BinPAC required but it is not installed and"
|
|
||||||
" the sources to build it are also not found.")
|
|
||||||
endif ()
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
set(HAVE_LIBMAGIC false)
|
set(HAVE_LIBMAGIC false)
|
||||||
find_package(LibMagic)
|
find_package(LibMagic)
|
||||||
|
|
|
@ -10,6 +10,10 @@
|
||||||
# BinPAC_ROOT_DIR Set this variable to the root installation of
|
# BinPAC_ROOT_DIR Set this variable to the root installation of
|
||||||
# BinPAC if the module has problems finding the
|
# BinPAC if the module has problems finding the
|
||||||
# proper installation path.
|
# proper installation path.
|
||||||
|
# BinPAC_PREFER_BUILD Set this to true if BinPAC should be built
|
||||||
|
# from sources located in the root source
|
||||||
|
# directory in subidrectory 'binpac'. The
|
||||||
|
# module will not look for BinPAC elsewhere.
|
||||||
#
|
#
|
||||||
# Variables defined by this module:
|
# Variables defined by this module:
|
||||||
#
|
#
|
||||||
|
@ -18,24 +22,41 @@
|
||||||
# BinPAC_LIBRARY The libbinpac.a library
|
# BinPAC_LIBRARY The libbinpac.a library
|
||||||
# BinPAC_INCLUDE_DIR The binpac headers
|
# BinPAC_INCLUDE_DIR The binpac headers
|
||||||
|
|
||||||
find_path(BinPAC_ROOT_DIR
|
if (BinPAC_PREFER_BUILD)
|
||||||
NAMES include/binpac.h
|
# check if we can build BinPAC locally
|
||||||
)
|
if (EXISTS ${CMAKE_SOURCE_DIR}/binpac/CMakeLists.txt)
|
||||||
|
if (NOT BinPAC_EXE)
|
||||||
|
# Display only first time
|
||||||
|
message(STATUS "Building local version of BinPAC")
|
||||||
|
endif ()
|
||||||
|
# BinPAC's CMake project must declare:
|
||||||
|
# BinPAC_EXE, BinPAC_LIBRARY, BinPAC_INCLUDE_DIR
|
||||||
|
add_subdirectory(${CMAKE_SOURCE_DIR}/binpac)
|
||||||
|
else ()
|
||||||
|
message(WARNING "Option to build BinPAC from source selected, "
|
||||||
|
"but no sources found in ${CMAKE_SOURCE_DIR}/binpac")
|
||||||
|
endif ()
|
||||||
|
else ()
|
||||||
|
# look for BinPAC in standard locations or user-provided root
|
||||||
|
find_path(BinPAC_ROOT_DIR
|
||||||
|
NAMES include/binpac.h
|
||||||
|
)
|
||||||
|
|
||||||
find_file(BinPAC_EXE
|
find_file(BinPAC_EXE
|
||||||
NAMES binpac
|
NAMES binpac
|
||||||
HINTS ${BinPAC_ROOT_DIR}/bin
|
HINTS ${BinPAC_ROOT_DIR}/bin
|
||||||
)
|
)
|
||||||
|
|
||||||
find_library(BinPAC_LIBRARY
|
find_library(BinPAC_LIBRARY
|
||||||
NAMES libbinpac.a
|
NAMES libbinpac.a
|
||||||
HINTS ${BinPAC_ROOT_DIR}/lib
|
HINTS ${BinPAC_ROOT_DIR}/lib
|
||||||
)
|
)
|
||||||
|
|
||||||
find_path(BinPAC_INCLUDE_DIR
|
find_path(BinPAC_INCLUDE_DIR
|
||||||
NAMES binpac.h
|
NAMES binpac.h
|
||||||
HINTS ${BinPAC_ROOT_DIR}/include
|
HINTS ${BinPAC_ROOT_DIR}/include
|
||||||
)
|
)
|
||||||
|
endif ()
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
include(FindPackageHandleStandardArgs)
|
||||||
find_package_handle_standard_args(BinPAC DEFAULT_MSG
|
find_package_handle_standard_args(BinPAC DEFAULT_MSG
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue