Documentation misinformation on BUILD_SHARED_LIBS
This documentation seems to cause users to cause bad behaviors (and maybe it's my fault for including other projects CMakeLists with add_subdirectory instead of ExternalProject).
https://cmake.org/cmake/help/latest/variable/BUILD_SHARED_LIBS.html
"Global flag to cause add_library() to create shared libraries if on.
If present and true, this will cause all libraries to be built shared unless the library was explicitly added as a static library. This variable is often added to projects as an option() so that each user of a project can decide if they want to build the project using shared or static libraries."
I don't use this Option, but this impacts all projects. LibreSSL doesn't have the option() specified, so it uses whatever is set. By default this is unset, so the library builds statically, which it has been doing until today. I added LibSSH2, which does define option(BUILD_SHARED_LIBS "Build Shared Libraries" ON)
which now LibreSSL is building as shared by default.
(this also indicates that one should set this as an option) https://cmake.org/cmake/help/latest/guide/tutorial/Selecting%20Static%20or%20Shared%20Libraries.html
I also do not find a page for BUILD_STATIC_LIBS which I would assume would be https://cmake.org/cmake/help/latest/variable/BUILD_STATIC_LIBS.html
which libssh and libssh2 both seems to think exists.
I was going to issue a bug report to libssh2 to not define these as options, since it ends up affecting everything in the whole project, and not just themselves... but from your documentation it implies they should.