[CMake] File-Exists-Check after option went grey?

Timo Rumland cr at olympclan.de
Sun Jan 14 06:26:04 EST 2007


Hello,

I'm adding an Option like this:

  set( LIB_PATH_EXPAT ../libs/expat-1.95.8 CACHE PATH "Base path to expat library" )


The user then can change the path via the GUI. When I first start
cmake, this option is red, after I click on 'configure' the option
changes to grey.

Now, when the user changes the path to the library, so the content of
the variable LIB_PATH_EXPAT changes, I want to check, if the directory
(or a file in the directory) really exists.
But the important thing is, this check must be done when the option
goes from red to grey. I can't do the check at once cmake is started,
because then the user gets a warning like "can't find expat library in
..." right away he starts cmake the first time.

So the sequence of actions must be:

1. User starts cmake, library path (LIB_PATH_EXPAT) has dafault value,
   expat can't be found but no warning is displayed since the user did
   not get any chance to change the dir.
   (the option is red)

2. User changes the option (or just leaves it so) via the GUI

3. User clicks on 'configure', NOW the check is performed

4. If the lib can be found in the directory the user has choosen,
   display no warning. If it can't be found, display the warning.

5. The option is now grey.


Hope this makes things clear ;)


Thanks a lot for your help



More information about the CMake mailing list