GCC/clang: Draco shared library requires -fvisibility=default but does not set it
This causes linking to fail when included in a master project that sets -fvisibility=hidden
Draco does set the equivalent flag for MSVC
Thanks for the report.
Is the master project manipulating CMAKE_CXX_FLAGS and/or CMAKE_EXE_LINKER_FLAGS? Projects doing so impact the child projects loaded via CMake.
You can add the following args at configure time to control Draco visibility (aka the CMake command line):
- -DDRACO_CXX_FLAGS=-fvisibility=default
- -DDRACO_EXE_LINKER_FLAGS=-fvisibility=default
edit: s/hidden/default/ and added question about CMAKE_<TOOL>_FLAGS.
Most so/dylib projects set -fvisibility=hidden, as it is common to only want to export a small subset of symbols in a dynamic library and hiding the unnecessary ones greatly improves library loading times.
This means many dynamic library projects that also require draco have set the visibility flag further up the cmakelists. Probably they shouldn't do that, but it would be helpful if draco explicitly set the flags it requires.