fix cmake compilation and secured the constructor of named service

Signed-off-by: Claudio Bisegni <Claudio.Bisegni@lnf.infn.it>