[CMake] Problems with add_definitions()

Bill Hoffman bill.hoffman at kitware.com
Tue May 1 17:06:50 EDT 2007


Alexander Neundorf wrote:
> On Tuesday 01 May 2007 07:05, Christian Ehrlicher wrote:
>   
>> Hi,
>>
>> I want to build a static and a dynamic lib from the same sources. It's
>> no problem until we need to export some functions :)
>>
>> // this defines MAKE_SOLID_LIB (with set_target_properties) so we can
>> use dllexport
>> kde4_add_library(solid SHARED ${solid_LIB_SRCS})
>>
>> // this defines nothing -> dllimport is assumed
>> kde4_add_library(solid_static STATIC ${solid_LIB_SRCS})
>>
>> I can't use add_definitions(-DSOLID_EXPORT=) here because it's added for
>> both libs. I also can't use set_target_properties with DEFINE_SYMBOL
>> because this is ignored when building a static lib...
>>
>> Any ideas how to solve this?
>>     
>
> SET_TARGET_PROPERTIES( ... COMPILE_FLAGS ...)
>   
Also, any shared library also has an automatic -D(libname)_EXPORTS 
defined by cmake, the name of this can be changed with 
set_target_properties.  See DEFINE_SYMBOL in the docs for 
set_target_properties.

-Bill


More information about the CMake mailing list