summaryrefslogtreecommitdiffstats
path: root/tools/lint/CMakeLists.txt
blob: 059305ef2cb807dfab7702b8632beaeaa9c36bf3 (plain)
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
# yanglint
set(lintsrc
    main_ni.c
    cmd.c
    cmd_add.c
    cmd_clear.c
    cmd_data.c
    cmd_list.c
    cmd_feature.c
    cmd_load.c
    cmd_print.c
    cmd_searchpath.c
    cmd_extdata.c
    cmd_help.c
    cmd_verb.c
    cmd_debug.c
    yl_opt.c
    yl_schema_features.c
    common.c
)

if(ENABLE_YANGLINT_INTERACTIVE)
    set(lintsrc ${lintsrc}
        main.c
        completion.c
        configuration.c
        linenoise/linenoise.c)
else()
    set(lintsrc ${lintsrc}
        main_ni_only.c)
endif()

set(format_sources
    ${format_sources}
    ${CMAKE_CURRENT_SOURCE_DIR}/*.c
    ${CMAKE_CURRENT_SOURCE_DIR}/*.h
    PARENT_SCOPE)

add_executable(yanglint ${lintsrc} ${compatsrc})
target_link_libraries(yanglint yang)
install(TARGETS yanglint DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES ${PROJECT_SOURCE_DIR}/tools/lint/yanglint.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
target_include_directories(yanglint BEFORE PRIVATE ${PROJECT_BINARY_DIR})

if(WIN32)
    target_include_directories(yanglint PRIVATE ${GETOPT_INCLUDE_DIR})
    target_link_libraries(yanglint ${GETOPT_LIBRARY})
endif()