Compile error 9.0RC3, VS 2017, Windows 10, snprintf
I am using CMake 3.12.2, VS 2017 15.9.22 on a Windows 10 machine. When I compile, I get errors in libxml2 and tiff:
Macro redefinition of 'snprintf' conflicts with Standard Library definition.
I have traced it to ThirdParty/libxml2/vtklibxml/CMakeLists.txt, which calls
check_sybmol_exists(snprintf "${LIBXML_INCLUDES}" HAVE_SNPRINTF)
However, LIBXML_INCLUDES does not list stdio.h which is where snprint is defined, so HAVE_SNPRINTF is set to false.
when ThirdParty/tiff/vtktiff/CMakeLists also checks for snprintf with its call to
check_symbol_exists(snprintf "stdio.h" HAVE_SNPRINTF)
which should succeed, it doesn’t, because HAVE_SNPRINTF has already been set.
There is a build path where the check for ‘snprintf’ happens before libxml’s check, then things work. I think that is when vtkhdf5 is included in the build. For my use case, I am not using vtkhdf5.