build: complete python3 support, no hardcode path

find_package(Python3) will not set variables that are later used, so set
those needed. Perhaps the python2 support, which is EOL, could be
dropped?

Use DESTDIR, instead of hardcoding the path. This allows system
packaging, or local installs, to work properly.

Type: make
Signed-off-by: Nick Brown <nickbroon@gmail.com>
Change-Id: I045516c61473c612ab70858cd9b58c4e2838b347
diff --git a/src/vpp-api/python/CMakeLists.txt b/src/vpp-api/python/CMakeLists.txt
index 6450fd9..789a722 100644
--- a/src/vpp-api/python/CMakeLists.txt
+++ b/src/vpp-api/python/CMakeLists.txt
@@ -15,6 +15,8 @@
   find_package(PythonInterp 2.7)
 else()
   find_package(Python3 COMPONENTS Interpreter)
+  set(PYTHONINTERP_FOUND ${Python3_Interpreter_FOUND})
+  set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE})
 endif()
 
 if(PYTHONINTERP_FOUND)
@@ -24,11 +26,10 @@
       WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
       COMMAND ${PYTHON_EXECUTABLE} ./setup.py
 	install
-	  --root /
+	  --root=\$ENV{DESTDIR}/
 	  --prefix=${CMAKE_INSTALL_PREFIX}
 	  --single-version-externally-managed
 	  bdist_egg
-	  --dist-dir=${CMAKE_INSTALL_PREFIX}
       OUTPUT_QUIET
     )"
     COMPONENT vpp-api-python