[CMake] GenerateExportHeader for module library

Clinton Stimpson clinton at elemtech.com
Thu Nov 1 10:04:54 EDT 2012


On Nov 1, 2012, at 8:01 AM, Stephen Kelly wrote:

> Gregoire Aujay wrote:
> 
>> Hello,
>> 
>> I am doing my tests with visual 2008 and mingw.
>> 
>> As far as I understand a module is like a shared library that cannot be
>> linked. Instead it is dynamically loaded and then we find and use symbols
>> in it. It is like doing the linker's job manually at runtime.
>> 
>> If nothing is exported from my module then I do cannot find any symbol in
>> it. Or at least I do not know how to do so.
>> 
>> I modified the GenerateExportHeader module to be able to export symbols
>> from my MODULE:
>> 
>>  # if(${type} STREQUAL "MODULE")
>>    # message(WARNING "This macro should not be used with libraries of
>>    # type MODULE") return()
>>  # endif()
>>  if(NOT ${type} STREQUAL "STATIC_LIBRARY" AND NOT ${type} STREQUAL
>>  "SHARED_LIBRARY" AND NOT ${type} STREQUAL "MODULE_LIBRARY")
>>    message(WARNING "This macro can only be used with libraries")
>>    return()
>>  endif()
>> 
>> 
>> Regards,
>> 
>> Gregoire
>> 
> 
> Please file a bug report so that this is not forgotten. 
> 
> Ideally also provide some code to test it. I'm not familiar with how plugins 
> should be loaded in a cross-platform way (without Qt, that is).
> 

Perhaps the BundleUtilities test can be modified to use GenerateExportHeader if you need some coverage.
It also loads plugins at runtime (without Qt).

Clint



More information about the CMake mailing list