[CMake] Get program output in a variable?
Zachary Pincus
zpincus at stanford.edu
Sun Jan 15 15:39:32 EST 2006
Hi guys,
I'm trying to make a better CMake script to find the presence of the
Numerical Python libraries and their include directories. The easiest
way to do this in some cases (e.g. with the newest version of said
libraries, now called numpy) is to query the module itself within
python.
Is there a good way within CMake to run a program? TRY_RUN seems to
want to compile a file first... I'd just like to run something like:
"${PYTHON_EXECUTABLE} -c 'import numpy; print numpy.get_module_include
()'"
and get the output in a CMake variable.
Is this possible? If so, something similar might be a better way of
finding things like the python include path and so forth, rather than
looking in hard-coded places in a FindPythonLibs.cmake file.
Zach
More information about the CMake
mailing list