Skip to content

Commit 8967cba

Browse files
authored
Fix path (#7)
1 parent 6d6ec8e commit 8967cba

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

python/CMakeLists.txt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,18 @@ if(${pybind11_FOUND} AND ${COMPILE_PYTHON_BINDINGS})
88

99
message(STATUS "Found python (${Python3_EXECUTABLE}) will compile python bindings")
1010

11+
# Check if we install into system pathes ( something /usr/* )
12+
# In Debian/Ubuntu site-packages are named dist-packages there
13+
# Otherwise install as site-packages
14+
string(REGEX MATCH "^/usr/" IS_ROOT_USR_PATH ${CMAKE_INSTALL_PREFIX})
15+
if("${IS_ROOT_USR_PATH}" STREQUAL "/usr/")
16+
set(SITE_DIRECTORY_NAME "dist-packages")
17+
else()
18+
set(SITE_DIRECTORY_NAME "site-packages")
19+
endif()
20+
1121
# get python install path
12-
set(PYTHON_SITE "lib/python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}/dist-packages")
22+
set(PYTHON_SITE "lib/python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}/${SITE_DIRECTORY_NAME}")
1323
message(STATUS "Python install dir: ${PYTHON_SITE}")
1424

1525
include_directories(${CMAKE_CURRENT_SOURCE_DIR})

0 commit comments

Comments
 (0)