[CMake] execute_process spew test

Rolf Eike Beer eike at sf-mail.de
Mon Dec 20 07:27:37 EST 2010


> Greetings
>
> I tried an execute_process that  spits out a file. Llets call this
> ${someDirectory}/someFile.
>
> I then tried   to do a test like so
>   if( ${someDirectory}/someFile 1 )
>   --- do something
> endif( ${someDirectory}/someFile 1 )
>
> but it does not seem to work
>
> in  shell scripts{linux}   we can use   the following:-
>  if  [-f  ${someDirectory}/someFile ] ;  do somehing
>  or
>  if  [-r ${someDirectory}/someFile ];   do something else
>
> advice on their equivalent in cmake scripts would be appreciated.

You should really start to read the man page.

===
  if(EXISTS file-name)
  if(EXISTS directory-name)

 True if the named file or directory exists. Behavior is well-defined only
for full paths.
===

Eike


More information about the CMake mailing list