Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python/CMakeLists.txt: Fix install destination #184

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

podsvirov
Copy link
Contributor

@podsvirov podsvirov commented Apr 18, 2021

Added CMAKE_INSTALL_PYLIBDIR cached variable.
Default value retrivet from Python3_EXECUTABLE.

Current install destination Python3_SITELIB (absolute path from FindPython3 module).
An absolute path is not acceptable when creating an installation package.

@@ -15,7 +15,10 @@ add_test(NAME pywraps2_test COMMAND
set_property(TEST pywraps2_test PROPERTY ENVIRONMENT
"PYTHONPATH=$ENV{PYTHONPATH}:${PROJECT_BINARY_DIR}/python")

set(CMAKE_INSTALL_SITELIBDIR "${Python3_SITELIB}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Calling this CMAKE_ seems a bit strange. I would assume that's only for variables defined by CMake itself.

Can you point me at some CMake Python documentation or a canonical example? It seems no one has used this variable name before.

https://www.google.com/search?q=%22CMAKE_INSTALL_SITELIBDIR%22
https://github.com/search?q=CMAKE_INSTALL_SITELIBDIR

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, what problem are you trying to solve? Use of this variable should also be documented somewhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm trying to do something like there: https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jmr, please review #186 (this should clarify my motivation).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like there should be a relevant directory somewhere here:
https://cmake.org/cmake/help/latest/module/FindPython3.html

How do other swig/python/windows/cmake projects do it?

@jmr
Copy link
Member

jmr commented Apr 22, 2021

Does #186 make this unnecessary?

@podsvirov
Copy link
Contributor Author

These changes are not directly related to the #186. These changes solve the problem of hard-coded absolute installation path for the python module. Absolute install paths add additional problems when creating packages for distribution (in this case, it becomes necessary to install to a path other than the default).

Added CMAKE_INSTALL_PYLIBDIR cached variable.
Default value retrivet from Python3_EXECUTABLE.
@podsvirov podsvirov force-pushed the cmake-python-install-destination branch from 2fe6579 to 2ca43b5 Compare April 27, 2021 21:19
@podsvirov podsvirov requested a review from jmr April 27, 2021 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants