[CMake] How to tell if a project is an ExternalProject

Marshall, Rob robm at qti.qualcomm.com
Tue Nov 6 17:43:54 EST 2012


Hi,

I am trying to write a snippet that will determine if a library is an external project.
So I wrote some code such as:
   ExternalProject_Get_Property( ${package} INSTALL_DIR )

To see if INSTALL_DIR gets populated.

In the case where the ${package} doesn't exist as an ExternalProject CMAKE displays an error:

CMake Error at /usr/share/cmake/Modules/ExternalProject.cmake:642 (get_property):
  get_property could not find TARGET XYX_LIB.  Perhaps it has not yet been created.

Is there a quiet way to call  ExternalProject_Get_Property( ${package} INSTALL_DIR)
Where INSTALL_DIR is just set to empty without an error being thrown

Or some other way to determine that a project is an ExternalProject?

Or a way to catch the CMAKE Error?

Thanks,
Rob


More information about the CMake mailing list