[cmake-developers] [CMake 0012398]: "IF" infamous <variable/string> functionality fails to work with macro arguments

Mantis Bug Tracker mantis at public.kitware.com
Fri Aug 12 08:13:24 EDT 2011


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=12398 
====================================================================== 
Reported By:                freddie
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   12398
Category:                   CMake
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2011-08-12 08:13 EDT
Last Modified:              2011-08-12 08:13 EDT
====================================================================== 
Summary:                    "IF" infamous <variable/string> functionality fails
to work with macro arguments
Description: 
There is a problem with the "IF" command when it is used directly with macro
arguments. Apparently, they are not considered variables and are used directly
as strings.

However, if their contents can be construed as variables themselves (even though
it is not desired), we have a problem when the only way to perform the test is
to create another explicit variable assigning it to what the macro argument
contains.

The problem doesn't appear to pertain to functions.

Steps to Reproduce: 
Please use the attached CMakeLists.txt file with "cmake -Wno-dev .".

Additional Information: 
It would really be a good idea to create a version of if/elseif/else/endif which
does NOT attempt to treat its arguments as variables, either by creating a new
name for the command or, better yet, by adding a new policy (possibly not
associated with a version yet).

Otherwise, when trying to compare things which might be variables but should not
be treated as such for the purposes of the comparison, one runs into subtle
problems (when checks "randomly" fail) or has to create a level of indirection,
by setting a new variable just for that.

I am sure you've heard this all before.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2011-08-12 08:13 freddie        New Issue                                    
2011-08-12 08:13 freddie        File Added: CMakeLists.txt                    
======================================================================




More information about the cmake-developers mailing list