forked from telekom/sysrepo-plugin-interfaces
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
49 lines (39 loc) · 1.25 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
cmake_minimum_required(VERSION 2.8)
project(sysrepo-interfaces-plugins C)
include(CompileOptions.cmake)
set(PLUGIN 0 CACHE BOOL "Build a plugin")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
include_directories(
${CMAKE_SOURCE_DIR}/src/
)
# get sysrepo version
find_package(PkgConfig)
if (PKG_CONFIG_FOUND)
execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} "--modversion" "sysrepo" OUTPUT_VARIABLE SYSREPO_VERSION)
if(SYSREPO_VERSION)
# strip new line from string
string(STRIP ${SYSREPO_VERSION} SYSREPO_VERSION)
if(${SYSREPO_VERSION} VERSION_LESS "1.0.0")
message(FATAL_ERROR "${PROJECT_NAME} requires at least libsysrepo verision 1.0.0")
endif()
endif()
endif()
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules")
find_package(SYSREPO REQUIRED)
find_package(LIBYANG REQUIRED)
include_directories(
${SYSREPO_INCLUDE_DIRS}
${LIBYANG_INCLUDE_DIRS}
)
option(INTERFACES_PLUGIN "Enable interfaces plugin" ON)
option(ROUTING_PLUGIN "Enable interfaces plugin" ON)
if(INTERFACES_PLUGIN)
add_subdirectory(src/interfaces)
endif()
if(ROUTING_PLUGIN)
add_subdirectory(src/routing)
endif()
if(ENABLE_BUILD_TESTS)
find_package(CMOCKA REQUIRED)
include (CTest)
endif()