[CMake] Finding Python Modules with CMake

Michael Wild themiwi at gmail.com
Mon Jan 3 04:38:47 EST 2011


On 01/03/2011 09:17 AM, Todd Gamblin wrote:
> Is there a way in CMake, once I find the python interpreter, to query for the availability of a particular module?  e.g. say I want to make sure that the host's python installation has PyQt4, or numy, or something like that.  Do I have to manually run the interpreter, try to import it, and check the return code, or is there a builtin for that?
> 
> Something like this would be handy for the python modules:
> 
> 	http://www.gnu.org/software/autoconf-archive/ax_python_module.html
> 
> Again, I couldn't find much in the docs for this.
> 
> -Todd

No, there's no such thing. You're welcome to contribute it, though ;-)
If you do, make sure it also works when cross-compiling (i.e. delegate
the responsibility of answering these questions to the user).

Michael



More information about the CMake mailing list