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

Andreas Schneider asn at cryptomilk.org
Thu Dec 17 11:39:04 EST 2015


On Thursday 17 December 2015 11:12:13 Brad King wrote:
> 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 you look at the code, my changes to the code are inside an already existing

  if (PYTHON_EXECUTABLE)
  ...

So if you don't call find_package(PythonInterp) before 
find_package(PythonLibs) it will not get the PATH information for 
PYTHON_SITELIB.

The behavior of the module doesn't not change with this addition!

As it seems you did not look with enough context at the patch you can view the 
changes with more context (40 lines) here:

https://git.cryptomilk.org/users/asn/cmake.git/commit/?h=asn_pythonlibs&id=e414ea43caedeffeb27bb367b5f6c41e6238052a&context=40&ignorews=0&dt=0


Cheers,


	-- andreas

-- 
Andreas Schneider                   GPG-ID: CC014E3D
www.cryptomilk.org                asn at cryptomilk.org


More information about the cmake-developers mailing list