CMake var DOC_EXCLUDE_TESTS only appears if doc build is enabled

Improve organization of base cmake definitions.