Skip to content

Commit

Permalink
python/CMakeLists.txt: Fix install destination
Browse files Browse the repository at this point in the history
Added CMAKE_INSTALL_PYLIBDIR cached variable.
Default value retrivet from Python3_EXECUTABLE.
  • Loading branch information
podsvirov committed Apr 27, 2021
1 parent 57fc29b commit 2ca43b5
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,15 @@ add_test(NAME pywraps2_test COMMAND
set_property(TEST pywraps2_test PROPERTY ENVIRONMENT
"PYTHONPATH=$ENV{PYTHONPATH}:${PROJECT_BINARY_DIR}/python")

execute_process(COMMAND ${Python3_EXECUTABLE} -c
"from distutils import sysconfig; print(sysconfig.get_python_lib(prefix=''))"
OUTPUT_VARIABLE CMAKE_INSTALL_PYLIBDIR_DEFAULT
OUTPUT_STRIP_TRAILING_WHITESPACE)

set(CMAKE_INSTALL_PYLIBDIR "${CMAKE_INSTALL_PYLIBDIR_DEFAULT}"
CACHE STRING "Python site-packages installation directory")

# Install the wrapper.
install(TARGETS _pywraps2 DESTINATION ${Python3_SITELIB})
install(TARGETS _pywraps2 DESTINATION "${CMAKE_INSTALL_PYLIBDIR}")
install(FILES "${PROJECT_BINARY_DIR}/python/pywraps2.py"
DESTINATION ${Python3_SITELIB})
DESTINATION "${CMAKE_INSTALL_PYLIBDIR}")

0 comments on commit 2ca43b5

Please sign in to comment.