[cmake-developers] Interface for GCC -fvisibility

Robert Maynard robert.maynard at kitware.com
Mon Sep 7 12:46:56 EDT 2015


The better approach is to use the CXX/C target
property <LANG>_VISIBILITY_PRESET or set the CMAKE_<LANG>_VISIBILITY_PRESET
global variable. These when true will automatically enable the visibility
flag.

see:
http://www.cmake.org/cmake/help/v3.0/prop_tgt/LANG_VISIBILITY_PRESET.html

On Sun, Sep 6, 2015 at 1:16 AM, Simon Richter <Simon.Richter at hogyros.de>
wrote:

> 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
>
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake-developers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20150907/ad6075f0/attachment.html>


More information about the cmake-developers mailing list