I am wondering under what license the code generated by a code generator that generates code from conditional code templates would fall under.
Would it be possible to release the generator's source code (generator logic + templates) under say GPLv3 without having the generated code to be GPLv3 licensed too?
Or would a custom license or exception be needed for this to work and if so, would adding such exception to the GPLv3 license of the generator's source code break the compatibility with GPLv3 and/or other opensource licenses?
Or should I release template files under another license (any recommendations if this is a case?) that would allow the final user to license generated code under any open or closed source license and only keep the generator logic licensed under say GPLv3?
I found this similar question: Does "the GPL doesn't cover the ouput of a program" also apply if the output is source code? From what I understood from here, generated files would fall under GPLv3 too if an exception is not provided. Please correct me if I am wrong.
What the question linked in the paragraph above does not cover are my additional questions about how and if to add an exception to GPLv3 or if the template files should be released under another license?
EDIT: The generator output does not contain any part of the generator (except some Java keywords and tiny fractions of code without added value), all code is defined in the templates.
I would prefer it if the templates could not be reused in a closed source non-free situation by a third-party as one of the commenters asked.