cmake: do not build both (SHARED and STATIC) for MSVC/win32
MSVC does not support SHARED and STATIC libraries with the same name,
so let's just build SHARED libraries by default instead (yes we can add
prefix but let's stick with this).
The reason for this is that in windows shared libraries requires .lib
file too, but this is not static library it is imported library for
shared (doh...), for more info [1] and [2].
[1]: https://docs.microsoft.com/en-us/windows/desktop/dlls/dynamic-link-library-creation
[2]: https://blogs.msdn.microsoft.com/oldnewthing/
20091013-00/?p=16403
And when we build both static library can and will override shared
library imported part, let's take a look at event_extra.lib:
- before patch [3]:
$ less libevent-fail/lib/Debug/event_extra.lib | head
==> use library:contained_file to view a file in the archive
rw-rw-rw- 100666/100666 59568 Nov 21 23:55 2018 event_extra_static.dir/Debug/evrpc.obj
rw-rw-rw- 100666/100666 252219 Nov 21 23:55 2018 event_extra_static.dir/Debug/evdns.obj
rw-rw-rw- 100666/100666 203850 Nov 21 23:55 2018 event_extra_static.dir/Debug/http.obj
rw-rw-rw- 100666/100666 25907 Nov 21 23:55 2018 event_extra_static.dir/Debug/event_tagging.obj
[3]: https://ci.appveyor.com/project/azat/libevent/builds/
20472024/job/t0o93v042jai0dj7
- "after patch" [4] (not after but the same effect):
$ less libevent-ok/lib/Debug/event_extra.lib | head
==> use library:contained_file to view a file in the archive
--------- 0/0 509 Nov 21 23:38 2018 event_extra.dll
...
[4]: https://ci.appveyor.com/project/azat/libevent/builds/
20478998/job/ca9k3c76amc4qr76
Refs: #691
(cherry picked from commit
90d80ef4167d97b11e01e80fcc4eaa447712e92f)