generic: replace use of CheckStructMember with CheckStructHasMember

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2020-11-07 19:30:43 +02:00
parent 1ad37404a1
commit d8d265082d
6 changed files with 14 additions and 57 deletions

View file

@ -10,7 +10,7 @@ include(CheckCXXSymbolExists)
include(CheckFunctionExists)
include(CheckLibraryExists)
include(CheckTypeSize)
include(CheckStructMember)
include(CheckStructHasMember)
include(CheckCXXSourceCompiles)
include(CheckPrototypeDefinition)
@ -123,12 +123,12 @@ if (UNIX)
set(HAVE_LOGIN 1)
else (login_in_libc OR login_in_libutil)
set(HAVE_LOGIN)
check_struct_member("struct ${utmp}" "ut_type" "${utmp}.h" HAVE_STRUCT_UTMP_UT_TYPE)
check_struct_member("struct ${utmp}" "ut_pid" "${utmp}.h" HAVE_STRUCT_UTMP_UT_PID)
check_struct_member("struct ${utmp}" "ut_session" "${utmp}.h" HAVE_STRUCT_UTMP_UT_SESSION)
check_struct_has_member("struct ${utmp}" "ut_type" "${utmp}.h" HAVE_STRUCT_UTMP_UT_TYPE)
check_struct_has_member("struct ${utmp}" "ut_pid" "${utmp}.h" HAVE_STRUCT_UTMP_UT_PID)
check_struct_has_member("struct ${utmp}" "ut_session" "${utmp}.h" HAVE_STRUCT_UTMP_UT_SESSION)
endif (login_in_libc OR login_in_libutil)
check_struct_member("struct ${utmp}" "ut_syslen" "${utmp}.h" HAVE_STRUCT_UTMP_UT_SYSLEN)
check_struct_member("struct ${utmp}" "ut_id" "${utmp}.h" HAVE_STRUCT_UTMP_UT_ID)
check_struct_has_member("struct ${utmp}" "ut_syslen" "${utmp}.h" HAVE_STRUCT_UTMP_UT_SYSLEN)
check_struct_has_member("struct ${utmp}" "ut_id" "${utmp}.h" HAVE_STRUCT_UTMP_UT_ID)
endif (HAVE_ADDTOUTEMP AND HAVE_UTEMPTER_H)
check_function_exists(openpty openpty_in_libc)
@ -183,5 +183,5 @@ check_cxx_source_compiles("
}
" GETMNTINFO_USES_STATVFS )
check_struct_member(dirent d_type dirent.h HAVE_DIRENT_D_TYPE) # kdecore, kioslave/file
check_struct_has_member("struct dirent" d_type dirent.h HAVE_DIRENT_D_TYPE) # kdecore, kioslave/file

View file

@ -17,7 +17,6 @@ set(cmakeFilesDontInstall
# compatible).
set(cmakeFiles
check_installed_exports_file.cmake
CheckStructMember.cmake
cmake-modules-styleguide.txt
FindACL.cmake
FindAlsa.cmake

View file

@ -1,42 +0,0 @@
# - Check if the given struct or class has the specified member variable
# CHECK_STRUCT_MEMBER (STRUCT MEMBER HEADER VARIABLE)
#
# STRUCT - the name of the struct or class you are interested in
# MEMBER - the member which existence you want to check
# HEADER - the header(s) where the prototype should be declared
# VARIABLE - variable to store the result
#
# The following variables may be set before calling this macro to
# modify the way the check is run:
#
# CMAKE_REQUIRED_FLAGS = string of compile command line flags
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
# CMAKE_REQUIRED_INCLUDES = list of include directories
# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
INCLUDE(CheckCXXSourceCompiles)
MACRO (CHECK_STRUCT_MEMBER _STRUCT _MEMBER _HEADER _RESULT)
SET(_INCLUDE_FILES)
FOREACH (it ${_HEADER})
SET(_INCLUDE_FILES "${_INCLUDE_FILES}#include <${it}>\n")
ENDFOREACH (it)
SET(_CHECK_STRUCT_MEMBER_SOURCE_CODE "
${_INCLUDE_FILES}
int main()
{
${_STRUCT}* tmp;
tmp->${_MEMBER};
return 0;
}
")
CHECK_CXX_SOURCE_COMPILES("${_CHECK_STRUCT_MEMBER_SOURCE_CODE}" ${_RESULT})
ENDMACRO (CHECK_STRUCT_MEMBER)

View file

@ -5,7 +5,7 @@
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
include(CheckStructMember)
include(CheckStructHasMember)
IF (LIBNXCL_INCLUDE_DIR AND LIBNXCL_LIBRARIES)
# Already in cache, be silent
@ -18,8 +18,8 @@ FIND_LIBRARY(LIBNXCL_LIBRARIES NAMES nxcl libnxcl)
IF (LIBNXCL_INCLUDE_DIR AND LIBNXCL_LIBRARIES)
SET(CMAKE_REQUIRED_LIBRARIES "${LIBNXCL_LIBRARIES}" "${CMAKE_REQUIRED_LIBRARIES}")
SET(CMAKE_REQUIRED_INCLUDES "${LIBNXCL_INCLUDE_DIR}" "${CMAKE_REQUIRED_INCLUDES}")
CHECK_STRUCT_MEMBER(nxcl::NXClientLib "getNXSSHProcess()" nxcl/nxclientlib.h LIBNXCL_NXSSHPROCESS_FOUND)
CHECK_STRUCT_MEMBER(nxcl::NXClientLib "getXID()" nxcl/nxclientlib.h LIBNXCL_XID_FOUND)
CHECK_STRUCT_HAS_MEMBER(nxcl::NXClientLib "getNXSSHProcess()" nxcl/nxclientlib.h LIBNXCL_NXSSHPROCESS_FOUND)
CHECK_STRUCT_HAS_MEMBER(nxcl::NXClientLib "getXID()" nxcl/nxclientlib.h LIBNXCL_XID_FOUND)
ENDIF (LIBNXCL_INCLUDE_DIR AND LIBNXCL_LIBRARIES)
IF (LIBNXCL_NXSSHPROCESS_FOUND AND LIBNXCL_XID_FOUND)

View file

@ -6,7 +6,7 @@
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
INCLUDE(CheckStructMember)
INCLUDE(CheckStructHasMember)
IF (LIBVNCSERVER_INCLUDE_DIR AND LIBVNCSERVER_LIBRARIES)
# Already in cache, be silent
@ -25,7 +25,7 @@ FIND_LIBRARY(LIBVNCCLIENT_LIBRARIES NAMES vncclient libvncclient)
IF (LIBVNCSERVER_INCLUDE_DIR AND LIBVNCSERVER_LIBRARIES)
SET(CMAKE_REQUIRED_INCLUDES "${LIBVNCSERVER_INCLUDE_DIR}" "${CMAKE_REQUIRED_INCLUDES}")
CHECK_STRUCT_MEMBER(rfbClient GotXCutText rfb/rfbclient.h LIBVNCSERVER_FOUND)
CHECK_STRUCT_HAS_MEMBER(rfbClient GotXCutText rfb/rfbclient.h LIBVNCSERVER_FOUND)
ENDIF (LIBVNCSERVER_INCLUDE_DIR AND LIBVNCSERVER_LIBRARIES)
IF (LIBVNCSERVER_FOUND)

View file

@ -1,5 +1,5 @@
check_type_size(time_t SIZEOF_TIME_T)
check_struct_member(tm tm_zone time.h HAVE_STRUCT_TM_TM_ZONE)
check_struct_member(tm tm_gmtoff time.h HAVE_TM_GMTOFF)
check_struct_has_member("struct tm" tm_zone time.h HAVE_STRUCT_TM_TM_ZONE)
check_struct_has_member("struct tm" tm_gmtoff time.h HAVE_TM_GMTOFF)