Prevent creating empty directories using install(DIRECTORY)

I created an issue: 22947