forked from osmocom/wireshark
CMake: Fix timespec_get() detection on Windows
Replace some instances of check_function_exists() with check_symbol_exists(). From the CMake documentation: - check_function_exists() can't detect functions that are inlined in headers or specified as a macro. - check_function_exists() can't detect anything in the 32-bit versions of the Win32 API, because of a mismatch in calling conventions. - check_function_exists() only verifies linking, it does not verify that the function is declared in system headers. This fixes timespec_get() detection on Windows.
This commit is contained in:
parent
c457c8a396
commit
c11ceb08ed
|
@ -80,9 +80,9 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "SunOS" AND CMAKE_SYSTEM_VERSION MATCHES "5[.]
|
||||||
check_function_exists("getexecname" HAVE_GETEXECNAME)
|
check_function_exists("getexecname" HAVE_GETEXECNAME)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
check_function_exists("clock_gettime" HAVE_CLOCK_GETTIME)
|
check_symbol_exists("clock_gettime" "time.h" HAVE_CLOCK_GETTIME)
|
||||||
# Some platforms (macOS pre 10.15) are non-conformant with C11 and lack timespec_get()
|
# Some platforms (macOS pre 10.15) are non-conformant with C11 and lack timespec_get()
|
||||||
check_function_exists("timespec_get" HAVE_TIMESPEC_GET)
|
check_symbol_exists("timespec_get" "time.h" HAVE_TIMESPEC_GET)
|
||||||
check_function_exists("getifaddrs" HAVE_GETIFADDRS)
|
check_function_exists("getifaddrs" HAVE_GETIFADDRS)
|
||||||
check_function_exists("issetugid" HAVE_ISSETUGID)
|
check_function_exists("issetugid" HAVE_ISSETUGID)
|
||||||
check_function_exists("setresgid" HAVE_SETRESGID)
|
check_function_exists("setresgid" HAVE_SETRESGID)
|
||||||
|
@ -97,9 +97,9 @@ endif()
|
||||||
if(UNIX)
|
if(UNIX)
|
||||||
cmake_push_check_state()
|
cmake_push_check_state()
|
||||||
list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
|
list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
|
||||||
check_function_exists("memmem" HAVE_MEMMEM)
|
check_symbol_exists("memmem" "string.h" HAVE_MEMMEM)
|
||||||
check_function_exists("strcasestr" HAVE_STRCASESTR)
|
check_symbol_exists("strcasestr" "string.h" HAVE_STRCASESTR)
|
||||||
check_function_exists("vasprintf" HAVE_VASPRINTF)
|
check_symbol_exists("vasprintf" "stdio.h" HAVE_VASPRINTF)
|
||||||
cmake_pop_check_state()
|
cmake_pop_check_state()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue