File: setup_py_with_destdir.cmake

package info (click to toggle)
libkdtree%2B%2B 0.7.1%2Bgit20101123-5
  • links: PTS
  • area: main
  • in suites: bullseye
  • size: 812 kB
  • sloc: cpp: 2,064; sh: 623; python: 543; makefile: 113
file content (25 lines) | stat: -rw-r--r-- 845 bytes parent folder | download | duplicates (5)
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
# This is a ugly workaround to be able to pass DESTDIR as --root to setup.py.
# cmake expands any occurence of $ENV{foo} with the value of foo while runing
# cmake and not while running make afterwards.

SET(PYTHON_EXECUTABLE "" CACHE FORCE "Python executable")
SET(PREFIX ${CMAKE_INSTALL_PREFIX} CACHE FORCE "cmake install prefix")
SET(WDIR "" CACHE FORCE "working directory")
SET(SETUP_PY "" CACHE FORCE "setup.py path")
SET(EXTRA_ARGS $ENV{SETUP_PY_EXTRA_ARGS} CACHE FORCE "extra arguments for setup.py")

SET(INSTALL_ROOT $ENV{DESTDIR})
IF(INSTALL_ROOT)
  SET(INSTALL_ROOT_ARGS "--root=$ENV{DESTDIR}")
ELSE(INSTALL_ROOT)
  SET(INSTALL_ROOT_ARGS "")
ENDIF(INSTALL_ROOT)

EXECUTE_PROCESS(
  COMMAND ${PYTHON_EXECUTABLE}
    ${SETUP_PY}
    install
    --prefix=${PREFIX}
    ${INSTALL_ROOT_ARGS}
    ${EXTRA_ARGS}
  WORKING_DIRECTORY ${WDIR})