[cmake-developers] VISIBILITY_DEFAULT target property

Brad King brad.king at kitware.com
Mon May 20 09:07:51 EDT 2013


On 05/18/2013 06:18 AM, Stephen Kelly wrote:
> I've pushed a VISIBILITY_DEFAULT-property topic to my clone. It adds a 
> VISIBILITY_DEFAULT target property which works similar to the 
> POSITION_INDEPENDENT_CODE property, and is intended to replace the try-
> compiles in GenerateExportHeader.

Are there problems with the module that make a second solution worthwhile?
Unlike PIC, visibility is not a usage requirement, is it?  What is the
value in using a property for this?

> I assume I can't simply move the try-compiles to the Compiler/* because it's 
> to early to use it there?

Correct.

> Does it matter from a backward compatibility POV that 
> COMPILER_HAS_HIDDEN_VISIBILITY would no longer be in the cache? Should I add 
> it to the cache if (CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY) ?

No, I don't think so.  The try_compile results are INTERNAL cache entries
so they should not be manipulated by users anyway.

> How should visibility-inlines-hidden be handled? Introduce 
> CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN and use it if 
> VISIBILITY_DEFAULT == "hidden"?

If we go this route, yes.

-Brad



More information about the cmake-developers mailing list