Small fixing in cmake plugin

Don't add a trailing slash when looking up the parent's path.
Always wait for files to be parsed if not found
Add a missing write lock
Prefer remove* than take*