← Back to team overview

kicad-developers team mailing list archive

CMake visibility options question

 

Hi,

I'm trying to build the kiface DLLs with all symbols exported so that I
could link them to external test programs (e.g. P&S test cases).

AFAIK symbol visibility is normally controlled in CMake by through the
CMAKE_CXX_VISIBILITY_PRESET variable. However, the following code in the
CMakeLists.txt file forces the symbol visibility to hidden:

-- snip --

if( POLICY CMP0063 )
    cmake_policy( GET CMP0063 VISIBILITY_POLICY )
    if( VISIBILITY_POLICY STREQUAL NEW )
        message( WARNING "Compatibility code for CMake < 3.3 can be
removed, search for CMP0063" )
    else()
        cmake_policy( SET CMP0063 NEW )
    endif()
else()
    if( CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY AND NOT APPLE )
        set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}
${CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY}hidden" )
    endif()
    if( CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN AND NOT APPLE )
        set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}
${CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN}" )
    endif()
endif()

-- snip --

Could anybody explain what is this code for and if it's really needed
(or maybe it's buggy)?

As a side comment, is there any practical reason to link with
-fvisibility=hidden (maybe except the stable releases)?

Cheers,
Tom



Follow ups