Skip to content

Commit 4363428

Browse files
committed
yanglint BUILD optional interactive yanglint
Detected also based on ioctl.h presence.
1 parent 964407a commit 4363428

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ project(libyang C)
1515
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/")
1616

1717
include(GNUInstallDirs)
18-
include(CheckSymbolExists)
1918
include(UseCompat)
2019
include(ABICheck)
2120
include(SourceFormat)
@@ -245,6 +244,7 @@ option(ENABLE_PERF_TESTS "Build performance tests" OFF)
245244
option(ENABLE_COVERAGE "Build code coverage report from tests" OFF)
246245
option(ENABLE_FUZZ_TARGETS "Build target programs suitable for fuzzing with AFL" OFF)
247246
option(ENABLE_INTERNAL_DOCS "Generate doxygen documentation also from internal headers" OFF)
247+
option(ENABLE_YANGLINT_INTERACTIVE "Enable interactive CLI yanglint" ON)
248248
option(BUILD_SHARED_LIBS "By default, shared libs are enabled. Turn off for a static build." ON)
249249
set(YANG_MODULE_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/yang/modules/libyang" CACHE STRING "Directory where to copy the YANG modules to")
250250

tools/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
1+
include(CheckIncludeFile)
2+
13
# config file for tools
24
configure_file(${PROJECT_SOURCE_DIR}/tools/config.h.in ${PROJECT_BINARY_DIR}/tools/config.h @ONLY)
35

6+
# find ioctl
7+
check_include_file("sys/ioctl.h" HAVE_IOCTL)
8+
if(NOT HAVE_IOCTL)
9+
message(STATUS "Disabling interactive yanglint, sys/ioctl.h not found...")
10+
set(ENABLE_YANGLINT_INTERACTIVE OFF)
11+
endif()
12+
13+
# find getopt library on WIN32
414
if(WIN32)
515
find_library(GETOPT_LIBRARY NAMES getopt REQUIRED)
616
find_path(GETOPT_INCLUDE_DIR NAMES getopt.h REQUIRED)

tools/lint/CMakeLists.txt

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
11
# yanglint
2-
3-
if(WIN32)
4-
set(YANGLINT_INTERACTIVE OFF)
5-
else()
6-
set(YANGLINT_INTERACTIVE ON)
7-
endif()
8-
92
set(lintsrc
103
main_ni.c
114
cmd.c
@@ -25,7 +18,8 @@ set(lintsrc
2518
yl_schema_features.c
2619
common.c
2720
)
28-
if(YANGLINT_INTERACTIVE)
21+
22+
if(ENABLE_YANGLINT_INTERACTIVE)
2923
set(lintsrc ${lintsrc}
3024
main.c
3125
completion.c

0 commit comments

Comments
 (0)