Is there any platform independent way to get the path to a python installation's libpython, for use as a cmake argument? sysconfig.get_config_var gives some pieces but there's no consistent way I can get this working.
On OSX:
- No variable contains the actual basename of the library (libpython2.7.dylib)
sysconfig.get_config_var('LIBDIR')returns the directory libpython2.7.dylib is in (/usr/local/opt/python/Frameworks/Python.framework/Versions/2.7/lib)edit: There seems to be a bit of a discrepancy in when sysconfig is reporting a symlink and when it's reporting a real path.
LIBDIRdoes in fact contain libpython.2.7.dylib, but what I just noticed is that this is a symlink to /usr/local/Cellar/python/2.7.13_1/Frameworks/Python.framework/Versions/2.7/Python.INSTSONAMEpoints to Python.framework/Versions/2.7/Python, the basename of that path, but no variable I can find points to the parent part of that path.
On Ubuntu:
sysconfig.get_config_var('INSTSONAME')gives me the name of the library (libpython2.7.so.1.0).- No variable contains the directory it's in (/usr/lib/x86_64-linux-gnu/).
LIBDIRreturns only /usr/lib