blob: 14f8b76a5cb510e527143c75dae1c2f731a14212 [file] [log] [blame]
Radek Krejcicb293a32020-11-13 15:36:29 +01001# yanglint
2
Jan Kundrát2e3f9352021-12-11 02:16:27 +01003if(WIN32)
4 set(YANGLINT_INTERACTIVE OFF)
5else()
6 set(YANGLINT_INTERACTIVE ON)
7endif()
8
Radek Krejcicb293a32020-11-13 15:36:29 +01009set(lintsrc
Radek Krejcicb293a32020-11-13 15:36:29 +010010 main_ni.c
Radek Krejcie9f13b12020-11-09 17:42:04 +010011 cmd.c
12 cmd_add.c
13 cmd_clear.c
14 cmd_data.c
15 cmd_list.c
Michal Vasko538be422021-10-19 14:06:59 +020016 cmd_feature.c
Radek Krejcie9f13b12020-11-09 17:42:04 +010017 cmd_load.c
18 cmd_print.c
19 cmd_searchpath.c
aPiecek647f62e2023-05-18 10:55:58 +020020 cmd_extdata.c
aPieceka83b8e02023-06-07 15:25:16 +020021 cmd_help.c
22 cmd_verb.c
23 cmd_debug.c
24 yl_opt.c
aPiecekd8f002f2023-06-21 10:40:41 +020025 yl_schema_features.c
Radek Krejcie9f13b12020-11-09 17:42:04 +010026 common.c
Jan Kundrát2e3f9352021-12-11 02:16:27 +010027)
28if(YANGLINT_INTERACTIVE)
29 set(lintsrc ${lintsrc}
30 main.c
31 completion.c
32 configuration.c
33 linenoise/linenoise.c)
34else()
35 set(lintsrc ${lintsrc}
36 main_ni_only.c)
37endif()
Radek Krejcicb293a32020-11-13 15:36:29 +010038
39set(format_sources
40 ${format_sources}
41 ${CMAKE_CURRENT_SOURCE_DIR}/*.c
42 ${CMAKE_CURRENT_SOURCE_DIR}/*.h
43 PARENT_SCOPE)
Michal Vaskob3b3afc2020-11-25 09:52:26 +010044
Michal Vasko1b0b9a12021-05-06 08:38:34 +020045add_executable(yanglint ${lintsrc} ${compatsrc})
Radek Krejcicb293a32020-11-13 15:36:29 +010046target_link_libraries(yanglint yang)
47install(TARGETS yanglint DESTINATION ${CMAKE_INSTALL_BINDIR})
48install(FILES ${PROJECT_SOURCE_DIR}/tools/lint/yanglint.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
49target_include_directories(yanglint BEFORE PRIVATE ${PROJECT_BINARY_DIR})
50
Jan Kundrátf0bd0b62021-12-11 02:23:51 +010051if(WIN32)
Jan Kundrátf0bd0b62021-12-11 02:23:51 +010052 target_include_directories(yanglint PRIVATE ${GETOPT_INCLUDE_DIR})
53 target_link_libraries(yanglint ${GETOPT_LIBRARY})
54endif()