1 # Copyright (c) 2018 Cisco and/or its affiliates.
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at:
6 # http://www.apache.org/licenses/LICENSE-2.0
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
14 macro(add_vpp_library lib)
15 cmake_parse_arguments(ARG
18 "SOURCES;MULTIARCH_SOURCES;API_FILES;LINK_LIBRARIES;INSTALL_HEADERS;DEPENDS"
22 add_library(${lib} SHARED ${ARG_SOURCES})
23 target_compile_options(${lib} PRIVATE -Wall)
25 set_target_properties(${lib} PROPERTIES SOVERSION ${VPP_LIB_VERSION})
29 if(ARG_LINK_LIBRARIES)
30 target_link_libraries(${lib} ${ARG_LINK_LIBRARIES})
34 set(ARG_COMPONENT vpp)
39 COMPONENT ${ARG_COMPONENT}
42 if(ARG_MULTIARCH_SOURCES)
43 vpp_library_set_multiarch_sources(${lib} ${ARG_MULTIARCH_SOURCES})
47 vpp_add_api_files(${lib} ${ARG_API_FILES})
48 foreach(file ${ARG_API_FILES})
49 get_filename_component(dir ${file} DIRECTORY)
51 FILES ${CMAKE_CURRENT_BINARY_DIR}/${file}.h
52 DESTINATION include/${lib}/${dir}
59 add_dependencies(${lib} ${ARG_DEPENDS})
63 if(ARG_INSTALL_HEADERS)
64 foreach(file ${ARG_INSTALL_HEADERS})
65 get_filename_component(dir ${file} DIRECTORY)
68 DESTINATION include/${lib}/${dir}
69 COMPONENT ${ARG_COMPONENT}-dev
75 ##############################################################################
77 ##############################################################################
78 function (add_vpp_headers path)
80 get_filename_component(dir ${file} DIRECTORY)
83 DESTINATION include/${path}/${dir}