When I run ninja cat, it fails, because it’s trying to link -lmeow, which is looking for libmeow.so, which is the wrong name of the shared library. meow.sois built though and is in the right place.
When I then run ninja rebuild_cache && ninja cat, the second time around it does actually link path/to/meow.so and everything works as expected.
I had a lot of trouble understanding what the documentation of CMP0060 means, but I thought it intended this to just work?
Strange. I suspect some of it is that sources are where (IIRC) custom command dependencies are looked up, not link libraries. What you should be able to do is something like this though:
The issue is that instead of just passing path/to/meow.so on the command-line, cmake transforms this into -Lpath/to -lmeow the first time around (which is an invalid transformation because that’s the wrong name).
The second time around (or with the altered form using the IMPORTED_LOCATION), it does correctly just pass path/to/meow.so.
It seems like between CMP0003 and CMP0060, cmake should respect the code I’m actually writing, but that appears to not be the case, and I don’t understand between the description of either of the two policies what the actual behavior is supposed to be.
Yes, this sounds like a bug of some sort. Does what I posted above work (as it is the intended workflow today AFAIK)? We should still look into the issue, but I think it can just be avoided here.