The following issue has been SUBMITTED. ====================================================================== http://www.cmake.org/Bug/view.php?id=15556 ====================================================================== Reported By: Kjell Irgens Assigned To: ====================================================================== Project: CMake Issue ID: 15556 Category: CMake Reproducibility: always Severity: minor Priority: normal Status: new ====================================================================== Date Submitted: 2015-05-06 06:11 EDT Last Modified: 2015-05-06 06:11 EDT ====================================================================== Summary: CMAKE_<lang>_VISIBILITY_PRESET not used when compiling static libraries Description: When compiling a STATIC library the -fvisibility=hidden compiler flag is not set to gcc when compiling.
Why is this a problem? I am linking the resulting static library into another SHARED library, and I want the symbols defined in the link library to be hidden, which is why I used CMAKE_CPP_VISIBILITY_PRESET in the first place. https://gcc.gnu.org/wiki/Visibility "In your build system (Makefile etc), you will probably wish to add the -fvisibility=hidden and -fvisibility-inlines-hidden options to the command line arguments of every GCC invocation" The workaround is to add -fvisibility=HIDDEN as to COMPILE_FLAGS. Steps to Reproduce: set (CMAKE_C_VISIBILITY_PRESET hidden) add_library (mplug STATIC test.c) make VERBOSE=1 ====================================================================== Issue History Date Modified Username Field Change ====================================================================== 2015-05-06 06:11 Kjell Irgens New Issue ====================================================================== -- 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
