| # SPDX-License-Identifier: Apache-2.0 |
| find_program(THRIFT_EXECUTABLE thrift) |
| if(NOT THRIFT_EXECUTABLE) |
| message(FATAL_ERROR "The 'thrift' command was not found") |
| target # CMake target (for dependencies / headers) |
| lang # The language for generated sources |
| lang_opts # Language options (e.g. ':no_skeleton') |
| out_dir # Output directory for generated files |
| # (do not include 'gen-cpp', etc) |
| source_file # The .thrift source file |
| options # Additional thrift options |
| # Generated files in ${ARGN} |
| file(MAKE_DIRECTORY ${out_dir}) |
| --gen ${lang}${lang_opts} |
| target_include_directories( |
| ${target} PRIVATE ${out_dir}/gen-${lang} |
| ${target} PRIVATE ${ZEPHYR_BASE}/modules/thrift/src |
| ${target} PRIVATE ${ZEPHYR_THRIFT_MODULE_DIR}/lib/cpp/src |