Fix builds with Visual Studio 2015.

VS2015 moved stdio functions to the header files as inline function.  That means check_function_exists can't detect them because it doesn't use header files - just does a link check.  Instead we need to use check_symbol_exists with the correct headers.
This commit is contained in:
Alexander Lamaison 2015-07-25 22:19:46 +01:00
parent d48d7c3a87
commit af14462d53
2 changed files with 16 additions and 8 deletions

View File

@ -34,7 +34,6 @@
# OF SUCH DAMAGE.
include(CheckIncludeFiles)
include(CheckFunctionExists)
include(CheckSymbolExists)
include(CopyRuntimeDependencies)
include(SocketLibraries)
@ -88,10 +87,10 @@ check_include_files(arpa/inet.h HAVE_ARPA_INET_H)
check_include_files(netinet/in.h HAVE_NETINET_IN_H)
check_include_files(winsock2.h HAVE_WINSOCK2_H)
check_function_exists(strcasecmp HAVE_STRCASECMP)
check_function_exists(_stricmp HAVE__STRICMP)
check_function_exists(snprintf HAVE_SNPRINTF)
check_function_exists(_snprintf HAVE__SNPRINTF)
check_symbol_exists(strcasecmp strings.h HAVE_STRCASECMP)
check_symbol_exists(_stricmp string.h HAVE__STRICMP)
check_symbol_exists(snprintf stdio.h HAVE_SNPRINTF)
check_symbol_exists(_snprintf stdio.h HAVE__SNPRINTF)
check_symbol_exists(__func__ "" HAVE___FUNC__)
check_symbol_exists(__FUNCTION__ "" HAVE___FUNCTION__)

View File

@ -34,6 +34,7 @@
# OF SUCH DAMAGE.
include(CheckFunctionExists)
include(CheckSymbolExists)
include(CheckFunctionExistsMayNeedLibrary)
include(CheckIncludeFiles)
include(CheckTypeSize)
@ -270,9 +271,17 @@ check_include_files(winsock2.h HAVE_WINSOCK2_H)
check_type_size("long long" LONGLONG)
check_function_exists(gettimeofday HAVE_GETTIMEOFDAY)
check_function_exists(strtoll HAVE_STRTOLL)
check_function_exists(snprintf HAVE_SNPRINTF)
if(HAVE_SYS_TIME_H)
check_symbol_exists(gettimeofday sys/time.h HAVE_GETTIMEOFDAY)
else()
check_function_exists(gettimeofday HAVE_GETTIMEOFDAY)
endif()
if(HAVE_STDLIB_H)
check_symbol_exists(strtoll stdlib.h HAVE_STRTOLL)
else()
check_function_exists(strtoll HAVE_STRTOLL)
endif()
check_symbol_exists(snprintf stdio.h HAVE_SNPRINTF)
if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" OR
${CMAKE_SYSTEM_NAME} STREQUAL "Interix")