[cmake-developers] command line shortcuts for cmake

Alexander Neundorf alexander.neundorf at gmx.net
Wed Sep 27 13:17:08 EDT 2006


Hi,

locally I have implemented this almost.
You write a file CMakeArguments.txt and specify your shortcuts:

prefix:PATH=CMAKE_INSTALL_PREFIX:PATH

The file is in the CMakeCache format. This seemed better suited to me, since 
if normal cmake format would be used all cmake commands could be used there 
which might lead to strange effects. Additionally it seemed to me that the 
cmake parser also accesses cmMakefile and other things, and for the purpose 
of just translating command line options this doesn't have to exist.
So I just went for the cache file syntax.
It's working so far, and with the file above you can now do:

cmake <dir> ++prefix=/opt/blub

That works as expected.
As you may have noticed, it's "++prefix" instead of "--prefix".
I tried to produce an error message if a "--foo" option is given but it 
doesn't exist in the translation. This complained then also e.g. about 
"--check-build-system", since that's not in the translation. So for testing I 
just changed the "--" to "++" for translated arguments.
I'm quite sure this won't be accepted by users.
My code tries to translate every argument which starts with "--" (i.e. "++").  
If it doesn't find a translation it errors out. Is there a way to check 
whether some argument is a valid argument other than searching through the 
cmake sources and manually collect them all ?

Bye
Alex




More information about the cmake-developers mailing list