diff --git a/Applications/CLI/CMakeLists.txt b/Applications/CLI/CMakeLists.txt
index f6f11f0e3ab0dfb211e7da1f129709ab2771cc70..65de70dd2b034ef07f3e275de829fcbd3f21c5b5 100644
--- a/Applications/CLI/CMakeLists.txt
+++ b/Applications/CLI/CMakeLists.txt
@@ -36,3 +36,6 @@ cpack_add_component(ogs_cli
 	DESCRIPTION "The command line interface for OpenGeoSys."
 	GROUP Applications
 )
+
+include(packaging/InstallDependencies)
+InstallDependencies(ogs ogs_cli)
diff --git a/Applications/DataExplorer/DataExplorer.cmake b/Applications/DataExplorer/DataExplorer.cmake
index c5be9c20ffa82ed35caf4450ffee6b9ce72ba4ce..242238ccc6816926f4348cfc9785324f9cc3edb0 100644
--- a/Applications/DataExplorer/DataExplorer.cmake
+++ b/Applications/DataExplorer/DataExplorer.cmake
@@ -155,38 +155,5 @@ if(APPLE)
 	return()
 endif()
 
-if(MSVC)
-	set(OGS_GUI_EXE ${EXECUTABLE_OUTPUT_PATH}/Release/DataExplorer.exe)
-else()
-	set(OGS_GUI_EXE ${EXECUTABLE_OUTPUT_PATH}/DataExplorer)
-endif()
-
-include(GetPrerequisites)
-if(EXISTS ${OGS_GUI_EXE})
-	if(MSVC)
-		get_prerequisites(${OGS_GUI_EXE} OGS_GUI_DEPENDENCIES 1 1 "" "")
-	else()
-		get_prerequisites(${OGS_GUI_EXE} OGS_GUI_DEPENDENCIES 0 1 "/usr/local/lib;/;${VTK_DIR};/usr/lib64;" "")
-	endif()
-	message(STATUS "DataExplorer depends on:")
-	foreach(DEPENDENCY ${OGS_GUI_DEPENDENCIES})
-		if(NOT ${DEPENDENCY} STREQUAL "not") # Some bug on Linux?
-			gp_resolve_item("/" "${DEPENDENCY}" ${OGS_GUI_EXE} "/usr/local/lib;/;${VTK_DIR};/usr/lib64;" DEPENDENCY_PATH)
-			get_filename_component(RESOLVED_DEPENDENCY_PATH "${DEPENDENCY_PATH}" REALPATH)
-			string(TOLOWER ${DEPENDENCY} DEPENDENCY_LOWER)
-			if("${DEPENDENCY_LOWER}" MATCHES "tiff|blas|lapack|proj|jpeg|qt|gfortran|vtk|boost|png")
-				set(DEPENDENCY_PATHS ${DEPENDENCY_PATHS} ${RESOLVED_DEPENDENCY_PATH} ${DEPENDENCY_PATH})
-				message("    ${DEPENDENCY}")
-			endif()
-		endif()
-	endforeach()
-	install(FILES ${DEPENDENCY_PATHS} DESTINATION bin COMPONENT ogs_gui)
-	if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
-		install(PROGRAMS data-explorer.sh DESTINATION . COMPONENT ogs_gui)
-	endif()
-	add_custom_command(TARGET DataExplorer POST_BUILD COMMAND ;) # For caching: excetuting empty command
-else()
-	# Run CMake after DataExplorer was built to run GetPrerequisites on executable
-	add_custom_command(TARGET DataExplorer POST_BUILD COMMAND ${CMAKE_COMMAND}
-		ARGS ${CMAKE_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_BINARY_DIR} VERBATIM)
-endif()
+include(packaging/InstallDependencies)
+InstallDependencies(DataExplorer ogs_gui)
diff --git a/scripts/cmake/packaging/InstallDependencies.cmake b/scripts/cmake/packaging/InstallDependencies.cmake
new file mode 100644
index 0000000000000000000000000000000000000000..0fe46b364194185f34cee5a45c049df9b9c38aa5
--- /dev/null
+++ b/scripts/cmake/packaging/InstallDependencies.cmake
@@ -0,0 +1,31 @@
+macro(InstallDependencies TARGET INSTALL_COMPONENT)
+
+	if(MSVC)
+		set(TARGET_EXE ${EXECUTABLE_OUTPUT_PATH}/Release/${TARGET}.exe)
+		set(EXCLUDE_SYSTEM 0)
+	else()
+		set(TARGET_EXE ${EXECUTABLE_OUTPUT_PATH}/${TARGET})
+		set(EXCLUDE_SYSTEM 1)
+	endif()
+
+	if(EXISTS ${TARGET_EXE})
+		include(GetPrerequisites)
+		get_prerequisites(${TARGET_EXE} TARGET_DEPENDENCIES ${EXCLUDE_SYSTEM} 0 "" "")
+		message(STATUS "${TARGET_EXE} dependencies:")
+		foreach(DEPENDENCY ${TARGET_DEPENDENCIES})
+			gp_resolve_item("/" "${DEPENDENCY}" ${TARGET_EXE}
+				"/usr/local/lib;/;${VTK_DIR};/usr/lib64;" DEPENDENCY_PATH)
+			get_filename_component(RESOLVED_DEPENDENCY_PATH "${DEPENDENCY_PATH}" REALPATH)
+			string(TOLOWER ${DEPENDENCY} DEPENDENCY_LOWER)
+				set(DEPENDENCY_PATHS ${DEPENDENCY_PATHS} ${RESOLVED_DEPENDENCY_PATH})
+				message("    ${RESOLVED_DEPENDENCY_PATH}")
+		endforeach()
+		install(FILES ${DEPENDENCY_PATHS} DESTINATION bin COMPONENT ${INSTALL_COMPONENT})
+		add_custom_command(TARGET ${TARGET} POST_BUILD COMMAND ;)
+	else()
+		# Run CMake after target was built to run GetPrerequisites on executable
+		add_custom_command(TARGET ${TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND}
+			ARGS ${CMAKE_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_BINARY_DIR} VERBATIM)
+	endif()
+
+endmacro()