[cmake-developers] command line argument shortcuts

Brad King brad.king at kitware.com
Mon Sep 18 10:22:45 EDT 2006


Alexander Neundorf wrote:
> there was talk about adding support for configurable command line arguments to 
> cmake.
> You know, so that one can say "--prefix" maps to CMAKE_INSTALL_PREFIX and 
> "--with-tests" maps to "ENABLE_TESTS" or whatever somebody might want.
> Is somebody working on this ?
> Otherwise I might give it a try.
> 
> How about:
> -if a file ${CMAKE_SOURCE_DIR}/CMakeShortcuts.cmake" exists, load it
> -with contents something like this:
> SET(--prefix "-DCMAKE_INSTALL_PREFIX:STRING")
> SET(--with-tests "-DENABLE_TESTS:BOOL")
> 
> Then if cmake detects an unknown command line option, it could just check if 
> there is a replacement defined and use this instead.

This looks like a reasonable start to an interface.  I like the idea of
having a separate file specify it because the file can be detected and
loaded before the rest of the command line is loaded.  Options before
the path to the source or build tree will not be able to use this but
that's okay.

We should also have a way to provide documentation for these overrides
so that if the user runs

  cmake /path/to/source --help

the project-specific help is displayed.  All of the pre-configuration
per-project information should probably be accessible through one file,
so let's call it something other than CMakeShortcuts.cmake.  Perhaps
CMakeInterface.cmake?

No one is working on this.  Feel free to try it yourself.

Thanks,
-Brad



More information about the cmake-developers mailing list