forked from google/or-tools
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpython-install.cmake.in
31 lines (29 loc) · 939 Bytes
/
python-install.cmake.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
if(DEFINED ENV{DESTDIR})
# If DESTDIR is not absolute path, make it relative to @PROJECT_BINARY_DIR@
# like any install() command.
if(IS_ABSOLUTE $ENV{DESTDIR})
set(ROOT "--root=$ENV{DESTDIR}")
else()
set(ROOT "--root=@PROJECT_BINARY_DIR@/$ENV{DESTDIR}")
endif()
else()
set(ROOT "")
endif()
# Check if we have system Python on Debian/Ubuntu, if so tell setuptools
# to use the deb layout (dist-packages instead of site-packages).
execute_process(
COMMAND @Python3_EXECUTABLE@ -c "import sys; sys.stdout.write(sys.path[-1])"
OUTPUT_VARIABLE Python_STDLIB_DIR
)
if(Python_STDLIB_DIR MATCHES ".*/dist-packages$")
set(SETUPTOOLS_INSTALL_LAYOUT "--install-layout=deb")
else()
set(SETUPTOOLS_INSTALL_LAYOUT "")
endif()
execute_process(
WORKING_DIRECTORY @PROJECT_BINARY_DIR@/python
COMMAND @Python3_EXECUTABLE@ setup.py install
${ROOT}
--prefix=@CMAKE_INSTALL_PREFIX@
${SETUPTOOLS_INSTALL_LAYOUT}
)