Skip to content

Commit

Permalink
AVRO-2955: Fix VS2010 support.
Browse files Browse the repository at this point in the history
  • Loading branch information
kiyolee committed Mar 12, 2021
1 parent 9524660 commit 46edc6a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
23 changes: 12 additions & 11 deletions lang/c/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,18 @@ if(CMAKE_COMPILER_IS_GNUCC)
add_compile_options(-W -Wall)
endif(CMAKE_COMPILER_IS_GNUCC)

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

# Uncomment to allow missing fields in the resolved-writer
Expand Down
6 changes: 2 additions & 4 deletions lang/c/README.maintaining_win32.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,8 @@ Limitations of Windows Build:
statements were removed, that Avro-C would compile under
Microsoft's C compiler also. I have not tried this.

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

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

0 comments on commit 46edc6a

Please sign in to comment.