[CMake] set_target_properties and complile_flags

Micha Renner Micha.Renner at t-online.de
Tue Apr 14 04:37:57 EDT 2009


Here is a small CMake script which generates an make error(Linux only):

ADD_LIBRARY(${_targetname} file.c)

SET_TARGET_PROPERTIES(${_targetname} PROPERTIES
	COMPILE_FLAGS  "-DRED -DGREEN 
			-DBLUE -DYELLOW")

If one writes
SET_TARGET_PROPERTIES(${_targetname} PROPERTIES
	COMPILE_FLAGS  "-DRED -DGREEN -DBLUE -DYELLOW")
everything is okay.

Another point is:
SET_TARGET_PROPERTIES(${_targetname} PROPERTIES
	COMPILE_FLAGS  -DRED=\"rot\")

Same as ADD_DEFINITIONS before CMP0005.
I mean, if it works with ADD_DEFINITIONS, it should work with
set_target_properties too. Same logic.

Michael




More information about the CMake mailing list