From 3bf86c0eca0607f160decaacf2905c26df584fcb Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Thu, 26 Jan 2023 01:32:32 +0300
Subject: [PATCH] cmake: addititonal check for visibility attributes.
makes sure to detect unsupported configurations especially with new gcc
versions.
---
CMakeLists.txt | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8d5eb0b21c0a..0850b8069d6e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -623,7 +623,11 @@ if(USE_GCC OR USE_CLANG)
#if !defined(__GNUC__) || __GNUC__ < 4
#error SDL only uses visibility attributes in GCC 4 or newer
#endif
- int main(int argc, char **argv) { return 0; }" HAVE_GCC_FVISIBILITY)
+ __attribute__((visibility(\"default\"))) int foo(void);
+ __attribute__((visibility(\"hidden\"))) int bar(void);
+ int foo(void) { return 0; }
+ int bar(void) { return 1; }
+ int main(void) { return 0; }" HAVE_GCC_FVISIBILITY)
cmake_pop_check_state()
check_c_compiler_flag(-Wshadow HAVE_GCC_WSHADOW)