[cmake-developers] CMAKE_VISIBILITY_INLINES_HIDDEN incorrectly applied to non C++ sources?

Stephen Kelly steveire at gmail.com
Fri Jan 31 08:27:56 EST 2014


Nils Gladitz wrote:

> I found CMAKE_VISIBILITY_INLINES_HIDDEN and wanted to replace my custom
> gcc flag with it.
> 
> For C it causes the warning: "command line option
> ‘-fvisibility-inlines-hidden’ is valid for C++/ObjC++ but not for C".
> 
> Independent of the actual language the code currently seems to apply
> CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN to the compile
> flags. (cmLocalGenerator.cxx AddInlineVisibilityCompileOption())
> 
> Is this intended?

Nope.

Does a patch like 

   AddVisibilityCompileOption(flags, target, this, lang);
-  AddInlineVisibilityCompileOption(flags, target, this);
+  if (strcmp(lang, "CXX"))
+    {
+    AddInlineVisibilityCompileOption(flags, target, this);
+    }


help? If so, can you see about adding a unit test and merging to next?

Thanks,

Steve.







More information about the cmake-developers mailing list