mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-08-05 20:55:46 +03:00
cmake: Detect constructor and destructor attributes
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
@@ -272,6 +272,30 @@ int main(void) {
|
||||
# errors
|
||||
set(CMAKE_REQUIRED_FLAGS "-Werror")
|
||||
|
||||
check_c_source_compiles("
|
||||
void test_constructor_attribute(void) __attribute__ ((constructor));
|
||||
|
||||
void test_constructor_attribute(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
return 0;
|
||||
}" HAVE_CONSTRUCTOR_ATTRIBUTE)
|
||||
|
||||
check_c_source_compiles("
|
||||
void test_destructor_attribute(void) __attribute__ ((destructor));
|
||||
|
||||
void test_destructor_attribute(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
return 0;
|
||||
}" HAVE_DESTRUCTOR_ATTRIBUTE)
|
||||
|
||||
check_c_source_compiles("
|
||||
#define FALL_THROUGH __attribute__((fallthrough))
|
||||
|
||||
|
@@ -193,6 +193,9 @@
|
||||
|
||||
#cmakedefine HAVE_FALLTHROUGH_ATTRIBUTE 1
|
||||
|
||||
#cmakedefine HAVE_CONSTRUCTOR_ATTRIBUTE 1
|
||||
#cmakedefine HAVE_DESTRUCTOR_ATTRIBUTE 1
|
||||
|
||||
#cmakedefine HAVE_GCC_VOLATILE_MEMORY_PROTECTION 1
|
||||
#cmakedefine HAVE_GCC_NARG_MACRO 1
|
||||
|
||||
|
Reference in New Issue
Block a user