Ensure CPM_LAST_MODULE_NAME is present in the current scope as well.
More debugging.

I don't know why, when calling add_subdirectory from a function, the
function's scope is not being updated by set(... PARENT_SCOPE).