1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-03-24 06:50:08 +03:00

cmake: fix ATTRIBUTE_DESTRUCTOR definition

The code expects it to be set to the attribute for `xmlDestructor`, but
in CMake, it is only ever available as `1` or undefined. Instead, match
the behavior or autoconf.
This commit is contained in:
Ben Boeckel 2021-07-26 20:06:18 -04:00 committed by Nick Wellnhofer
parent 3ba59b9349
commit f86082359b
2 changed files with 5 additions and 2 deletions

View File

@ -139,7 +139,10 @@ else()
void __attribute__((destructor))
f(void) {}
int main(void) { return 0; }
" ATTRIBUTE_DESTRUCTOR)
" HAVE_ATTRIBUTE_DESTRUCTOR)
if(HAVE_ATTRIBUTE_DESTRUCTOR)
set(ATTRIBUTE_DESTRUCTOR "__attribute__((destructor))")
endif()
check_c_source_compiles("
#include <netdb.h>
int main() { (void) gethostbyname((const char*) \"\"); return 0; }

View File

@ -2,7 +2,7 @@
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define if __attribute__((destructor)) is accepted */
#cmakedefine ATTRIBUTE_DESTRUCTOR 1
#cmakedefine ATTRIBUTE_DESTRUCTOR @ATTRIBUTE_DESTRUCTOR@
/* Type cast for the gethostbyname() argument */
#cmakedefine GETHOSTBYNAME_ARG_CAST @GETHOSTBYNAME_ARG_CAST@