From 72fd2fec4cfbad215e71be23ae4992e1b4d937b3 Mon Sep 17 00:00:00 2001 From: Petri Lehtinen Date: Mon, 30 May 2016 11:51:39 +0300 Subject: [PATCH 1/2] Simplify snprintf and vsnprintf checking for Visual Studio --- CMakeLists.txt | 10 ---------- cmake/jansson_private_config.h.cmake | 22 ---------------------- 2 files changed, 32 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 80ea388..db8f3ca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -303,16 +303,6 @@ else() set (JSON_INLINE) endif() -# Find our snprintf -check_function_exists (snprintf HAVE_SNPRINTF) -check_function_exists (_snprintf HAVE__SNPRINTF) - -if (HAVE_SNPRINTF) - set(JSON_SNPRINTF snprintf) -elseif (HAVE__SNPRINTF) - set(JSON_SNPRINTF _snprintf) -endif () - check_c_source_compiles ("int main() { unsigned long val; __sync_bool_compare_and_swap(&val, 0, 1); return 0; } " HAVE_SYNC_BUILTINS) check_c_source_compiles ("int main() { char l; unsigned long v; __atomic_test_and_set(&l, __ATOMIC_RELAXED); __atomic_store_n(&v, 1, __ATOMIC_RELEASE); __atomic_load_n(&v, __ATOMIC_ACQUIRE); return 0; }" HAVE_ATOMIC_BUILTINS) diff --git a/cmake/jansson_private_config.h.cmake b/cmake/jansson_private_config.h.cmake index ac7318f..b7c4514 100644 --- a/cmake/jansson_private_config.h.cmake +++ b/cmake/jansson_private_config.h.cmake @@ -47,28 +47,6 @@ # define ssize_t @JSON_SSIZE@ #endif -#cmakedefine HAVE_SNPRINTF 1 - -/* snprintf should not be defined as macro with MSC_VER >= 1900 */ -#if defined(_WIN32) || defined(WIN32) -# if defined(_MSC_VER) /* MS compiller */ -# if (_MSC_VER < 1900) /* snprintf not introduced */ -# if !defined(snprintf) -# define snprintf _snprintf -# define HAVE_SNPRINTF 1 /* snprintf defined manually */ -# endif -# else -# define HAVE_SNPRINTF 1 /* snprintf available via sdk */ -# endif -# endif -#endif - -#ifndef HAVE_SNPRINTF -# define snprintf @JSON_SNPRINTF@ -#endif - -#cmakedefine HAVE_VSNPRINTF - #cmakedefine USE_URANDOM 1 #cmakedefine USE_WINDOWS_CRYPTOAPI 1 From 2d710d832fc1b0531c4767a7da80cacc660a829d Mon Sep 17 00:00:00 2001 From: Petri Lehtinen Date: Fri, 3 Jun 2016 10:44:53 +0300 Subject: [PATCH 2/2] appveyor.yml: Build on all Visual Studio versions --- appveyor.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 5663334..852a399 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,6 +1,14 @@ +environment: + matrix: + - VS: Visual Studio 9 2008 + - VS: Visual Studio 10 2010 + - VS: Visual Studio 11 2012 + - VS: Visual Studio 12 2013 + - VS: Visual Studio 14 2015 + build_script: - md build - cd build - - cmake .. + - cmake -G "%VS%" .. - cmake --build . --config Release - - ctest --output-on-failure \ No newline at end of file + - ctest --output-on-failure