cmake: move the package option closer to its use

Status Job ID Name Coverage
  External
passed ghostflow-commit-check