Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ find_program(CLANG_FORMAT_BIN clang-format REQUIRED)

include(GoogleTest)

# Set the default install location to /usr/lib64 on 64-bit systems
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(CMAKE_INSTALL_LIBDIR lib64)
Comment thread
qdeslandes marked this conversation as resolved.
endif()

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_C_STANDARD 17)

Expand Down Expand Up @@ -108,6 +113,9 @@ set(bpfilter_ldflags_debug
-fsanitize=address -fsanitize=undefined
)

configure_file(resources/bpfilter.pc.in ${CMAKE_BINARY_DIR}/bpfilter.pc @ONLY)
install(FILES ${CMAKE_BINARY_DIR}/bpfilter.pc DESTINATION ${CMAKE_INSTALL_PREFIX}/share/pkgconfig)

add_subdirectory(src)
add_subdirectory(lib)
add_subdirectory(tests)
Expand Down
8 changes: 8 additions & 0 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,11 @@ add_custom_target(libbpfilter
DEPENDS libbpfilter_a libbpfilter_so
COMMENT "Compound target to build libbpfilter.a and libbpfilter.so"
)

install(TARGETS libbpfilter_a libbpfilter_so)
install(DIRECTORY "${CMAKE_SOURCE_DIR}/lib/include/bpfilter/"
DESTINATION "include/bpfilter"
)
install(DIRECTORY "${CMAKE_SOURCE_DIR}/shared/include/bpfilter/"
DESTINATION "include/bpfilter"
)
10 changes: 10 additions & 0 deletions resources/bpfilter.pc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
prefix=@CMAKE_INSTALL_PREFIX@
includedir=${prefix}/include
libdir=${prefix}/lib64

Name: bpfilter
Description: BPF-based packet filtering framework
URL: https://github.com/facebook/bpfilter
Version: 0.0.1
Libs: -Wl,-rpath,${libdir} -L${libdir} -lbpfilter
Cflags: -I${includedir}
2 changes: 2 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,5 @@ target_link_libraries(bpfilter
PUBLIC
bpf
)

install(TARGETS bpfilter)