On 2006-12-13 10:29+0100 Axel Roebel wrote:

Dear CMakers

I run into a little problem with the command line flag -D.
I'll often use the command line flag -D to pass variables to cmake.
Because typing long names like

-DTT_EXECUTABLE:PATH=tt

is boring I was pretty happy to see that I could do

-DTT_EXECUTABLE=tt

as well. Before you start shortcutting I have to add
some salt to this nice soup because unfortunately
it turns out that this nearly always works besides
if in CMakeLists.txt I do a FIND_PROGRAM.  For example with

MESSAGE("varstate: ${TT_EXECUTABLE}")
FIND_PROGRAM(TT_EXECUTABLE NAMES whatever)
MESSAGE("varstate: ${TT_EXECUTABLE}")

what happens is

$> cd /home/roebel/tmp/
$> cmake . -DTT_EXECUTABLE=whatever
varstate: whatever
varstate: /home/roebel/tmp/whatever

which shows that FIND_PROGRAM replaced the content of variable TT_EXECUTABLE
by $PWD/${TT_EXECUTABLE} which is nonsense most of the time.
After some more digging I found that with
-DTT_EXECUTABLE=whatever no cache variable is created
so the variable seems to be in kind of a zomby state.
However, it turns out that

cmake . -DTT_EXECUTABLE:=whatever

works correctly creating a string type cache variable.

So the questions are,
1. what is
-DTT_EXECUTABLE=whatever
supposed to do in contrast to

-DTT_EXECUTABLE:=whatever
or the book version
-DTT_EXECUTABLE:STRING=whatever

2.
can I rely on -DTT_EXECUTABLE:=whatever to work or am I still abusing a
current weakness of the command line type check.

Thanks for any illumination!

All your examples above have the path first.  Just out of curiosity, what
happens if you use the recommended style with the path on the end, i.e.,

cmake [options] <path-to-source>

?

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
__________________________
_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to