set(PACKAGE base-exthdr_lib)

message(STATUS ${PACKAGE})

list(APPEND INST_INCLUDES exten_header.h exten_header_plugin.h)
set(LIB_NAME exthdr)

set(SOURCE_FILES exten_header.h exten_header_plugin.h exten_header.c)

add_library(${LIB_NAME} SHARED ${SOURCE_FILES})

set(LIB_MAJOR_VER 10) # Set Library major version, this is also used for SO file versioning
set(LIB_MINOR_VER 0) # Set Library minor version
set(LIB_PATCH_VER 0) # Set Library patch version
set(LIB_VERSION "${LIB_MAJOR_VER}.${LIB_MINOR_VER}.${LIB_PATCH_VER}")
set_target_properties(${LIB_NAME} PROPERTIES VERSION ${LIB_VERSION} SOVERSION ${LIB_MAJOR_VER})

set_target_properties(
  ${LIB_NAME}
  PROPERTIES COMPILE_FLAGS
             "-DLinux -DPLUGINDIR=\"\\\"${IRIS_LIB}/exthdr/plugins\\\"\"")

add_executable(plugin_test plugin_test.c)
target_link_libraries(plugin_test exthdr dl popt)

add_executable(udp_pipe udp_pipe.c)
target_link_libraries(udp_pipe exthdr dl popt m)

install(
  TARGETS ${LIB_NAME}
  DESTINATION ${IRIS_LIB}
  LIBRARY COMPONENT base NAMELINK_COMPONENT devel)
  
install(
  FILES ${INST_INCLUDES}
  DESTINATION ${IRIS_INCLUDE}
  COMPONENT devel)
