Skip to content

Commit

Permalink
cmake: Check compiler features
Browse files Browse the repository at this point in the history
  • Loading branch information
hebasto committed Feb 23, 2023
1 parent 89be42f commit 4cd5efd
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cmake/bitcoin-config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -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@

Expand Down Expand Up @@ -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 <endian.h> header file. */
#cmakedefine HAVE_ENDIAN_H 1

Expand Down
23 changes: 23 additions & 0 deletions cmake/introspection.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -240,3 +240,26 @@ check_cxx_source_compiles("
}
" HAVE_SYSCTL_ARND
)

check_cxx_source_compiles("
#include <cstdint>
#include <type_traits>
int main()
{
static_assert(std::is_same<int8_t, char>::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
)

0 comments on commit 4cd5efd

Please sign in to comment.