Add disable options for optional plugins, various cmake fixes

Was possible before by disabling the find modules, but this way it's nicer and also possible to make a plugin required.

There also was a major misunderstanding of how cached variables interact, which could lead to unexpected behaviour from the find modules.
Fixes it to behave like expected.