Merge pull request #670 from sergiud/cmake-msvc-snprintf

cmake: fixed msvc snprintf detection (fixes #668)
This commit is contained in:
Sergiu Deitsch 2021-06-15 20:09:07 +02:00 committed by GitHub
commit 764162569a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -46,15 +46,14 @@ set (CMAKE_CXX_VISIBILITY_PRESET hidden)
set (CMAKE_VISIBILITY_INLINES_HIDDEN 1) set (CMAKE_VISIBILITY_INLINES_HIDDEN 1)
list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
include (CheckCXXSourceCompiles)
include (CheckCXXCompilerFlag) include (CheckCXXCompilerFlag)
include (CheckCXXSourceCompiles) include (CheckCXXSourceCompiles)
include (CheckCXXSourceRuns) include (CheckCXXSourceRuns)
include (CheckCXXSymbolExists)
include (CheckFunctionExists) include (CheckFunctionExists)
include (CheckIncludeFileCXX) include (CheckIncludeFileCXX)
include (CheckLibraryExists) include (CheckLibraryExists)
include (CheckStructHasMember) include (CheckStructHasMember)
include (CheckSymbolExists)
include (CheckTypeSize) include (CheckTypeSize)
include (CMakePackageConfigHelpers) include (CMakePackageConfigHelpers)
include (CMakePushCheckState) include (CMakePushCheckState)
@ -141,7 +140,7 @@ check_cxx_compiler_flag (-Wunnamed-type-template-args
# NOTE: Cannot use check_function_exists here since >=vc-14.0 can define # NOTE: Cannot use check_function_exists here since >=vc-14.0 can define
# snprintf as an inline function # snprintf as an inline function
check_symbol_exists (snprintf cstdio HAVE_SNPRINTF) check_cxx_symbol_exists (snprintf cstdio HAVE_SNPRINTF)
check_library_exists (dbghelp UnDecorateSymbolName "" HAVE_DBGHELP) check_library_exists (dbghelp UnDecorateSymbolName "" HAVE_DBGHELP)
@ -446,7 +445,7 @@ add_definitions (-DGLOG_NO_SYMBOLIZE_DETECTION)
check_cxx_source_compiles (" check_cxx_source_compiles ("
#include <cstdlib> #include <cstdlib>
#include <time.h> #include <ctime>
int main() int main()
{ {
time_t timep; time_t timep;
@ -466,7 +465,7 @@ else (WITH_THREADS AND Threads_FOUND)
set (NO_THREADS 1) set (NO_THREADS 1)
endif (WITH_THREADS AND Threads_FOUND) endif (WITH_THREADS AND Threads_FOUND)
# fopen/open on Cygwin can not handle unix-type paths like /home/.... # fopen/open on Cygwin can not handle unix-type paths like /home/....
# therefore we translate TEST_SRC_DIR to windows-path. # therefore we translate TEST_SRC_DIR to windows-path.
if (CYGWIN) if (CYGWIN)
execute_process (COMMAND cygpath.exe -m ${CMAKE_CURRENT_SOURCE_DIR} execute_process (COMMAND cygpath.exe -m ${CMAKE_CURRENT_SOURCE_DIR}