<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
I'm looking to have a certain group of variables controlled
primarily by one master setting<br>
<br>
I want the cache value to be ignored when the user explicitly
provides the master variable on the command line and whenever the
value of the variable changes.<br>
<br>
Put another way: When the user EXPLICITLY specifies or changes the
value of MasterVariable, I want to delete the values of
${${AffectedVariables_MasterVariable}} from the cache.<br>
<br>
Example:<br>
<br>
Master: "VARIANT"<br>
Controls: SSE2, SSE3, PACKAGE_FORMAT<br>
Setting1: VARIANT=Internal, SSE2=OFF, SSE3=OFF,
PACKAGE_FORMAT=TGZ<br>
Setting83: VARIANT=Eval, SSE2=ON, SSE3=ON, PACKAGE_FORMAT=DEB<br>
Setting509: VARIANT=Client623, SSE=ON, SSE3=OFF,
PACKAGE_FORMAT=RPM<br>
PIZZA: XL<br>
...<br>
<br>
CMakeCache.txt values:<br>
VARIANT=Internal, SSE2=ON, SSE3=OFF, PACKAGE_FORMAT=TGZ, PIZZA=L<br>
$ cmake -DVARIANT=Internal -DPIZZA=Medium<br>
VARIANT=Internal, *SSE2=OFF*, SSE3=OFF, PACKAGE_FORMAT=TGZ, PIZZA=M<br>
(SSE2 was reset to it's default value)<br>
$ cmake -DPACKAGE_FORMAT=RPM -DVARIANT=Internal<br>
VARIANT=Internal, SSE2=OFF, SSE3=OFF, PACKAGE_FORMAT=RPM, PIZZA=M<br>
(All values were reset but the -DPACKAGE_FORMAT overrode the default
of that option, non-controlled value, PIZZA, left alone)<br>
$ cmake -DEval<br>
VARIANT=Eval, *SSE2=ON*, *SSE3=ON*, *PACKAGE_FORMAT=DEB*, PIZZA=M<br>
(previously user-specified package_format was reset because it was
not explicitly provided)<br>
$ cmake .<br>
(No changes because no VARIANT explicitly specified)<br>
<br>
If this was being implemented by deleting the CMakeCache.txt file,
then the value of "PIZZA" would be continually clobbered along with
all the other values...<br>
<br>
Is there a way to do this? I'm wanting to build it something like:<br>
<blockquote>OPTION(SSE2 "Enable SSE2 instructions" OFF) --
General default.<br>
...<br>
<br>
IF ( VARIANT BECOMES "Internal" )<br>
DEFAULT(SSE2 OFF)<br>
DEFAULT(SSE3 OFF)<br>
DEFAULT(PACKAGE_FORMAT "TGZ")<br>
ELSEIF ( VARIANT BECOMES "Eval" )<br>
DEFAULT(SSE2 ON)<br>
DEFAULT(SSE3 OFF)<br>
DEFAULT(PACKAGE_FORMAT "DEB")<br>
ELSEIF ( VARIANT BECOMES "Client623" )<br>
DEFAULT(SSE2 ON)<br>
DEFAULT(SSE3 OFF)<br>
DEFAULT(PACKAGE_FORMAT "RPM")<br>
ELSEIF ...<br>
</blockquote>
Or perhaps the slightly less error-prone:<br>
<br>
OPTIONS(<name of control variable> VALUE <value to default
to> DEFAULTS<br>
VARIABLE:VALUE<br>
...)<br>
<br>
This would then complain about the following, because the second
OPTIONS has a different list for the same control as the previous
incarnation:<br>
<br>
OPTIONS(VARIANT VALUE "Internal" DEFAULTS<br>
SSE2 OFF<br>
SSE3 OFF<br>
PACKAGE_FORMAT "TGZ"<br>
)<br>
OPTIONS(VARIANT VALUE "Eval" DEFAULTS<br>
SSE2 ON<br>
SES3 OFF # Typo<br>
PACKAGE_FORMAT "DEB"<br>
)<br>
OPTIONS(VARIANT VALUE "Client623" DEFAULTS<br>
SSE2 ON<br>
SSE3 OFF<br>
PACKAGE_FORMAT "RPM"<br>
)<br>
<br>
Another advantage of this is that the GUI/CCMake could use these to
build a drop-down list of "VARIANT" settings, and CMake itself could
ascertain that "-DVARIANT=Intrenal" (typo) is invalid (-DVARIANT is
used in OPTIONS but there is no OPTIONS that matches Intrenal).<br>
<br>
- Oliver<br>
<br>
</body>
</html>