Compile user-defined application in PX4 src/modules

I compiled PX4 code successfully using Eclipse under Ubuntu.
Now i would like to add my own app (say test_daemon) and compile it.
I added CMakeLists.txt for the src/modules/test_daemon.cpp file.
But when i compile the code test_daemon.cpp doesn’t compiled.
Seems like i didn’t add test_daemon module to some configuration file.
Can anybody explain what the file is it?

P.S. I assume that it should be CMakeLists.txt from the parent directory, but i didn’t find one.
The way doesn’t work for me since /makefiles directory doesn’t exist for Raspberry Pi.

Thanks in advance!

EDIT: link was useful and now i can compile my test app, but the compilation itself is failed.
I added new line modules/test_daemon to Firmware/cmake/configs/posix_rpi_common and tried to build PX4.
The compilation process ends with error:
CMakeFiles/px4.dir///platforms/posix/main.cpp.obj: In function _GLOBAL__sub_I_apps': /home/elia/src/Firmware/src/platforms/posix/main.cpp:592: undefined reference totest_daemon_main’

Fixed: extern “C” must be added before main function definition in the module.