Skip to content

Commit

Permalink
chore(userspace): manage not bundled libelf dependency adding a custo…
Browse files Browse the repository at this point in the history
…m target

Signed-off-by: Andrea Terzolo <[email protected]>
  • Loading branch information
Andreagit97 authored and poiana committed Dec 15, 2022
1 parent 82f2f4c commit 725732a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cmake/modules/libelf.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ option(USE_BUNDLED_LIBELF "Enable building of the bundled libelf" ${USE_BUNDLED_

if(LIBELF_INCLUDE)
# we already have LIBELF
# We add a custom target, in this way we can always depend on `libelf`
# without distinguishing between "bundled" and "not-bundled" case
add_custom_target(libelf)
elseif(NOT USE_BUNDLED_LIBELF)
find_path(LIBELF_INCLUDE elf.h PATH_SUFFIXES elf)
find_library(LIBELF_LIB NAMES libelf.a libelf.so)
Expand All @@ -13,6 +16,9 @@ elseif(NOT USE_BUNDLED_LIBELF)
else()
message(FATAL_ERROR "Couldn't find system libelf")
endif()
# We add a custom target, in this way we can always depend on `libelf`
# without distinguishing between "bundled" and "not-bundled" case
add_custom_target(libelf)
else()
set(LIBELF_SRC "${PROJECT_BINARY_DIR}/libelf-prefix/src")
set(LIBELF_INCLUDE "${LIBELF_SRC}/libelf/libelf")
Expand Down

0 comments on commit 725732a

Please sign in to comment.