zeek/tools/bifcl/CMakeLists.txt
Tim Wojtulewicz 68926faf47 Move the bifcl code into the main Zeek repository
This is based on commit 5947749f7850b075f11d6a2aaefe7dad4f63cb62f from
the bifcl repository.
2025-08-15 13:57:27 -07:00

26 lines
1 KiB
CMake

find_package(BISON REQUIRED)
find_package(FLEX REQUIRED)
set(BISON_FLAGS "--debug")
# BIF parser/scanner
bison_target(BIFParser builtin-func.y ${CMAKE_CURRENT_BINARY_DIR}/bif_parse.cc
DEFINES_FILE ${CMAKE_CURRENT_BINARY_DIR}/bif_parse.h COMPILE_FLAGS "${BISON_FLAGS}")
flex_target(BIFScanner builtin-func.l ${CMAKE_CURRENT_BINARY_DIR}/bif_lex.cc)
add_flex_bison_dependency(BIFScanner BIFParser)
set(bifcl_SRCS ${BISON_BIFParser_INPUT} ${FLEX_BIFScanner_INPUT} ${BISON_BIFParser_OUTPUTS}
${FLEX_BIFScanner_OUTPUTS} bif_arg.cc module_util.cc)
add_executable(bifcl ${bifcl_SRCS})
target_include_directories(bifcl BEFORE PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
if (MSVC)
target_compile_options(bifcl PUBLIC "/J") # Similar to -funsigned-char on other platforms
target_compile_options(bifcl PUBLIC "/wd4018") # Similar to -Wno-sign-compare on other platforms
target_link_libraries(bifcl PRIVATE libunistd)
else ()
target_compile_options(bifcl PUBLIC "-Wno-sign-compare")
endif ()
install(TARGETS bifcl DESTINATION bin)