Skip to content

Commit 47dc2e0

Browse files
committed
AVRO-2955: Fix VS2010 support.
1 parent 083bb37 commit 47dc2e0

2 files changed

Lines changed: 14 additions & 15 deletions

File tree

lang/c/CMakeLists.txt

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -107,17 +107,18 @@ if(CMAKE_COMPILER_IS_GNUCC)
107107
add_compile_options(-W -Wall)
108108
endif(CMAKE_COMPILER_IS_GNUCC)
109109

110-
if (MSVC)
111-
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
112-
if(MSVC_VERSION LESS 1700)
113-
# Compile as C++ to allow declarations after statements. (C11 feature)
114-
add_compile_options(/TP)
115-
# However, this does not work as the code is not C++ compliant either.
116-
message(FATAL_ERROR "MSVC_VERSION(${MSVC_VERSION}) is not supported.")
117-
elseif(MSVC_VERSION LESS 1920)
118-
else()
119-
add_compile_options(/std:c11)
120-
endif(MSVC_VERSION LESS 1700)
110+
if(MSVC)
111+
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
112+
if(MSVC_VERSION LESS 1700)
113+
# VS2010 and earlier.
114+
# Compile as C++ to allow declarations after statements. (C11 feature)
115+
add_compile_options(/TP)
116+
elseif(MSVC_VERSION LESS 1920)
117+
# VS2013|VS2015|VS2017
118+
else()
119+
# VS2019 and later.
120+
add_compile_options(/std:c11)
121+
endif(MSVC_VERSION LESS 1700)
121122
endif(MSVC)
122123

123124
# Uncomment to allow missing fields in the resolved-writer

lang/c/README.maintaining_win32.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,8 @@ Limitations of Windows Build:
3131
statements were removed, that Avro-C would compile under
3232
Microsoft's C compiler also. I have not tried this.
3333

34-
Note: This is referring to a C11 feature which is supported from VS2013
35-
onward. However, compiling as C++ does not work as the code is not C++
36-
compliant either. Basically, VS2010 or before just cannot be supported
37-
unless significant changes are made to the code.
34+
Note: This is referring to a C11 feature which is supported in VS2013
35+
and later.
3836

3937
2. The shared library, i.e. DLL, for avro has not been built. There
4038
are instructions on how to build DLLs using CMake at

0 commit comments

Comments
 (0)