My CMake project compiles a Python .so/.dylib extension module linked with a big static library. I want to compile the subproject's static library with hidden visibility for symbols : it would allows the linker (or LTO optimizer) to discard symbols unused by my python module.
The best way to do this would be using CXX_VISIBILITY_PRESET
and friends on the subproject's static library target.
However, the subproject use policies from 3.1.0 by declaring :
cmake_minimum_required (VERSION 3.1.0)
The policy CMP0063 NEW: Honor visibility properties for all target
types.
is only introduced from version 3.3 and thus, the set_target_properties have no effects.
My project requires CMake 3.3, but I have no control on the subproject.
I would like to avoid patching the subproject CMakeLists.txt, but currently I see no other way.
Any idea ?