cmake: let generated lexer.c, parser.c depend on their respective source files, clean...
authorJo-Philipp Wich <jow@openwrt.org>
Sun, 29 Dec 2013 18:02:04 +0000 (18:02 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Sun, 29 Dec 2013 18:02:04 +0000 (18:02 +0000)
CMakeLists.txt

index 9b2fd506df43570959bf44a79616f8814051d7a1..22042e18470bebb40793cab54390699d9f62dfaa 100644 (file)
@@ -27,6 +27,7 @@ FIND_PACKAGE(BISON REQUIRED)
 IF(BISON_FOUND)
     ADD_CUSTOM_COMMAND(
       OUTPUT parser.c
+      DEPENDS parser.y
       COMMAND ${BISON_EXECUTABLE} parser.y
       COMMENT "Generating parser.c"
     )
@@ -36,11 +37,14 @@ FIND_PACKAGE(FLEX REQUIRED)
 IF(FLEX_FOUND)
     ADD_CUSTOM_COMMAND(
       OUTPUT lexer.c
+      DEPENDS lexer.l
       COMMAND ${FLEX_EXECUTABLE} lexer.l
       COMMENT "Generating lexer.c"
     )
 ENDIF()
 
+SET_PROPERTY(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "lexer.h;parser.h")
+SET_SOURCE_FILES_PROPERTIES("lexer.c;parser.c" PROPERTIES GENERATED TRUE)
 ADD_EXECUTABLE(jsonpath main.c lexer.c parser.c matcher.c)
 TARGET_LINK_LIBRARIES(jsonpath ubox ${json})