From 4cd5efd37913fc2386a031f63e65876ab0b298e5 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Thu, 23 Feb 2023 15:53:47 +0000 Subject: [PATCH] cmake: Check compiler features --- cmake/bitcoin-config.h.in | 9 +++++++++ cmake/introspection.cmake | 23 +++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/cmake/bitcoin-config.h.in b/cmake/bitcoin-config.h.in index 759bcb8d1cb28..7a3cf24f440a5 100644 --- a/cmake/bitcoin-config.h.in +++ b/cmake/bitcoin-config.h.in @@ -6,6 +6,9 @@ #define BITCOIN_CONFIG_H +/* Define this symbol if type char equals int8_t */ +#cmakedefine CHAR_EQUALS_INT8 1 + /* Version Build */ #define CLIENT_VERSION_BUILD @PROJECT_VERSION_PATCH@ @@ -119,6 +122,12 @@ */ #cmakedefine01 HAVE_DECL_SETSID +/* Define if the visibility attribute is supported. */ +#cmakedefine HAVE_DEFAULT_VISIBILITY_ATTRIBUTE 1 + +/* Define if the dllexport attribute is supported. */ +#cmakedefine HAVE_DLLEXPORT_ATTRIBUTE 1 + /* Define to 1 if you have the header file. */ #cmakedefine HAVE_ENDIAN_H 1 diff --git a/cmake/introspection.cmake b/cmake/introspection.cmake index 624f70ad10cb9..3e637bc4d04e8 100644 --- a/cmake/introspection.cmake +++ b/cmake/introspection.cmake @@ -240,3 +240,26 @@ check_cxx_source_compiles(" } " HAVE_SYSCTL_ARND ) + +check_cxx_source_compiles(" + #include + #include + + int main() + { + static_assert(std::is_same::value); + } + " CHAR_EQUALS_INT8 +) + +check_cxx_source_compiles(" + int foo(void) __attribute__((visibility(\"default\"))); + int main(){} + " HAVE_DEFAULT_VISIBILITY_ATTRIBUTE +) + +check_cxx_source_compiles(" + __declspec(dllexport) int foo(void); + int main(){} + " HAVE_DLLEXPORT_ATTRIBUTE +)