1 cmake_minimum_required(VERSION 2.6) 2 3 PROJECT(jsonpath C) 4 ADD_DEFINITIONS(-Os -Wall -Werror --std=gnu99 -Wmissing-declarations -Wno-error=unused-variable -ffunction-sections -D_GNU_SOURCE) 5 6 IF(NOT APPLE) 7 SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "-Wl,--gc-sections") 8 ENDIF() 9 10 IF(DEBUG) 11 ADD_DEFINITIONS(-DDEBUG -g3) 12 ENDIF() 13 14 INCLUDE(FindPkgConfig) 15 PKG_CHECK_MODULES(JSONC json-c) 16 IF(JSONC_FOUND) 17 ADD_DEFINITIONS(-DJSONC) 18 INCLUDE_DIRECTORIES(${JSONC_INCLUDE_DIRS}) 19 ENDIF() 20 21 ADD_CUSTOM_COMMAND( 22 OUTPUT contrib/lemon 23 DEPENDS contrib/lemon.c contrib/lempar.c 24 COMMAND gcc -o contrib/lemon contrib/lemon.c 25 COMMENT "Generating lemon parser generator" 26 ) 27 28 ADD_CUSTOM_COMMAND( 29 OUTPUT parser.c 30 DEPENDS parser.y contrib/lemon 31 COMMAND ./contrib/lemon parser.y 32 COMMENT "Generating parser.c" 33 ) 34 35 FIND_PATH(ubox_include_dir libubox/list.h) 36 INCLUDE_DIRECTORIES(${ubox_include_dir}) 37 38 SET_PROPERTY(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "lemon;parser.h;parser.out") 39 SET_SOURCE_FILES_PROPERTIES("parser.c" PROPERTIES GENERATED TRUE) 40 ADD_EXECUTABLE(jsonpath main.c ast.c lexer.c parser.c matcher.c) 41 find_library(json NAMES json-c) 42 TARGET_LINK_LIBRARIES(jsonpath ubox ${json}) 43 44 INSTALL(TARGETS jsonpath RUNTIME DESTINATION bin)
This page was automatically generated by LXR 0.3.1. • OpenWrt