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