Am 10.01.2013 18:22, schrieb Sascha Cunz:
> In CMakeLists.txt:
> 
>> @@ -144,7 +146,7 @@ ELSE ()
>> SET(CMAKE_C_FLAGS "-D_GNU_SOURCE -Wall -Wextra 
>> -Wno-missing-field-initializers -Wstrict-aliasing=2 
>> -Wstrict-prototypes ${CMAKE_C_FLAGS}")
>> IF (MINGW) # MinGW always does PIC and complains if we tell it to
>> STRING(REGEX REPLACE "-fPIC" "" CMAKE_SHARED_LIBRARY_C_FLAGS 
>> "${CMAKE_SHARED_LIBRARY_C_FLAGS}")
>> - ELSE ()
>> + ELSEIF (BUILD_SHARED_LIBS)
> 
> Why wouldn't we want hidden visibility and position independent code
> in static builds?

The static build emits an library archive (.a) which is just a 
collection of objects and I don't think that hidden visibility would 
have any effect if the archive is statically linked in to some program 
(only if it is again linked against a shared object but this is a custom 
setting). Of course, there may be a mechanism that generates a big 
object file from the library archive where the visibility may be 
considered but I don't know if this is standard. That said, the hidden 
visibly probably wouldn't hurt for static builds. If requested I can 
prepare a patch to add the hidden visibility back to all kinds of 
builds.

As for -fPIC, I think whether this works is platform-dependent. I've 
never used CMake before but I'm surprised that for instance 
CMAKE_SHARED_LIBRARY_C_FLAGS doesn't contain -fPIC as well. Note that 
one can still add this flags in the cmake call when building the static 
library.

Bye
Sebastian