From 7981b901c43848d3b923ec49515b28a75ab984e3 Mon Sep 17 00:00:00 2001 From: Masoud Hemmatpour Date: Tue, 26 Nov 2019 12:05:02 +0100 Subject: [HICN-403] update vapi communication with vpp Signed-off-by: Masoud Hemmatpour Change-Id: I6e05d96af049229a6dc2da0adf32707873cdc816 Signed-off-by: Alberto Compagno --- ctrl/sysrepo-plugins/CMakeLists.txt | 42 ++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 17 deletions(-) (limited to 'ctrl/sysrepo-plugins/CMakeLists.txt') diff --git a/ctrl/sysrepo-plugins/CMakeLists.txt b/ctrl/sysrepo-plugins/CMakeLists.txt index 93434b9c6..13a601bf0 100644 --- a/ctrl/sysrepo-plugins/CMakeLists.txt +++ b/ctrl/sysrepo-plugins/CMakeLists.txt @@ -16,29 +16,37 @@ cmake_minimum_required(VERSION 3.5 FATAL_ERROR) project(hicn_sysrepo_plugin) -include(GNUInstallDirs) - set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules" "${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/Modules" ) -# set default build type if not specified by user -if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE debug) +include(GNUInstallDirs) +include(BuildMacros) + +find_package(PkgConfig) +find_package(Sysrepo) + +if (NOT SRPD_PLUGINS_PATH) + if (PKG_CONFIG_FOUND) + execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} "--variable=SRPD_PLUGINS_PATH" "libsysrepo" OUTPUT_VARIABLE SRPD_PLUGINS_PATH) + string(STRIP ${SRPD_PLUGINS_PATH} SRPD_PLUGINS_PATH) + endif() +endif() +if (NOT SRPD_PLUGINS_PATH) + message(FATAL_ERROR "Cannot get sysrepo plugins directory due to missing pkg-config, set SRPD_PLUGINS_PATH manually.") endif() -string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWER) -# set compiler options -set(CMAKE_EXPORT_COMPILE_COMMANDS 1) -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -std=gnu99") -set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG -O2") -set(CMAKE_C_FLAGS_DEBUG "-g -O0") +if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) + find_package_wrapper(VPP REQUIRED) + find_package_wrapper(HicnPlugin REQUIRED) + add_subdirectory(hicn-plugin) +else() + if (BUILD_HICNPLUGIN AND "${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") + list(APPEND DEPENDENCIES + hicn_plugin) + add_subdirectory(hicn-plugin) + endif () +endif() # add subdirectories -if (BUILD_HICNPLUGIN AND "${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") - add_subdirectory(hicn-plugin) -endif () -if (BUILD_HICNLIGHT AND "${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") - add_subdirectory(hicn-light) -endif () include(Packaging) -- cgit 1.2.3-korg