Merge pull request #289 from akheron/simplify-snprintf-checks
Simplify snprintf and vsnprintf checking for Visual Studio
This commit is contained in:
commit
520340998f
@ -303,16 +303,6 @@ else()
|
|||||||
set (JSON_INLINE)
|
set (JSON_INLINE)
|
||||||
endif()
|
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() { 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)
|
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)
|
||||||
|
|
||||||
|
10
appveyor.yml
10
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:
|
build_script:
|
||||||
- md build
|
- md build
|
||||||
- cd build
|
- cd build
|
||||||
- cmake ..
|
- cmake -G "%VS%" ..
|
||||||
- cmake --build . --config Release
|
- cmake --build . --config Release
|
||||||
- ctest --output-on-failure
|
- ctest --output-on-failure
|
@ -47,28 +47,6 @@
|
|||||||
# define ssize_t @JSON_SSIZE@
|
# define ssize_t @JSON_SSIZE@
|
||||||
#endif
|
#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_URANDOM 1
|
||||||
#cmakedefine USE_WINDOWS_CRYPTOAPI 1
|
#cmakedefine USE_WINDOWS_CRYPTOAPI 1
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user