1 #! \ingroup MicroServicesCMake
2 #! \brief Generate a source file which handles proper initialization of a module.
4 #! This CMake function will store the path to a generated source file in the
5 #! src_var variable, which should be compiled into a module. The modules source
6 #! code must be compiled with the US_MODULE_NAME pre-processor definition.
11 #! usFunctionGenerateModuleInit(module_srcs)
12 #! add_library(mylib ${module_srcs})
13 #! set_property(TARGET ${mylib} APPEND PROPERTY COMPILE_DEFINITIONS US_MODULE_NAME=MyModule)
16 #! \param src_var (required) The name of a list variable to which the path of the generated
17 #! source file will be appended.
19 #! \see \ref MicroServices_AutoLoading
23 set(module_init_src_file
"${CMAKE_CURRENT_BINARY_DIR}/us_init.cpp")
24 configure_file(${US_MODULE_INIT_TEMPLATE} ${module_init_src_file} @ONLY)
26 set(_src ${module_init_src_file} ${${src_var}})
27 set(${src_var} ${_src} PARENT_SCOPE)
usFunctionGenerateModuleInit(src_var)
Generate a source file which handles proper initialization of a module.