cmake: add vapi build
Change-Id: Id939a0cbe35601478ad262f49bb0a1abdb62aa45
Signed-off-by: Damjan Marion <damarion@cisco.com>
diff --git a/src/cmake/api.cmake b/src/cmake/api.cmake
index 644e80b..533448a 100644
--- a/src/cmake/api.cmake
+++ b/src/cmake/api.cmake
@@ -50,11 +50,14 @@
vpp_generate_api_json_header (${file} ${dir})
endfunction()
-function(vpp_add_api_files target)
+function(vpp_add_api_files name)
unset(header_files)
+ set(target ${name}_api_headers)
+ file(RELATIVE_PATH rpath ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
foreach(file ${ARGN})
vpp_generate_api_header (${file} core)
- list (APPEND header_files ${file}.h ${file}.json)
+ list(APPEND header_files ${file}.h ${file}.json)
+ set_property(GLOBAL APPEND PROPERTY VPP_API_FILES ${rpath}/${file})
endforeach()
add_custom_target(${target} DEPENDS ${header_files})
endfunction()
diff --git a/src/cmake/library.cmake b/src/cmake/library.cmake
index 6aa0ae8..9ed53e9 100644
--- a/src/cmake/library.cmake
+++ b/src/cmake/library.cmake
@@ -33,7 +33,7 @@
endif()
if(ARG_API_FILES)
- vpp_add_api_files(${lib}_api_headers ${ARG_API_FILES})
+ vpp_add_api_files(${lib} ${ARG_API_FILES})
foreach(file ${ARG_API_FILES})
get_filename_component(dir ${file} DIRECTORY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${file}.h DESTINATION include/${lib}/${dir})
diff --git a/src/cmake/plugin.cmake b/src/cmake/plugin.cmake
index 4087325..a5b4bf5 100644
--- a/src/cmake/plugin.cmake
+++ b/src/cmake/plugin.cmake
@@ -20,9 +20,11 @@
)
set(plugin_name ${name}_plugin)
set(api_headers)
+ file(RELATIVE_PATH rpath ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
foreach(f ${PLUGIN_API_FILES})
- vpp_generate_api_header(${f} plugins)
- list(APPEND api_headers ${f}.h ${f}.json)
+ vpp_generate_api_header(${f} plugins)
+ list(APPEND api_headers ${f}.h ${f}.json)
+ set_property(GLOBAL APPEND PROPERTY VPP_API_FILES ${rpath}/${f})
endforeach()
add_library(${plugin_name} SHARED ${PLUGIN_SOURCES} ${api_headers})
add_dependencies(${plugin_name} vpp_version_h api_headers)