[cmake-developers] [CMake 0014429]: SET_TARGET_PROPERTIES() Broken for COMPILE_DEFINITIONS?
Mantis Bug Tracker
mantis at public.kitware.com
Fri Sep 20 16:17:57 EDT 2013
The following issue has been SUBMITTED.
======================================================================
http://www.cmake.org/Bug/view.php?id=14429
======================================================================
Reported By: Rob Stewart
Assigned To:
======================================================================
Project: CMake
Issue ID: 14429
Category: CMake
Reproducibility: always
Severity: major
Priority: normal
Status: new
======================================================================
Date Submitted: 2013-09-20 16:17 EDT
Last Modified: 2013-09-20 16:17 EDT
======================================================================
Summary: SET_TARGET_PROPERTIES() Broken for
COMPILE_DEFINITIONS?
Description:
According to my efforts, SET_TARGET_PROPERTIES() fails for COMPILE_DEFINITIONS.
On the one hand, one might suppose that none of the values should be prefixed by
"-D", thinking that the contents of that property will be enumerated and that
"-D" or "/D" will be inserted ahead of each value on the command line. That
doesn't work. The values appear as set by SET_TARGET_PROPERTIES(). So, one
decides to ensure that all values are prefixed by "-D". That doesn't work
either, according to what I'm seeing. The problem is that the first one is
prefixed by "-D" and none of the rest are. IOW, it seems like
SET_TARGET_PROPERTIES(), for COMPILE_DEFINITIONS, expects only one definition,
but since one must, in general, use GET_TARGET_PROPERTY() first, to get the
current values, then add new definitions, one is very likely to set multiple
definitions.
Either SET_TARGET_PROPERTIES() should require "-D" prefixed to each definition,
when setting COMPILE_DEFINITIONS, or it should expect that no value is prefixed.
I think that SET_TARGET_PROPERTIES() should accept a quoted list (with
semicolons), not just a space separated list of values, so I suggest that
SET_TARGET_PROPERTIES(target PROPERTIES COMPILE_DEFINITIONS "value") iterate
value and prepend "-D", as needed. Since that property is actually used after
it is set, I'm really suggesting that the using code do the iteration
(SET_TARGET_PROPERTIES() should really just save the values it's given).
Steps to Reproduce:
SET_TARGET_PROPERTIES(target PROPERTIES COMPILE_DEFINITIONS "a b c")
Observe "-Da b c" in the compilation command.
SET_TARGET_PROPERTIES(target PROPERTIES COMPILE_DEFINITIONS "-Da -Db -Dc")
Observe "-D-Da -Db -Dc" in the compilation command.
======================================================================
Issue History
Date Modified Username Field Change
======================================================================
2013-09-20 16:17 Rob Stewart New Issue
======================================================================
More information about the cmake-developers
mailing list