Skip to content

Commit

Permalink
yanglint BUILD optional interactive yanglint
Browse files Browse the repository at this point in the history
Detected also based on ioctl.h presence.
  • Loading branch information
michalvasko committed Apr 2, 2024
1 parent 964407a commit 4363428
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ project(libyang C)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/")

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

Expand Down
10 changes: 10 additions & 0 deletions tools/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
include(CheckIncludeFile)

# config file for tools
configure_file(${PROJECT_SOURCE_DIR}/tools/config.h.in ${PROJECT_BINARY_DIR}/tools/config.h @ONLY)

# find ioctl
check_include_file("sys/ioctl.h" HAVE_IOCTL)
if(NOT HAVE_IOCTL)
message(STATUS "Disabling interactive yanglint, sys/ioctl.h not found...")
set(ENABLE_YANGLINT_INTERACTIVE OFF)
endif()

# find getopt library on WIN32
if(WIN32)
find_library(GETOPT_LIBRARY NAMES getopt REQUIRED)
find_path(GETOPT_INCLUDE_DIR NAMES getopt.h REQUIRED)
Expand Down
10 changes: 2 additions & 8 deletions tools/lint/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
# yanglint

if(WIN32)
set(YANGLINT_INTERACTIVE OFF)
else()
set(YANGLINT_INTERACTIVE ON)
endif()

set(lintsrc
main_ni.c
cmd.c
Expand All @@ -25,7 +18,8 @@ set(lintsrc
yl_schema_features.c
common.c
)
if(YANGLINT_INTERACTIVE)

if(ENABLE_YANGLINT_INTERACTIVE)
set(lintsrc ${lintsrc}
main.c
completion.c
Expand Down

0 comments on commit 4363428

Please sign in to comment.