papi: fix async support for socket transport
[vpp.git] / src / vpp-api / python / CMakeLists.txt
index 52215cc..789a722 100644 (file)
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-find_package(PythonInterp 2.7)
-find_package(PythonLibs 2.7)
+if (CMAKE_VERSION VERSION_LESS 3.12)
+  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)
   install(
@@ -21,11 +26,10 @@ if(PYTHONINTERP_FOUND)
       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