Handle linker paths containing commas
When using gcc the build RPATH is set using -W1,-rpath,
If contains a comma the linker interprets this as a new option. This can be fixed by using -Xlinker -path instead.
This can be quite a subtle problem to spot when it catches you. The attached script reproduces an occurrence of the issue which outputs:
/usr/bin/ld: cannot find bar/build: No such file or directory
In my case I have automated tests that use temporary file names that contain a comma. I ended up using set(CMAKE_SKIP_BUILD_RPATH 1)
I would suggest that CMake should always use -Xlinker, when it is available, in preference to -Wl.