How to catch CMake Error get_directory_property

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to catch CMake Error get_directory_property

Marcel Loose
Hi all,

Is there a way to catch the CMake Error 'get_directory_property' when
requesting a property from a directory that has not yet been processed
by CMake.

I need to do this, because, in my situation, it is not an error if one
or more directories are not present (i.e. checked out). I would like
get_directory_property() to return FALSE or NOTFOUND when it cannot find
the requested directory, so that I can take appropriate action myself.
Is that somehow possible?

Best regards,
Marcel Loose.
 

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: How to catch CMake Error get_directory_property

Eric Noulard
2009/8/10 Marcel Loose <[hidden email]>:
> Hi all,
>
> Is there a way to catch the CMake Error 'get_directory_property' when
> requesting a property from a directory that has not yet been processed
> by CMake.

The doc says:
"If the property is not found, CMake will report an error."
and
"You can only get properties of a directory during
       or after it has been traversed by cmake."


> I need to do this, because, in my situation, it is not an error if one
> or more directories are not present (i.e. checked out). I would like
> get_directory_property() to return FALSE or NOTFOUND when it cannot find
> the requested directory, so that I can take appropriate action myself.
> Is that somehow possible?

May be you can check the directory exists with

if(EXISTS <directory>)

before

calling get_directory_property.

or coding your own

my_get_directory_property which does the job you want.

--
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake