MantisBT - CMake
View Issue Details
0013393CMakeCMakepublic2012-07-11 10:292013-01-09 10:56
Stephen Kelly 
Brad King 
normalminoralways
closedfixed 
 
CMake 2.8.9CMake 2.8.9 
0013393: if() behavior is different with macro parameters
The if(<variable>) signature always evaluates to false if <variable> is a macro parameter:

https://codereview.qt-project.org/#change,30630 [^]

This is not currently documented.

function() parameters already behave consistently with variables set with set().

This should be either documented or changed to match the behavior with regular variables.
No tags attached.
Issue History
2012-07-11 10:29Stephen KellyNew Issue
2012-07-11 10:35Brad KingNote Added: 0030038
2012-07-11 10:36Stephen KellyNote Added: 0030039
2012-07-11 10:46Brad KingNote Added: 0030040
2012-07-11 10:46Brad KingAssigned To => Brad King
2012-07-11 10:46Brad KingStatusnew => resolved
2012-07-11 10:46Brad KingResolutionopen => fixed
2012-07-11 10:46Brad KingTarget Version => CMake 2.8.9
2012-07-11 10:46Brad KingDescription Updatedbug_revision_view_page.php?rev_id=746#r746
2012-08-09 19:45David ColeFixed in Version => CMake 2.8.9
2013-01-09 10:56Robert MaynardNote Added: 0032038
2013-01-09 10:56Robert MaynardStatusresolved => closed

Notes
(0030038)
Brad King   
2012-07-11 10:35   
The documentation of the macro() command:

 http://www.cmake.org/cmake/help/v2.8.8/cmake.html#command:macro [^]

explains how literal "${arg}" replacement is done before evaluation. It also explicitly states

 "parameters to a macro and values such as ARGN are not variables"
(0030039)
Stephen Kelly   
2012-07-11 10:36   
Ok. If that's not going to be changed, it might be worth also adding a note to the documentation of if(), which is where I looked for it.
(0030040)
Brad King   
2012-07-11 10:46   
Simple enough:

 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=674c56c3 [^]
(0032038)
Robert Maynard   
2013-01-09 10:56   
Closing resolved issues that have not been updated in more than 4 months.