MantisBT - CMake
View Issue Details
0012362CMakeCMakepublic2011-07-27 13:052012-03-06 08:37
Christian Höltje 
David Cole 
normalminoralways
closedno change required 
anyWindowsany
CMake 2.8.5 
CMake 2.8.7 
0012362: installer has no command line options
The CMake installer (cmake-2.8.5-win32-x86.exe) doesn't take any command line options. It always starts the GUI.

Ideally, there would be a way to specify where to install via the command line so that the install runs "headless" (without GUI).

This is a *must* for installing across large build farms.

Thanks.
No tags attached.
Issue History
2011-07-27 13:05Christian HöltjeNew Issue
2011-07-27 13:11David ColeAssigned To => David Cole
2011-07-27 13:11David ColeStatusnew => assigned
2011-07-27 13:27David ColeNote Added: 0027080
2011-07-27 13:51David ColeNote Added: 0027081
2011-07-27 14:07Christian HöltjeNote Added: 0027082
2011-07-27 14:51David ColeNote Added: 0027083
2011-10-25 23:55David ColeNote Added: 0027650
2011-10-25 23:55David ColeStatusassigned => resolved
2011-10-25 23:55David ColeFixed in Version => CMake 2.8.7
2011-10-25 23:55David ColeResolutionopen => no change required
2012-03-06 08:37David ColeNote Added: 0028835
2012-03-06 08:37David ColeStatusresolved => closed

Notes
(0027080)
David Cole   
2011-07-27 13:27   
The CMake Win32 installer is built with NSIS, and as such, it supports some of the standard command line arguments that all such NSIS built installers do.

Specifically, you can write a silent automatic install command line like so:

  "C:\full\path\to\cmake-2.8.5-win32-x86.exe" /S /D=C:\path\to\install\to\with\no\spaces

Furthermore, you may silently call the uninstaller like so:

  C:\path\to\install\to\with\no\spaces\Uninstall.exe /S

Importantly, (I've determined this empirically by experiment, so I may be stating things overly strictly here, but I don't think so....) you must have:

- Most importantly, admin privileges -- this needs to be run in a "Run as Admin" type setting, or else Windows will prompt the user to see if it's ok to run an installer/uninstaller

- the "/S" indicates "silent" and means do not show the gui for the installer

- the "/D" must be the last argument you pass to the installer, indicating the root directory into which to install

- Everything after the "/D=" should name the full path to a directory with "\" separator characters, (not with "/") *and* with no spaces in it. It is still possible in Windows to construct a valid 8.3 old-school DOS name for any file or directory, and if you need to install it in a path that does have spaces in it for real, then you'll have to construct the short name equivalent to pass with /D=

This definitely works with CMake 2.8.3 and later, and may work as far back as 2.8.0. (I can't remember when the changes went in to get this to work well, but I'll look it up later and append another note here.)

After reading your bug report, I realized that we have not documented this "feature" on the Windows installer anywhere, and think that this will now be good fodder for a blog entry.

Thanks for the inspiration...
(0027081)
David Cole   
2011-07-27 13:51   
In the file "Modules/NSIS.template.in" the variable IS_DEFAULT_INSTALLDIR first appeared in an official release as of CMake 2.8.0.

That's the variable that gives us a heuristic for whether the installer should use the /D argument value or not. Since it first appeared in 2.8.0, you should be able to call any CMake Win32 installer with this silent install technique for 2.8.0 and later.

If you're running as admin, and you can accept the default value for CMake's installation directoy, you can use /S with any version of the CMake Win32 installer.

Let me know if you run into problems using this technique, or if you find any of this information to be invalid.
(0027082)
Christian Höltje   
2011-07-27 14:07   
No problems, that works great.

I'd just suggest adding a /? or /h option (or both) so that I could have figured that out. :-)
(0027083)
David Cole   
2011-07-27 14:51   
NSIS generates that executable, so we have no source code for it in the CMake tree. I do not know how to add "/?" or "/h" or "--help" argument handling to this executable...

If anybody else knows how to do that, then please point me to a way to do that.

In the meantime, I'll blog about it, and see if we can't figure out a reasonable place in the CMake documentation to put this information.
(0027650)
David Cole   
2011-10-25 23:55   
Blogged about here:

  http://www.kitware.com/blog/home/post/186 [^]

If anybody has a good suggestion about how to better document this feature within the CMake / CPack code itself, please re-open this issue and let us know what your suggestion is.

Thanks.
(0028835)
David Cole   
2012-03-06 08:37   
Closing resolved issues that have not been updated in more than 4 months.