GenerateExportHeader and clang

Alex Merry alex.merry at kde.org
Mon May 19 10:02:34 UTC 2014


On 18/05/14 20:03, Ivan Čukić wrote:
> 
>> Ah, but what is clang's return value when there is an unrecognized option?
> 
> It is 0. That is why I find the situation so strange. :)

And I thought I was being clever :-)

It turns out that GenerateExportHeader uses check_cxx_compiler_flag,
which greps the output of the compiler for text like "unknown .*option"
or "unrecognized .*option". Given the *other* unknown option, it finds
this output and concludes that -fvisibility=hidden is unsupported.

This happens entirely independently of the CMAKE_CXX_VISIBILITY_PRESET
and CMAKE_VISIBILITY_INLINES_HIDDEN options that actually set those
flags on the compiler command line.

So there are a couple of interacting issues here:
check_cxx_compiler_flag is fragile in the face of unrelated unknown
options, and the mechanism for deciding whether to add
-fvisibility=hidden to the command line is different to the mechanism
for deciding whether to put export symbols into the library.

Alex



More information about the Kde-frameworks-devel mailing list