cmake: add support for building services with config files

This commit is contained in:
2026-03-23 18:13:22 +00:00
parent 1e3e38b0e2
commit 98dbaa05ac
3 changed files with 121 additions and 0 deletions

View File

@@ -32,6 +32,29 @@ function(rosetta_add_executable)
DESTINATION ${arg_SYSROOT_PATH})
endfunction(rosetta_add_executable)
function(rosetta_add_service)
set(options)
set(one_value_args NAME CFG_FILE)
set(multi_value_args SOURCES)
cmake_parse_arguments(PARSE_ARGV 0 arg
"${options}"
"${one_value_args}"
"${multi_value_args}")
set(exec_name ${arg_NAME})
get_property(programs GLOBAL PROPERTY rosetta_program_list)
set_property(GLOBAL PROPERTY rosetta_program_list ${programs} ${exec_name})
message(STATUS "Building service ${exec_name}")
add_executable(${exec_name} ${arg_SOURCES})
set_target_properties(${exec_name} PROPERTIES
POSITION_INDEPENDENT_CODE ON
service_cfg_path ${arg_CFG_FILE})
install(TARGETS ${exec_name}
DESTINATION ${arg_SYSROOT_PATH})
endfunction(rosetta_add_service)
function(rosetta_add_library)
set(options STATIC SHARED)
set(one_value_args NAME)