blob: 059305ef2cb807dfab7702b8632beaeaa9c36bf3 [file] [log] [blame]
Radek Krejcicb293a32020-11-13 15:36:29 +01001# yanglint
Radek Krejcicb293a32020-11-13 15:36:29 +01002set(lintsrc
Radek Krejcicb293a32020-11-13 15:36:29 +01003 main_ni.c
Radek Krejcie9f13b12020-11-09 17:42:04 +01004 cmd.c
5 cmd_add.c
6 cmd_clear.c
7 cmd_data.c
8 cmd_list.c
Michal Vasko538be422021-10-19 14:06:59 +02009 cmd_feature.c
Radek Krejcie9f13b12020-11-09 17:42:04 +010010 cmd_load.c
11 cmd_print.c
12 cmd_searchpath.c
aPiecek647f62e2023-05-18 10:55:58 +020013 cmd_extdata.c
aPieceka83b8e02023-06-07 15:25:16 +020014 cmd_help.c
15 cmd_verb.c
16 cmd_debug.c
17 yl_opt.c
aPiecekd8f002f2023-06-21 10:40:41 +020018 yl_schema_features.c
Radek Krejcie9f13b12020-11-09 17:42:04 +010019 common.c
Jan Kundrát2e3f9352021-12-11 02:16:27 +010020)
Michal Vasko43634282024-04-02 13:51:45 +020021
22if(ENABLE_YANGLINT_INTERACTIVE)
Jan Kundrát2e3f9352021-12-11 02:16:27 +010023 set(lintsrc ${lintsrc}
24 main.c
25 completion.c
26 configuration.c
27 linenoise/linenoise.c)
28else()
29 set(lintsrc ${lintsrc}
30 main_ni_only.c)
31endif()
Radek Krejcicb293a32020-11-13 15:36:29 +010032
33set(format_sources
34 ${format_sources}
35 ${CMAKE_CURRENT_SOURCE_DIR}/*.c
36 ${CMAKE_CURRENT_SOURCE_DIR}/*.h
37 PARENT_SCOPE)
Michal Vaskob3b3afc2020-11-25 09:52:26 +010038
Michal Vasko1b0b9a12021-05-06 08:38:34 +020039add_executable(yanglint ${lintsrc} ${compatsrc})
Radek Krejcicb293a32020-11-13 15:36:29 +010040target_link_libraries(yanglint yang)
41install(TARGETS yanglint DESTINATION ${CMAKE_INSTALL_BINDIR})
42install(FILES ${PROJECT_SOURCE_DIR}/tools/lint/yanglint.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
43target_include_directories(yanglint BEFORE PRIVATE ${PROJECT_BINARY_DIR})
44
Jan Kundrátf0bd0b62021-12-11 02:23:51 +010045if(WIN32)
Jan Kundrátf0bd0b62021-12-11 02:23:51 +010046 target_include_directories(yanglint PRIVATE ${GETOPT_INCLUDE_DIR})
47 target_link_libraries(yanglint ${GETOPT_LIBRARY})
48endif()