From 687c1d557a0dac826b05b663daa6161c34779242 Mon Sep 17 00:00:00 2001 From: mibeaver Date: Wed, 17 Feb 2016 10:31:12 -0600 Subject: [PATCH] Modifications for Visual Studio 2015 * Added tests for snprintf and vsnprintf symbols * Added test for time_spec in time.h. --- CMakeLists.txt | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 46c48c7..a02ea54 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -116,29 +116,22 @@ check_function_exists(_getpid HAVE__GETPID) check_function_exists(_strdup HAVE__STRDUP) # printf related checks -check_function_exists(snprintf HAVE_SNPRINTF) -check_function_exists(vsnprintf HAVE_VSNPRINTF) -check_function_exists(vasnprintf HAVE_VASNPRINTF) -check_function_exists(asprintf HAVE_ASPRINTF) -check_function_exists(vasprintf HAVE_VASPRINTF) +check_function_exists(snprintf HAVE_SNPRINTF_FUNCTION) +check_function_exists(vsnprintf HAVE_VSNPRINTF_FUNCTION) +check_symbol_exists(snprintf stdio.h HAVE_SNPRINTF_SYMBOL) +check_symbol_exists(vsnprintf stdio.h HAVE_VSNPRINTF_SYMBOL) -if(NOT HAVE_SNPRINTF) +if(NOT HAVE_SNPRINTF_FUNCTION AND NOT HAVE_SNPRINTF_SYMBOL) add_definitions(-Dsnprintf=rpl_snprintf) set(snprintf rpl_snprintf) add_definitions(-Dvsnprintf=rpl_vsnprintf) set(vsnprintf rpl_vsnprintf) - add_definitions(-Dvasnprintf=rpl_vasnprintf) - set(vasnprintf rpl_vasnprintf) - add_definitions(-Dasprintf=rpl_asprintf) - set(asprintf rpl_asprintf) - add_definitions(-Dvasprintf=rpl_vasprintf) - set(vasprintf rpl_vasprintf) -else(NOT HAVE_SNPRINTF) +else(NOT HAVE_SNPRINTF_FUNCTION AND NOT HAVE_SNPRINTF_SYMBOL) set(HAVE_SNPRINTF 1) add_definitions(-DHAVE_SNPRINTF=1) set(HAVE_VSNPRINTF 1) add_definitions(-DHAVE_VSNPRINTF=1) -endif(NOT HAVE_SNPRINTF) +endif(NOT HAVE_SNPRINTF_FUNCTION AND NOT HAVE_SNPRINTF_SYMBOL) if(HAVE_FORK) add_definitions(-DHAVE_FORK=1) @@ -175,13 +168,14 @@ if(NOT HAVE_SYS_TIME_H) if(MSVC) check_struct_member("struct timeval" tv_sec "Winsock2.h" HAVE_STRUCT_TIMEVAL_TV_SEC) check_struct_member("struct timeval" tv_usec "Winsock2.h" HAVE_STRUCT_TIMEVAL_TV_USEC) - check_struct_member("struct timespec" tv_usec "Winsock2.h" HAVE_STRUCT_TIMESPEC_TV_SEC) + check_struct_member("struct timespec" tv_sec "Winsock2.h" HAVE_WINSOCK2_H_STRUCT_TIMESPEC_TV_SEC) + check_struct_member("struct timespec" tv_sec "time.h" HAVE_TIME_H_STRUCT_TIMESPEC_TV_SEC) check_struct_member("struct itimerspec" it_value "Winsock2.h" HAVE_STRUCT_ITIMERSPEC_IT_VALUE) - if(NOT HAVE_STRUCT_TIMESPEC_TV_SEC) + if(NOT HAVE_WINSOCK2_H_STRUCT_TIMESPEC_TV_SEC AND NOT HAVE_TIME_H_STRUCT_TIMESPEC_TV_SEC) add_definitions(-DSTRUCT_TIMESPEC_DEFINITION_MISSING=1) set(STRUCT_TIMESPEC_DEFINITION_MISSING 1) - endif(NOT HAVE_STRUCT_TIMESPEC_TV_SEC) + endif(NOT HAVE_WINSOCK2_H_STRUCT_TIMESPEC_TV_SEC AND NOT HAVE_TIME_H_STRUCT_TIMESPEC_TV_SEC) if(NOT HAVE_STRUCT_ITIMERSPEC_IT_VALUE) add_definitions(-DSTRUCT_ITIMERSPEC_DEFINITION_MISSING=1) -- 2.40.0