Skip to content

Commit

Permalink
build: conf: fix target definition for generated headers (#1242)
Browse files Browse the repository at this point in the history
Build system for static files is broken due to wrong custom command
definition.

This patch uses a custom target instead and fix dependencies for
'flb-static-conf' target.

note: this gist helped to solve the problem:

https://gist.github.com/baiwfg2/39881ba703e9c74e95366ed422641609

Signed-off-by: Eduardo Silva <[email protected]>
  • Loading branch information
edsiper committed Apr 21, 2019
1 parent dbd8de7 commit 1a63709
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions gen_static_conf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,26 @@ set(CONF_DIR ${PROJECT_SOURCE_DIR}/include/fluent-bit/conf/)

# Iterate list creating custom commands for each entry
set(OUT_FILES "")
set(STATIC_DEPS "")
set(FLB_STATIC_CONF_ARR "")
set(FLB_STATIC_CONF_ARR_SIZE 0)
foreach(file ${files})
# Convert configuration file using xxd-c
message(STATUS "Processing configuration file: '${file}'")
get_filename_component(in_file ${file} NAME)

add_custom_command(
add_custom_target(
flb-static-file-${in_file}.h ALL
COMMAND xxd-c
ARGS
-i ${file}
-o ${CONF_DIR}${in_file}.h
-s ${in_file}
DEPENDS ${file}
OUTPUT ${in_file}.h
DEPENDS ${file} xxd-c
COMMENT "Generating static configuration file: ${in_file}.h"
)
LIST(APPEND OUT_FILES "${in_file}.h")
LIST(APPEND STATIC_DEPS "flb-static-file-${in_file}.h")

string(REPLACE "." "_" stname ${in_file})
string(REPLACE "-" "_" stname ${stname})
Expand All @@ -48,4 +50,4 @@ configure_file(

# Register the custom target, this will be a later dependency
# of fluent-bit-static target
add_custom_target(flb-static-conf DEPENDS ${OUT_FILES})
add_custom_target(flb-static-conf DEPENDS ${STATIC_DEPS})

0 comments on commit 1a63709

Please sign in to comment.