CMakeLists: Use lib/bpf/include/uapi when building libdwarves

To avoid using /usr/include/linux/btf.h, as it has:

  [acme@quaco pahole]$ grep ^# /usr/include/linux/btf.h | head -2
  #ifndef __LINUX_BTF_H__
  #define __LINUX_BTF_H__
  [acme@quaco pahole]$

While:

  [acme@quaco pahole]$ grep ^# lib/bpf/include/uapi/linux/btf.h | head -2
  #ifndef _UAPI__LINUX_BTF_H__
  #define _UAPI__LINUX_BTF_H__
  [acme@quaco pahole]$

Then when both get included we get duplicate definitions, to avoid that
put lib/bpf/include/uapi/ first in the include path for libbdwarves.

Cc: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Arnaldo Carvalho de Melo 2019-10-21 18:25:41 -03:00
parent 95517e1d99
commit ba27df9f2f
1 changed files with 2 additions and 0 deletions

View File

@ -87,6 +87,8 @@ set(dwarves_LIB_SRCS dwarves.c dwarves_fprintf.c gobuffer strings
add_library(dwarves SHARED ${dwarves_LIB_SRCS} $<TARGET_OBJECTS:bpf>)
set_target_properties(dwarves PROPERTIES VERSION 1.0.0 SOVERSION 1)
set_target_properties(dwarves PROPERTIES INTERFACE_LINK_LIBRARIES "")
target_include_directories(dwarves PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/lib/bpf/include/uapi)
target_link_libraries(dwarves ${DWARF_LIBRARIES} ${ZLIB_LIBRARIES})
set(dwarves_emit_LIB_SRCS dwarves_emit.c)