Sadly, CMake follows the awkward "implicit lib" convention, which inevitably causes problems when library names don't actually follow the convention (e.g. zlib), or have 'lib' as an explicit part of their name.
For example, suppose I want to add libusb:
add_library(libusb ...)
On Windows this will correctly produce libusb.lib
. On Unix it will produce the hilarious liblibusb.a
. Is there any way to prevent this behaviour? I know I can set the output name explicitly using OUTPUT_NAME
but I'd have to use some funky generator expressions to preserve libusb.lib
on Windows. I wonder if there is a better way?
(And no add_library(usb ...
is not a solution; the library is called libusb not usb.)