[CMake] How to use DEFINE_SYMBOL properly?

Mike Jackson mike.jackson at bluequartz.net
Tue Feb 9 08:29:36 EST 2010


http://www.cmake.org/Wiki/BuildingWinDLL

_________________________________________________________
Mike Jackson                  mike.jackson at bluequartz.net
BlueQuartz Software                    www.bluequartz.net
Principal Software Engineer                  Dayton, Ohio



On Tue, Feb 9, 2010 at 8:25 AM, Pau Garcia i Quiles
<pgquiles at elpauer.org> wrote:
> Hello,
>
> You are doing it wrong. You need to create a header file
> (myproject_exports.h, for instance) following
> http://gcc.gnu.org/wiki/Visibility . If you call your visibility macro
> target_EXPORTS, you do not need to modify the value of DEFINE_SYMBOL
> at all, CMake will automagically make use of it. You only need to do
> set_target_properties( target PROPERTIES DEFINE_SYMBOL
> my_visibility_macro ) if you want to use a different name for the
> macro (usually because it is an already-existing project which you are
> converting to CMake).
>
> On Tue, Feb 9, 2010 at 1:25 PM, Hilton Medeiros
> <medeiros.hilton at gmail.com> wrote:
>> Hello,
>>
>> From what I read and understood this DEFINE_SYMBOL property should be
>> defined like this (or something like this):
>>
>> On Windows, as shared library: target_EXPORTS=__declspec(dllexport)
>> On Linux, as shared library:
>> target_EXPORTS=__attribute__((visibility("default")))
>>
>>
>> So that I can use this symbol like this:
>>
>> class target_EXPORTS ExampleClass {...};
>>
>>
>> But on my machine (Linux, gcc) while building a shared library, with
>> CMake 2.8.0, I'm getting the error below because CMake is defining this
>> property with -Dtarget_EXPORTS=0:
>>
>> error: expected identifier before numeric constant
>>
>> What am I missing?
>>
>> Kind regards,
>> Hilton
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.cmake.org/mailman/listinfo/cmake
>>
>
>
>
> --
> Pau Garcia i Quiles
> http://www.elpauer.org
> (Due to my workload, I may need 10 days to answer)
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>


More information about the CMake mailing list