use cmake directives for flex, bison and gengetopt

This commit replaces some custom commands with cmake directives for several tools in order to be cross platform and to show during the cmake phase if a tool is missing.