Details

Following a mail on breaked jenkins builds, I took a look on the kajongg one.
The issue is due to the fact that there are spaces in the source folder: "/home/jenkins/workspace/Applications/kajongg/kf5-qt5 SUSEQt5.12" and cmake does not like spaces for rule names.

Test Plan

Clone the source in a folder with a space in it. Compile before the change and see it does not work.
Compile after the change and see it compiles fine.

The file name could potentially have spaces in it. So, a simple (string(REPLACE ...)) for spaces with underscores should fix that (see D23233).

Instead of using the full path, we could use the path relative to the current source directory (file(RELATIVE_PATH ...)) to get a unique target name. Another option would be to check (if(TARGET ...)) and add a numeric suffix as needed. Both would handle the case where the project has the same filename in two different paths. This will still fix bug 376303 by creating shorter target names.