diff options
author | Masoud Hemmatpour <mhemmatp@cisco.com> | 2019-11-26 12:05:02 +0100 |
---|---|---|
committer | Alberto Compagno <acompagn+fdio@cisco.com> | 2019-11-29 15:58:20 +0000 |
commit | 7981b901c43848d3b923ec49515b28a75ab984e3 (patch) | |
tree | d5177ebe141bba140f97984999bf157126eefc5b /ctrl/sysrepo-plugins/CMakeLists.txt | |
parent | b3ee2ed8602c909f8d5096e9d8d44aa345093566 (diff) |
[HICN-403] update vapi communication with vpp
Signed-off-by: Masoud Hemmatpour <mhemmatp@cisco.com>
Change-Id: I6e05d96af049229a6dc2da0adf32707873cdc816
Signed-off-by: Alberto Compagno <acompagn+fdio@cisco.com>
Diffstat (limited to 'ctrl/sysrepo-plugins/CMakeLists.txt')
-rw-r--r-- | ctrl/sysrepo-plugins/CMakeLists.txt | 42 |
1 files changed, 25 insertions, 17 deletions
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) |