Description: Restore install commands.
Author: Bas Couwenberg <sebastic@debian.org>
Bug: https://github.com/ec-jrc/jeolib-jiplib/issues/12

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1015,3 +1015,53 @@ set_target_properties(jiplib PROPERTIES
 include(GNUInstallDirs)
 
 set_target_properties(jiplib_python PROPERTIES INSTALL_RPATH "$ORIGIN")
+
+INSTALL(TARGETS ${JIPLIB_LIB_NAME}
+  LIBRARY
+  DESTINATION ${CMAKE_INSTALL_LIBDIR}
+  COMPONENT libraries
+  PUBLIC_HEADER
+  DESTINATION include/${JIPLIB_LIB_NAME}
+  COMPONENT headers
+)
+
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/jiplib.pc
+        DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
+)
+
+if(BUILD_WITH_PYTHON)
+  SET(PYTHON_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/python)
+  SET(JIPLIB_INIT ${PYTHON_SOURCE_DIR}/__init__.py)
+
+  if(CREATE_WHEEL)
+    MESSAGE(STATUS "creating python wheel: ${CREATE_WHEEL}")
+    MESSAGE(STATUS "PROJECT_SOURCE_DIR: ${PROJECT_SOURCE_DIR}")
+    MESSAGE(STATUS "CMAKE_CURRENT_SOURCE_DIR: ${CMAKE_CURRENT_SOURCE_DIR}")
+    MESSAGE(STATUS "CMAKE_BINARY_DIR: ${CMAKE_BINARY_DIR}")
+    MESSAGE(STATUS "CMAKE_CURRENT_BINARY_DIR: ${CMAKE_CURRENT_BINARY_DIR}")
+    MESSAGE(STATUS "CMAKE_INSTALL_LIBDIR: ${CMAKE_INSTALL_LIBDIR}")
+    MESSAGE(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}")
+    SET(WHEEL_DIR ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME})
+
+    # add_custom_command(TARGET ${JIPLIB_LIB_NAME}
+    add_custom_command(TARGET jiplib_python
+      POST_BUILD
+      COMMAND mkdir -p ${WHEEL_DIR}
+      COMMAND cp ${JIPLIB_INIT} ${WHEEL_DIR}
+      COMMAND cp ${PYTHON_SOURCE_DIR}/setup.py ${CMAKE_CURRENT_BINARY_DIR}
+      COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/README.md ${WHEEL_DIR}
+      COMMAND cp ${CMAKE_BINARY_DIR}/_${JIPLIB_LIB_NAME}.so ${WHEEL_DIR}
+      COMMAND cp ${CMAKE_BINARY_DIR}/lib${JIPLIB_LIB_NAME}.so.${JIPLIB_VERSION_MAJOR} ${WHEEL_DIR}
+      COMMAND cp ${MIALLIB_LIBRARIES}.${MIALLIB_VERSION_MAJOR} ${WHEEL_DIR}
+      COMMAND cp ${CMAKE_BINARY_DIR}/${JIPLIB_LIB_NAME}.py ${WHEEL_DIR}
+      COMMAND cp ${PROJECT_SOURCE_DIR}/README.md ${WHEEL_DIR}
+      COMMAND ${Python_EXECUTABLE} -m pip wheel ${CMAKE_CURRENT_BINARY_DIR}
+      COMMAND rm -rf ${WHEEL_DIR}
+    )
+  endif(CREATE_WHEEL)
+endif(BUILD_WITH_PYTHON)
+
+INSTALL(CODE
+  "execute_process(COMMAND ${Python_EXECUTABLE} -m pip install ${_pip_args} ${CMAKE_CURRENT_BINARY_DIR}/jiplib-${JIPLIB_VERSION}-py3-none-any.whl --force-reinstall)"
+  COMPONENT wheels
+)
