cmake: error when STDCALL is specified

To explicitly break end-users who were specifying STDCALL, explicitly
fail the cmake process to ensure that they know that they need to change
their bindings.  Otherwise, we would quietly ignore their option and the
resulting cdecl library would produced undefined behavior.
This commit is contained in:
Edward Thomson
2019-01-09 12:47:40 +00:00
parent a74dd39b23
commit 57b753a0dc

View File

@@ -107,6 +107,10 @@ STRING(REGEX REPLACE "^.*LIBGIT2_SOVERSION ([0-9]+)$" "\\1" LIBGIT2_SOVERSION "$
# Platform specific compilation flags
IF (MSVC)
IF (STDCALL)
MESSAGE(FATAL_ERROR "The STDCALL option is no longer supported; libgit2 is now always built as a cdecl library. If you're using PInvoke, please add the CallingConventions.Cdecl attribute for support.")
ENDIF()
ADD_DEFINITIONS(-D_SCL_SECURE_NO_WARNINGS)
ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE)
ADD_DEFINITIONS(-D_CRT_NONSTDC_NO_DEPRECATE)