Skip to content

Commit beaf059

Browse files
committed
cmake UPDATE make libnetconf2 pkg-config package optional
Refs #1723
1 parent d1669dc commit beaf059

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

CMakeLists.txt

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -152,20 +152,22 @@ set(FORMAT_SRC
152152
find_package(PkgConfig)
153153
if(PkgConfig_FOUND)
154154
# find libnetconf2 pkg
155-
pkg_check_modules(PKG_LN2 REQUIRED libnetconf2)
156-
157-
# libnetconf2 thread count check
158-
pkg_get_variable(LN2_THREAD_COUNT libnetconf2 "LN2_MAX_THREAD_COUNT")
159-
if(LN2_THREAD_COUNT)
160-
if(LN2_THREAD_COUNT LESS THREAD_COUNT)
161-
message(FATAL_ERROR "libnetconf2 was compiled with support up to ${LN2_THREAD_COUNT} threads, server is configured with ${THREAD_COUNT}.")
162-
else()
163-
message(STATUS "libnetconf2 was compiled with support of up to ${LN2_THREAD_COUNT} threads")
155+
pkg_check_modules(PKG_LN2 libnetconf2)
156+
157+
if(PKG_LN2_FOUND)
158+
# libnetconf2 thread count check
159+
pkg_get_variable(LN2_THREAD_COUNT libnetconf2 "LN2_MAX_THREAD_COUNT")
160+
if(LN2_THREAD_COUNT)
161+
if(LN2_THREAD_COUNT LESS THREAD_COUNT)
162+
message(FATAL_ERROR "libnetconf2 was compiled with support up to ${LN2_THREAD_COUNT} threads, server is configured with ${THREAD_COUNT}.")
163+
else()
164+
message(STATUS "libnetconf2 was compiled with support of up to ${LN2_THREAD_COUNT} threads")
165+
endif()
164166
endif()
165-
endif()
166167

167-
# get libnetconf2 module directory, use it later when installing modules
168-
pkg_get_variable(LN2_YANG_MODULE_DIR libnetconf2 "LN2_SCHEMAS_DIR")
168+
# get libnetconf2 module directory, use it later when installing modules
169+
pkg_get_variable(LN2_YANG_MODULE_DIR libnetconf2 "LN2_SCHEMAS_DIR")
170+
endif()
169171
endif()
170172

171173
# } PKGCONFIG

0 commit comments

Comments
 (0)