[cmake-developers] [PATCH] Get the PYTHON_SITELIB directory in FindPythonLibs

Brad King brad.king at kitware.com
Thu Dec 17 11:12:13 EST 2015


On 12/16/2015 05:04 AM, Andreas Schneider wrote:
> similar to what I implemented in FindPerlLibs.cmake some years ago, I've added 
> PYTHON_SITELIB to FindPythonLibs. With PYTHON_SITELIB you have the location 
> where to install the python modules you built with cmake.
> 
> Example:
> 
> find_package(PythonInterp)
> find_package(PythonLibs)
> 
> python_add_module(my_py my_py.c)
> install(TARGETS my_py DESTINATION ${CMAKE_INSTALL_PREFIX}/${PYTHON_SITELIB})

One of the goals of FindPythonLibs is to work when cross-compiling such
that one cannot run the interpreter natively.  That is one reason we
don't just ask the interpreter where to get the libraries.  There has
been some discussion about doing such lookups conditionally when we
can run the interpreter but also having a fallback.

If there is another way to get this information then please use it.
Otherwise I'd rather not guarantee that we provide the information.
Projects can always run the same execute_process call themselves.

-Brad



More information about the cmake-developers mailing list