[CMake] Weird if nesting problem

Alan W. Irwin irwin at beluga.phys.uvic.ca
Tue Dec 5 23:28:36 EST 2006


On 2006-12-05 20:05-0800 Brandon J. Van Every wrote:

> Alan W. Irwin wrote:
>> On 2006-12-05 14:44-0700 James Bigler wrote:
>> 
>>> CMake barfs on the first IF(EXISTS ${PARSER_EXECUTABLE}), probably 
>>> because it is trying to evaluate if this expression is part of the ENDIF 
>>> or something. It does this with 2.2.3, 2.4.3, 2.4.5 on Linux.
>> 
>> Try IF(EXISTS ${PARSER_EXECUTABLE}) ==> IF(EXISTS PARSER_EXECUTABLE)
>
> If that actually works, then the documentation is bugged.  PARSER_EXECUTABLE 
> is a variable name, not a file or directory name.

Ugh.  I wrote too quickly. You are absolutely right, Brandon.  Thanks for
that correction.

James, just ignore what I said.  We need more information before we can
figure out why that IF statement is failing.

Time to do some deeper investigation such as printing out
${PARSER_EXECUTABLE}. That variable name sounds like it should contain an
executable file, but does it?  The documentation of IF(EXISTS... warns
"Behavior is well-defined only for full paths".  So I doubt if your logic
will work properly if you are getting a *-NOTFOUND response to your
FIND_PROGRAM command that determines PARSER_EXECUTABLE.  Perhaps you should
surround everything with IF(PARSER_EXECUTABLE).... ENDIF(PARSER_EXECUTABLE)
to make sure it is not a *-NOTFOUND result?

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the Yorick front-end to PLplot (yplot.sf.net); the
Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________


More information about the CMake mailing list