HomePhabricator

[CMAKE] Detect if the compiler supports visibility function attribute

Description

[CMAKE] Detect if the compiler supports visibility function attribute

Summary:
This diff adds detection for the
__attribute__((visibility("default"))) and
__attribute__((visibility("default"))) visibility function attributes.

This allow to export the expected symbols when building a shared library
while using fvisibility=hidden.

Test Plan:

mkdir buildcmake && cd buildcmake
cmake -GNinja ..
grep HAVE_FUNC_ATTRIBUTE src/config/bitcoin-config.h

Should be defined to 1 for HAVE_FUNC_ATTRIBUTE_VISIBILITY and
undefined for HAVE_FUNC_ATTRIBUTE_DLLEXPORT when using Clang, and
should be both defined to 1 when using GCC.

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D4152

Details

Provenance
FabienAuthored on Sep 25 2019, 14:22
jasonbcoxPushed on Sep 26 2019, 17:56
Reviewer
Restricted Project
Differential Revision
D4152: [CMAKE] Detect if the compiler supports visibility function attribute
Parents
rSTAGING1010243bd5ab: [CMAKE] Install executables
Branches
Unknown
Tags
Unknown