[vtk-developers] Visibility flags and C

David Gobbi david.gobbi at gmail.com
Wed Aug 15 17:02:23 EDT 2012


On Wed, Aug 15, 2012 at 2:55 PM, Marcus D. Hanwell
<marcus.hanwell at kitware.com> wrote:
> On Wed, Aug 15, 2012 at 4:32 PM, David Gobbi <david.gobbi at gmail.com> wrote:
>> On Wed, Aug 15, 2012 at 2:11 PM, Marcus D. Hanwell
>> <marcus.hanwell at kitware.com> wrote:
>>>
>>> I think we are doing this for all VTK libraries that are built shared,
>>> and I didn't account for C only libraries. Is there a good way to tell
>>> if a target is a C only library from the CMake level for things like
>>> this?
>>
>> When BUILD_SHARED_LIBS is ON, then it is done for all libraries,
>> whether the individual libraries are built shared or not.  Not to say
>> that's wrong... in fact I think that it's the right way to go.  The
>> flags are added around line 467 in vtkModuleMacros.cmake:
>
> For all libraries in vtk_module_library, which are controlled by
> BUILD_SHARED_LIBS. So when the libraries are built static it will not
> be passed.
>>
>> if (BUILD_SHARED_LIBS)
>>   add_compiler_export_flags(my_abi_flags)
>>   ...
>>
>> But the main issue is that the same flags are added for both C and
>> C++, even though -fvisibility-inlines-hidden is a C++-only flag.
>>
> I think we could use the LINKER_LANGUAGE property Dave Cole pointed
> out, and filter appropriately. VTK is mainly a C++ toolkit, so when I
> added this code I assumed all libraries using vtk_module_library would
> be C++ libraries - are you sure you wouldn't be better just using
> vtk_add_library? They are expected to be VTK C++ modules when that
> function is called.

Yeah, I think that vtk_add_library is the right way to go.  It doesn't
make sense to force vtk_module_library to do things that it really
isn't meant to do.

 - David



More information about the vtk-developers mailing list