1diff --git a/CMakeLists.txt b/CMakeLists.txt
2index 40e996e..d3b7e6d 100644
3--- a/CMakeLists.txt
4+++ b/CMakeLists.txt
5@@ -185,10 +185,16 @@ else()
6 # add_definitions(-DDEBUG)
7 endif()
8
9+set( PLUGINS mod_example mod_welcome mod_logging mod_auth_simple mod_auth_sqlite mod_chat_history mod_chat_only mod_topic mod_no_guest_downloads )
10+
11 if (UNIX)
12 install( TARGETS uhub RUNTIME DESTINATION bin )
13- install( TARGETS mod_example mod_welcome mod_logging mod_auth_simple mod_auth_sqlite mod_chat_history mod_chat_only mod_topic mod_no_guest_downloads DESTINATION /usr/lib/uhub/ OPTIONAL )
14- install( FILES ${CMAKE_SOURCE_DIR}/doc/uhub.conf ${CMAKE_SOURCE_DIR}/doc/plugins.conf ${CMAKE_SOURCE_DIR}/doc/rules.txt ${CMAKE_SOURCE_DIR}/doc/motd.txt DESTINATION /etc/uhub OPTIONAL )
15+
16+ foreach( PLUGIN ${PLUGINS} )
17+ install( TARGETS ${PLUGIN} DESTINATION $ENV{${PLUGIN}} OPTIONAL )
18+ endforeach( PLUGIN )
19+
20+ install( FILES ${CMAKE_SOURCE_DIR}/doc/uhub.conf ${CMAKE_SOURCE_DIR}/doc/plugins.conf ${CMAKE_SOURCE_DIR}/doc/rules.txt ${CMAKE_SOURCE_DIR}/doc/motd.txt DESTINATION doc/ OPTIONAL )
21
22 if (SQLITE_SUPPORT)
23 install( TARGETS uhub-passwd RUNTIME DESTINATION bin )