Hi,

I guess it is a well known fact that cmake command is almost never executed alone and for non-trivial examples usually hold some extra arguments (home directory, build directory, verbosity level, toolchains, options, ...). Also I guess that such commands doesn't change from day-to-day development process and an obvious way to reduce typing is to create wrapper build scripts (.bat or .sh, I personally use a Python one).

I have next suggestion of how it can be unified: introduce ini-like file (say ${HOME}/.configs/cmake/alias) with alias sections with frequently used generators/arguments.

Example of such file:

  [default]
    var: CMAKE_VERBOSE_MAKEFILE=ON
    home: .
    build-dir: _builds/default

  [clean]
    cmd: cmake -E remove_directory _builds

  [vs-12]
    inherit: default
    generator: Visual Studio 12 2013
    build-dir: _builds/vs-12

  [iphone]
    inherit: default
    generator: Xcode
    build-dir: _builds/ios-9-2
    var: CMAKE_TOOLCHAIN_FILE=/.../ios-9-2.cmake

  [ipad]
    inherit: default
    generator: Xcode
    build-dir: _builds/ios-9-1
    var: CMAKE_TOOLCHAIN_FILE=/.../ios-9-1.cmake

Usage:

  > cmake -c clean ipad

effectively equivalent to:

  > cmake -E remove_directory _builds
> cmake -H. -B_builds/ios-9-2 -DCMAKE_VERBOSE_MAKEFILE=ON -GXcode -DCMAKE_TOOLCHAIN_FILE=/.../ios-9-2.cmake

Name of the options may be:

  -c # classes (sectioins can be inherited)
  -a # alias
  -m # meta-targets

For now it's just a thought and I have no idea how it will work on practice so I can create a fork for experimenting. And if it will work fine for me I'm planning to add such feature to CMake upstream, so I'm ready to hear an appropriate implementation details.

Thoughts?

Ruslo

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to