[CMake] How to get ADD_DEFINITIONS variable?

Marcel Loose loose at astron.nl
Tue Nov 17 06:03:40 EST 2009


Hi SirAnn,

COMPILE_DEFINITIONS is a directory property, not a variable.
You can retrieve that value using get_directory_property(). For example:

  get_directory_property(defs COMPILE_DEFINITIONS)
  message(STATUS "Compile definitions: ${defs}")

Note that the value of COMPILE_DEFINITIONS is scope dependent, as each
add_subdirectory() creates a new scope.

Hope this helps,
Marcel Loose.

On Tue, 2009-11-17 at 10:40 +0100, "Sören Freudiger" wrote:
> Hi @all
> In our project we are several times adding preprocessor defines via ADD_DEFINITIONS.
> Now I need to get these defines to add them for a ADD_CUSTOM_COMMAND (pre build via swig ).
> 
> The documentations says that these defines are stored in 
> 	COMPILE_DEFINITIONS
> but this variable is empty!!!
> 
> Is there any way to obtain the preprocessor defines?
> 
> Best,
> SirAnn
> 



More information about the CMake mailing list