MantisBT - CMake
View Issue Details
0010743CMakeCMakepublic2010-05-21 06:512010-11-09 22:57
Rolf Eike Beer 
David Cole 
normalfeatureN/A
closedfixed 
CMake-2-8 
CMake 2.8.3CMake 2.8.3 
0010743: Add dependencies to OPTION
It would be useful if OPTION had an additional DEPENDS argument. If the argument is evaluated to boolean false (applying the usual rules of IF()) and it is still selected an error is raised.
Example:

OPTION(bar "enables bar" OFF)
OPTION(foo "enables foo" OFF DEPENDS bar)

Should be equivalent to

OPTION(bar "enables bar" OFF)
OPTION(foo "enables foo" OFF)
IF (foo AND NOT bar)
  MESSAGE(SEND_ERROR "You can't select \"foo\" because it's dependencies (bar) were not met")
ENDIF ()

The GUI then could gray out all options with unmet dependencies to make the user's life easier.
No tags attached.
Issue History
2010-05-21 06:51Rolf Eike BeerNew Issue
2010-08-25 07:21David ColeNote Added: 0021940
2010-08-25 08:44Rolf Eike BeerNote Added: 0021948
2010-08-25 11:11David ColeNote Added: 0021956
2010-08-25 13:37Rolf Eike BeerNote Added: 0021961
2010-08-25 15:27David ColeStatusnew => assigned
2010-08-25 15:27David ColeAssigned To => David Cole
2010-08-25 15:28David ColeNote Added: 0021965
2010-08-25 15:28David ColeStatusassigned => resolved
2010-08-25 15:28David ColeFixed in Version => CMake-2-8
2010-08-25 15:28David ColeResolutionopen => fixed
2010-08-31 18:01David ColeTarget Version => CMake 2.8.3
2010-09-10 00:04David ColeFixed in VersionCMake-2-8 => CMake 2.8.3
2010-11-09 22:57Philip LowmanStatusresolved => closed

Notes
(0021940)
David Cole   
2010-08-25 07:21   
Are you aware of the CMakeDependentOption module?

http://www.cmake.org/cmake/help/cmake-2-8-docs.html#module:CMakeDependentOption [^]

It does not "gray things out" in the GUI, but it does give some help to making options depend on other options. It also does not raise any errors.

But perhaps it suffices for the use case you were thinking of when you entered this issue?
(0021948)
Rolf Eike Beer   
2010-08-25 08:44   
Yes, that sounds very helpful. Maybe this should be mentioned in the documentation of the OPTION command then, how should anyone find this if he does not know what name to search for?
(0021956)
David Cole   
2010-08-25 11:11   
Good point. How does this sound as additional documentation for the OPTION command:

"If you have options that depend on the values of other options, see the module help for CMakeDependentOption."
(0021961)
Rolf Eike Beer   
2010-08-25 13:37   
Yes, that sounds good. Now the GUI just has to know to also look on this makro added options ;)
(0021965)
David Cole   
2010-08-25 15:28   
Documentation added to the OPTION command to point to the CMakeDependentOption command.

In 'next' branch of CMake as of now:
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9e62ac0b400c5aff953b74c8f8187ba9f4f71969 [^]

We are not going to add anything to the cmake-gui app for now related to this issue.