After searching for a long while I could find the option that was preventing the generation.
First of all, you need to define a reactive class to be able to generate a code for a state machine. This point was OK for me and I thought this was only what matters until I found this property here:
The _CG::Statechart::StatechartStateOperations property
determines whether the code is generated for this feature. The
possible values for this property are:
None (default value) where code is not generated for the feature.
WithoutReactive where the product does not generate calls to OMReactive
WithReactive where the product generates calls to OMReactive