[CMake] Preprocessor Definition for a single Target

Mike Jackson imikejackson at gmail.com
Fri Apr 13 18:14:20 EDT 2007


I have a CMakeLists.txt file with multiple targets in it. A single  
library and multiple apps that depend on the library. When I build  
the library I need to define a preprocessor but when I build the  
other targets I Don't want it defined. Does that make sense?

psuedo cmake file:

ADD_DEFINITION("_DLLEXPORT") //but I only want this to be applied to  
the library?
ADD_LIBRARY(BaseLib ${Base_Sources} )


ADD_DEFINITION("_DLLIMPORT") //and this only for the executable?
ADD_EXECUTABLE(BaseTest ${Base_Test_sources} )
TARGET_LINK_LIBRARIES(BaseTest BaseLib)


How would I do this? Use Target_Properties? Which I know little about..

thanks
--
Mike Jackson
imikejackson & gmail * com





More information about the CMake mailing list