[CMake] How to get rid off predefine "XXX_EXPORTS" @add_library(XXX SHARED ...)

Michael Wild themiwi at gmail.com
Wed Jan 5 04:12:07 EST 2011


On 01/05/2011 10:05 AM, "Sören Freudiger" wrote:
> Hi
> I have a problem. After running CMake (VS 2003/2008 project) there's always a EXPORT preprocessor define in my project setting that I don't need.
> 
> add_library(XXX SHARED ...)
> 
> --> predefine XXX_EXPORTS
> 
> I manually set this predefine in a correct way (means in upper case!). CMake generate something like:
> 
> testProject_EXPORTS
> 
> but it should be:
> 
> TESTPOJECT_EXPORTS
> 
> Is there a way to supress this predfine?
> 
> Best regards 
> SirAnn
> 
> 
> 

Just set the target property DEFINE_SYMBOL to TESTPROJECT_EXPORTS, then
you don't have to set it manually any more and you get rid of
testProject_EXPORTS:

set_target_properties(testProject PROPERTIES
  DEFINE_SYMBOL TESTPROJECT_EXPORTS)


HTH

Michael


More information about the CMake mailing list