434a152
diff --git a/CMakeLists.txt b/CMakeLists.txt
434a152
index 2c0f705..588ad13 100644
434a152
--- a/CMakeLists.txt
434a152
+++ b/CMakeLists.txt
434a152
@@ -4,7 +4,7 @@ project(KApiDox NONE)
434a152
 set(KF_VERSION "5.100.0") # handled by release scripts
93925d9
 
c25d78e
 if(DO_BOOTSTRAP)
c25d78e
-    include(FindUnixCommands)
c25d78e
+    find_package(Python3 COMPONENTS Interpreter)
93925d9
 
c25d78e
     if(WIN32)
c25d78e
         # Needs native path and extra escaping of spaces
434a152
@@ -14,9 +14,28 @@ if(DO_BOOTSTRAP)
c25d78e
     endif()
93925d9
 
c25d78e
     add_custom_target(build ALL
c25d78e
-        COMMAND ${BASH} bootstrap-devenv.sh
c25d78e
+        COMMAND ${Python3_EXECUTABLE} setup.py build --build-base ${BINARY_DIR}
c25d78e
         WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
c25d78e
     )
c25d78e
+    # DESTDIR may be set at install time (eg: `make DESTDIR=/tmp/package install`)
c25d78e
+    # so we need to check for it when the install code is run and pass the appropriate
c25d78e
+    # argument to distutils.
c25d78e
+    #
c25d78e
+    # Note that if(\$ENV{DESTDIR}) always fails, regardless of the value of the DESTDIR
c25d78e
+    # environment variable, hence the STREQUAL test.
c25d78e
+    # See https://public.kitware.com/Bug/view.php?id=14737
c25d78e
+    install(CODE
c25d78e
+        "set(_root_arg)
c25d78e
+         if (NOT \$ENV{DESTDIR} STREQUAL \"\")
c25d78e
+             file(TO_NATIVE_PATH \$ENV{DESTDIR} DESTDIR)
c25d78e
+             set(_root_arg --root \"\${DESTDIR}\")
c25d78e
+         endif()
c25d78e
+        file(TO_NATIVE_PATH ${CMAKE_INSTALL_PREFIX} INSTALL_PREFIX)
c25d78e
+         execute_process(
c25d78e
+            COMMAND ${Python3_EXECUTABLE} setup.py install --prefix \"\${INSTALL_PREFIX}\" \${_root_arg}
c25d78e
+            WORKING_DIRECTORY \"${CMAKE_SOURCE_DIR}\"
c25d78e
+            )"
c25d78e
+        )
c25d78e
 endif()
93925d9
 
c25d78e
 # A dummy install part to fulfill needs of kdesrc-build and possible make installs