Sunday, March 8, 2015

Override CMake in Cygwin

As of this writing, the CMake bundle with Cygwin is on version 3.1.2. This would be a bad news to me as I can't generate visual studio project using this tool. When I was issued a command cmake --help, this will shows a list of supported platform. Whereas the latest version of this writing would be 3.2.0-rc2. It has far more lists of supported platform.

Available generators on version 3.1.2.
Generators

The following generators are available on this platform:
  Unix Makefiles              = Generates standard UNIX makefiles.
  Ninja                       = Generates build.ninja files (experimental).
  CodeBlocks - Ninja          = Generates CodeBlocks project files.
  CodeBlocks - Unix Makefiles = Generates CodeBlocks project files.
  CodeLite - Ninja            = Generates CodeLite project files.
  CodeLite - Unix Makefiles   = Generates CodeLite project files.
  Eclipse CDT4 - Ninja        = Generates Eclipse CDT 4.0 project files.
  Eclipse CDT4 - Unix Makefiles = Generates Eclipse CDT 4.0 project files.
  KDevelop3                   = Generates KDevelop 3 project files.
  KDevelop3 - Unix Makefiles  = Generates KDevelop 3 project files.
  Kate - Ninja                = Generates Kate project files.
  Kate - Unix Makefiles       = Generates Kate project files.
  Sublime Text 2 - Ninja      = Generates Sublime Text 2 project files.
  Sublime Text 2 - Unix Makefiles = Generates Sublime Text 2 project files.
Available generators on version 3.2.0-rc2
Generators

The following generators are available on this platform:
  Visual Studio 6             = Generates Visual Studio 6 project files.
  Visual Studio 7             = Generates Visual Studio .NET 2002 project files.
  Visual Studio 10 2010       = Generates Visual Studio 10 (VS 2010) project files.
  Visual Studio 11 2012       = Generates Visual Studio 11 (VS 2012) project files.
  Visual Studio 12 2013       = Generates Visual Studio 12 (VS 2013) project files.
  Visual Studio 14 2015       = Generates Visual Studio 14 (VS 2015) project files.
  Visual Studio 7 .NET 2003   = Generates Visual Studio .NET 2003 project files.
  Visual Studio 8 2005        = Generates Visual Studio 8 2005 project files.
  Visual Studio 9 2008        = Generates Visual Studio 9 2008 project files.
  Borland Makefiles           = Generates Borland makefiles.
  NMake Makefiles             = Generates NMake makefiles.
  NMake Makefiles JOM         = Generates JOM makefiles.
  MSYS Makefiles              = Generates MSYS makefiles.
  MinGW Makefiles             = Generates a make file for use with mingw32-make.
  Unix Makefiles              = Generates standard UNIX makefiles.
  Ninja                       = Generates build.ninja files (experimental).
  Watcom WMake                = Generates Watcom WMake makefiles.
  CodeBlocks - MinGW Makefiles= Generates CodeBlocks project files.
  CodeBlocks - NMake Makefiles= Generates CodeBlocks project files.
  CodeBlocks - Ninja          = Generates CodeBlocks project files.
  CodeBlocks - Unix Makefiles = Generates CodeBlocks project files.
  CodeLite - MinGW Makefiles  = Generates CodeLite project files.
  CodeLite - NMake Makefiles  = Generates CodeLite project files.
  CodeLite - Ninja            = Generates CodeLite project files.
  CodeLite - Unix Makefiles   = Generates CodeLite project files.
  Eclipse CDT4 - MinGW Makefiles = Generates Eclipse CDT 4.0 project files.
  Eclipse CDT4 - NMake Makefiles = Generates Eclipse CDT 4.0 project files.
  Eclipse CDT4 - Ninja        = Generates Eclipse CDT 4.0 project files.
  Eclipse CDT4 - Unix Makefiles = Generates Eclipse CDT 4.0 project files.
  Kate - MinGW Makefiles      = Generates Kate project files.
  Kate - NMake Makefiles      = Generates Kate project files.
  Kate - Ninja                = Generates Kate project files.
  Kate - Unix Makefiles       = Generates Kate project files.
  Sublime Text 2 - MinGW Makefiles = Generates Sublime Text 2 project files.
  Sublime Text 2 - NMake Makefiles = Generates Sublime Text 2 project files.
  Sublime Text 2 - Ninja      = Generates Sublime Text 2 project files.
  Sublime Text 2 - Unix Makefiles = Generates Sublime Text 2 project files.
How could I upgrade the CMake in Cygwin? Unfortunately, this can't be done since the latest version I got is the one I had already installed. Try thinking out of the box, download the latest CMake in separate path, then override the Cygwin path with a new CMake path in environment variable, this is how I do it:
  1. Declare CMAKE_PATH pointing to the new CMake file system.
  2. Put this path before CYGWIN_PATH in PATH variable. 
This is how it looks like in PATH variable:

%CMAKE_PATH%\bin;%CYGWIN_PATH%\bin

With this change, I can only use it in DOS command because Cygwin will also reference to version 3.1.2.

No comments: