Using target_link_libraries in CMake with just the library name, e.g.
target_link_library( myProject SomeLibrary )
will expand SomeLibrary to SomeLibrary.lib, libSomeLibrary.so, etc. depending on platform. However, if a full path is specified then the library name is not expanded based on platform, e.g.
target_link_library( myProject ${myProject_SOURCE_DIR}/libs/SomeLibrary )
How can I get the library name to be expanded based on platform? Currently, I'm detecting platform in the script and adjusting the library names myself which feels a little ugly.
(Background: over on this question I'm advised to use absolute paths when specifying libraries rather than using link_directories)