Skip to content

Commit 2ca43b5

Browse files
committed
python/CMakeLists.txt: Fix install destination
Added CMAKE_INSTALL_PYLIBDIR cached variable. Default value retrivet from Python3_EXECUTABLE.
1 parent 57fc29b commit 2ca43b5

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/python/CMakeLists.txt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,15 @@ add_test(NAME pywraps2_test COMMAND
1515
set_property(TEST pywraps2_test PROPERTY ENVIRONMENT
1616
"PYTHONPATH=$ENV{PYTHONPATH}:${PROJECT_BINARY_DIR}/python")
1717

18+
execute_process(COMMAND ${Python3_EXECUTABLE} -c
19+
"from distutils import sysconfig; print(sysconfig.get_python_lib(prefix=''))"
20+
OUTPUT_VARIABLE CMAKE_INSTALL_PYLIBDIR_DEFAULT
21+
OUTPUT_STRIP_TRAILING_WHITESPACE)
22+
23+
set(CMAKE_INSTALL_PYLIBDIR "${CMAKE_INSTALL_PYLIBDIR_DEFAULT}"
24+
CACHE STRING "Python site-packages installation directory")
25+
1826
# Install the wrapper.
19-
install(TARGETS _pywraps2 DESTINATION ${Python3_SITELIB})
27+
install(TARGETS _pywraps2 DESTINATION "${CMAKE_INSTALL_PYLIBDIR}")
2028
install(FILES "${PROJECT_BINARY_DIR}/python/pywraps2.py"
21-
DESTINATION ${Python3_SITELIB})
29+
DESTINATION "${CMAKE_INSTALL_PYLIBDIR}")

0 commit comments

Comments
 (0)