Skip to content

Instantly share code, notes, and snippets.

@xenoscopic
Last active August 29, 2015 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xenoscopic/46ac990b3e6b2a6d088e to your computer and use it in GitHub Desktop.
Save xenoscopic/46ac990b3e6b2a6d088e to your computer and use it in GitHub Desktop.
libssh2 VS2015 snprintf/strtoll detection patch
0a1,4
> # Patched version of (one of) libssh2's CMakeLists.txt. Overrides finding of
> # strtoll and snprintf for MSVC 14+, because CMake doesn't seem to find
> # functions or symbols, either due to them being inlined, the new universal CRT,
> # or something...
275a280,286
> # HACK: These aren't detected correctly for MSVC 14
> if(MSVC)
> if(NOT MSVC_VERSION VERSION_LESS 1900)
> SET(HAVE_STRTOLL 1)
> SET(HAVE_SNPRINTF 1)
> endif()
> endif()
@xenoscopic
Copy link
Author

If you're wondering about versioning - Visual Studio 2015 contains Microsoft Visual C++ (MSVC) 14 which has an RTM version number of 19.00.23026 (which is where the 1900 comes from). They should have sent a poet...

@rhuijben
Copy link

snprintf() is new in Visual Studio 2015. Before that it only supported the slightly not-standard _snprintf().
strtoll() is available since Visual Studio 2013.

@xenoscopic
Copy link
Author

Yeah, I think the problem has more to do with the universal CRT, because strtoll isn't new and wasn't broken before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment