Implement CMake options for some of the modules

fixes #7794
fixes #7795