1 set(SETTINGS_GENERATED "settings_generated")
2 set(SETTINGS_GENERATED_C "${SETTINGS_GENERATED}.c")
3 set(SETTINGS_GENERATED_H "${SETTINGS_GENERATED}.h")
4 set(SETTINGS_FILE "${MAIN_SRC_DIR}/fc/settings.yaml")
5 set(SETTINGS_GENERATOR "${MAIN_UTILS_DIR}/settings.rb")
8 function(enable_settings exe name)
9 get_generated_files_dir(dir ${name})
10 get_target_property(options ${exe} COMPILE_OPTIONS)
11 get_target_property(includes ${exe} INCLUDE_DIRECTORIES)
12 list(TRANSFORM includes PREPEND "-I")
13 get_target_property(defs ${exe} COMPILE_DEFINITIONS)
14 list(TRANSFORM defs PREPEND "-D")
15 list(APPEND cflags ${options})
16 list(APPEND cflags ${includes})
17 list(APPEND cflags ${defs})
19 OUTPUT ${dir}/${SETTINGS_GENERATED_H} ${dir}/${SETTINGS_GENERATED_C}
21 ${CMAKE_COMMAND} -E env CFLAGS="${cflags}" TARGET=${name} PATH=$ENV{PATH}
22 ${RUBY_EXECUTABLE} ${SETTINGS_GENERATOR} ${MAIN_DIR} ${SETTINGS_FILE} -o "${dir}"
23 DEPENDS ${SETTINGS_GENERATOR} ${SETTINGS_FILE}