[cmake-developers] Interface for GCC -fvisibility

Simon Richter Simon.Richter at hogyros.de
Sun Sep 6 01:16:28 EDT 2015


Hi,

I'm trying to replace our package's own test for the existence of the
-fvisibility flag with CMake's.

I've found CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY, which is set if the
flag exists, to something that you can directly append the desired
default visibility to, so this is used by extending CXXFLAGS with

   "${CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY}hidden"

That still looks awfully compiler-specific to me, besides being ugly.
Would it make sense to introduce a higher-level interface where I could
specify whether I want implicit or explicit exports, and it would do the
right thing?

There is the variable CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS that does the
exact opposite of the functionality I want -- basically I'd like to
declare that my program has all exported functionality marked in the
source code, and only these should be exported.

   Simon

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20150906/bc56a749/attachment.sig>


More information about the cmake-developers mailing list