[CMake] Restoring a FORCE variable.. but only once!

Iacopo Palazzi iakko at siena.linux.it
Fri Jun 8 22:05:33 EDT 2007


Hi there,
googling about the issue I'm about to ask, I could not find an answer on the 
net (sorry if there is and I did not see it).

Assume you have 2 variables that an user can set up with ccmake, and assume 
that the second one depends to the first:

<CMakeLists.txt>

	SET(A "/usr/ CACHE STRING "A path")
	SET(B "${A}/share" CACHE STRING "B path depending on A" FORCE)

On ccmake, an user can change the A variable setting it to "/var", thus 
pressing the 'c' key, the B variable is going to change to "/var/share".

It's usefull when there are many variables depending on a root-one!

Let's assume now that an user wants to restore the depending one 
(B="/var/share") to the original value (B="/usr/share"). Well done! But, as 
far as the 'c' letter is being pressed (reconfiguring through ccmake), the B 
variable is going to be restored to the new A value, that is 
B=A="/var/share" ! That's not good because the user wanted it to the old 
value A="/usr/share".

It's not a nice behaviour, since the B variable is completely unusefull on the 
ccmake configuration pannel, inasmuch it is going to be always restored to 
the value[s] of the dependig variable[s] (thwarting user modifications).

What I'm looking for is a way to set up a variable that follows his depending 
ones as far as it is not changed by the user!
Using this aproach, when the user changes the value, it will be left unchanged 
(at least, until the user changes it again).

For Example (what I'm dreaming about):

<CMakeLists.txt>

	SET(A "/usr/ CACHE STRING "A path")
	SET(B "${A}/share" CACHE STRING "B path depending on A" FORCEONCE)

Epoch 0:
	A = "/usr"
	B = "/usr/share"

Epoch 1: 
	A <- "/opt"
	pressing 'c'
	B = "/opt/share"

Epoch 2:
	A <- "/usr"
	..pressing 'c'..
	B = "/usr/share"
	B <- "/opt/share"
	..pressing 'c'..
	A = "/usr"
	B = "/opt/share"


I found out a method using some script-tricks, but I don't like it and I'd 
like to know if there is a built-int method fot that!

Thanks

-- 
--------------------------------------------------------------
Iacopo Palazzi <iakko at siena.linux.it>
GPG Public Key: http://iakko.net/iakko.gpgkey.asc
Fingerprint: B0A8 BC97 C53E 172D 0C77 80B3 C30E 835F 5C31 65AE
Jabber: iakko at jabber.linux.it - ICQ: 7622157
Siena Linux User Group - www.siena.linux.it

"Se solo Dio mi desse i sorgenti..."
--------------------------------------------------------------


More information about the CMake mailing list