diff --git a/CMakeLists.txt b/CMakeLists.txt
index fc8251b..011f241 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -31,10 +31,23 @@ SET(VERSION_MINOR "3")
SET(VERSION_PATCH "0")
SET(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
SET(PKG_STRING "${PROJECT_NAME} ${VERSION}")
-SET(LIBDIR ${CMAKE_INSTALL_PREFIX}/lib/${PROJECT_NAME})
-SET(SHAREDIR ${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME})
-SET(LOCALEDIR ${CMAKE_INSTALL_PREFIX}/share/locale)
-SET(INCLUDEDIR ${CMAKE_INSTALL_PREFIX}/include/${PROJECT_NAME})
+
+IF(NOT DEFINED LIBDIR)
+ SET(LIBDIR ${CMAKE_INSTALL_PREFIX}/lib/${PROJECT_NAME})
+ENDIF(NOT DEFINED LIBDIR)
+
+IF(NOT DEFINED SHAREDIR)
+ SET(SHAREDIR ${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME})
+ENDIF(NOT DEFINED SHAREDIR)
+
+IF(NOT DEFINED LOCALEDIR)
+ SET(LOCALEDIR ${CMAKE_INSTALL_PREFIX}/share/locale)
+ENDIF(NOT DEFINED LOCALEDIR)
+
+IF(NOT DEFINED INCLUDEDIR)
+ SET(INCLUDEDIR ${CMAKE_INSTALL_PREFIX}/include/${PROJECT_NAME})
+ENDIF(NOT DEFINED INCLUDEDIR)
+
STRING(REPLACE "\";\"" "\ " PKG_STRING ${PKG_STRING})
OPTION(DISABLE_NCURSES "Disable Ncurses interface")
@@ -90,10 +103,8 @@ ADD_CUSTOM_TARGET(dist
SET(PACKAGE "${PROJECT_NAME}")
SET(prefix "${CMAKE_INSTALL_PREFIX}")
SET(exec_prefix "\${prefix}")
-SET(libdir "\${exec_prefix}/lib")
-SET(includedir "\${prefix}/include")
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/weechat.pc.in ${CMAKE_CURRENT_BINARY_DIR}/weechat.pc @ONLY)
-INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/weechat.pc DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig)
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/weechat.pc DESTINATION ${LIBDIR}/pkgconfig)
# packages
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Fast, light and extensible chat client")
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
index f0d9c2c..cb16d21 100644
--- a/doc/CMakeLists.txt
+++ b/doc/CMakeLists.txt
@@ -27,4 +27,4 @@ IF(NOT DISABLE_DOC)
ENDIF(NOT DISABLE_DOC)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/weechat-curses.1 DESTINATION share/man/man1)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/weechat-curses.1 DESTINATION ${SHAREDIR}/man/man1)
diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt
index d43d3e7..df087bd 100644
--- a/po/CMakeLists.txt
+++ b/po/CMakeLists.txt
@@ -69,7 +69,7 @@ IF(XGETTEXT_EXECUTABLE AND MSGMERGE_EXECUTABLE AND MSGFMT_EXECUTABLE)
COMMENT "Compiling locales (${polang})"
)
- INSTALL(FILES ${gmofile} DESTINATION share/locale/${polang}/LC_MESSAGES RENAME ${PROJECT_NAME}.mo)
+ INSTALL(FILES ${gmofile} DESTINATION ${LOCALEDIR}/${polang}/LC_MESSAGES RENAME ${PROJECT_NAME}.mo)
SET(GMO_FILES ${GMO_FILES} ${gmofile})
ENDFOREACH(pofile ${PO_FILES})
ADD_CUSTOM_TARGET(translations ALL DEPENDS ${GMO_FILES})
diff --git a/src/plugins/alias/CMakeLists.txt b/src/plugins/alias/CMakeLists.txt
index e863cf7..7d99bf1 100644
--- a/src/plugins/alias/CMakeLists.txt
+++ b/src/plugins/alias/CMakeLists.txt
@@ -11,7 +11,7 @@
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# along with this program. If not, see <http:/www.gnu.org/licenses/>.
#
ADD_LIBRARY(alias MODULE
@@ -21,4 +21,4 @@ SET_TARGET_PROPERTIES(alias PROPERTIES PREFIX "")
TARGET_LINK_LIBRARIES(alias)
-INSTALL(TARGETS alias LIBRARY DESTINATION lib/${PROJECT_NAME}/plugins)
+INSTALL(TARGETS alias LIBRARY DESTINATION ${LIBDIR}/${PROJECT_NAME}//plugins)
diff --git a/src/plugins/aspell/CMakeLists.txt b/src/plugins/aspell/CMakeLists.txt
index 1141ccd..e74fb69 100644
--- a/src/plugins/aspell/CMakeLists.txt
+++ b/src/plugins/aspell/CMakeLists.txt
@@ -11,7 +11,7 @@
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# along with this program. If not, see <http:/www.gnu.org/licenses/>.
#
ADD_LIBRARY(aspell MODULE
@@ -25,4 +25,4 @@ IF(ASPELL_FOUND)
TARGET_LINK_LIBRARIES(aspell ${ASPELL_LIBRARY})
ENDIF(ASPELL_FOUND)
-INSTALL(TARGETS aspell LIBRARY DESTINATION lib/${PROJECT_NAME}/plugins)
+INSTALL(TARGETS aspell LIBRARY DESTINATION ${LIBDIR}/${PROJECT_NAME}//plugins)
diff --git a/src/plugins/charset/CMakeLists.txt b/src/plugins/charset/CMakeLists.txt
index fdfd2e9..1b74129 100644
--- a/src/plugins/charset/CMakeLists.txt
+++ b/src/plugins/charset/CMakeLists.txt
@@ -11,7 +11,7 @@
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# along with this program. If not, see <http:/www.gnu.org/licenses/>.
#
ADD_LIBRARY(charset MODULE charset.c)
@@ -26,4 +26,4 @@ IF(ICONV_FOUND)
ENDIF(ICONV_LIBRARY)
ENDIF(ICONV_FOUND)
-INSTALL(TARGETS charset LIBRARY DESTINATION lib/${PROJECT_NAME}/plugins)
+INSTALL(TARGETS charset LIBRARY DESTINATION ${LIBDIR}/${PROJECT_NAME}//plugins)
diff --git a/src/plugins/demo/CMakeLists.txt b/src/plugins/demo/CMakeLists.txt
index 0e3a268..f016f03 100644
--- a/src/plugins/demo/CMakeLists.txt
+++ b/src/plugins/demo/CMakeLists.txt
@@ -11,7 +11,7 @@
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# along with this program. If not, see <http:/www.gnu.org/licenses/>.
#
ADD_LIBRARY(demo MODULE demo.c)
@@ -19,4 +19,4 @@ SET_TARGET_PROPERTIES(demo PROPERTIES PREFIX "")
TARGET_LINK_LIBRARIES(demo)
-INSTALL(TARGETS demo LIBRARY DESTINATION lib/${PROJECT_NAME}/plugins)
+INSTALL(TARGETS demo LIBRARY DESTINATION ${LIBDIR}/${PROJECT_NAME}//plugins)
diff --git a/src/plugins/fifo/CMakeLists.txt b/src/plugins/fifo/CMakeLists.txt
index 5f8e831..0b4f762 100644
--- a/src/plugins/fifo/CMakeLists.txt
+++ b/src/plugins/fifo/CMakeLists.txt
@@ -11,7 +11,7 @@
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# along with this program. If not, see <http:/www.gnu.org/licenses/>.
#
ADD_LIBRARY(fifo MODULE
@@ -21,4 +21,4 @@ SET_TARGET_PROPERTIES(fifo PROPERTIES PREFIX "")
TARGET_LINK_LIBRARIES(fifo)
-INSTALL(TARGETS fifo LIBRARY DESTINATION lib/${PROJECT_NAME}/plugins)
+INSTALL(TARGETS fifo LIBRARY DESTINATION ${LIBDIR}/${PROJECT_NAME}//plugins)
diff --git a/src/plugins/irc/CMakeLists.txt b/src/plugins/irc/CMakeLists.txt
index a56c5e8..bcb6450 100644
--- a/src/plugins/irc/CMakeLists.txt
+++ b/src/plugins/irc/CMakeLists.txt
@@ -11,7 +11,7 @@
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# along with this program. If not, see <http:/www.gnu.org/licenses/>.
#
ADD_LIBRARY(irc MODULE
@@ -46,4 +46,4 @@ ELSE(GNUTLS_FOUND)
TARGET_LINK_LIBRARIES(irc)
ENDIF(GNUTLS_FOUND)
-INSTALL(TARGETS irc LIBRARY DESTINATION lib/${PROJECT_NAME}/plugins)
+INSTALL(TARGETS irc LIBRARY DESTINATION ${LIBDIR}/${PROJECT_NAME}//plugins)
diff --git a/src/plugins/logger/CMakeLists.txt b/src/plugins/logger/CMakeLists.txt
index 16d3e80..56f52a5 100644
--- a/src/plugins/logger/CMakeLists.txt
+++ b/src/plugins/logger/CMakeLists.txt
@@ -11,7 +11,7 @@
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# along with this program. If not, see <http:/www.gnu.org/licenses/>.
#
ADD_LIBRARY(logger MODULE
@@ -24,4 +24,4 @@ SET_TARGET_PROPERTIES(logger PROPERTIES PREFIX "")
TARGET_LINK_LIBRARIES(logger)
-INSTALL(TARGETS logger LIBRARY DESTINATION lib/${PROJECT_NAME}/plugins)
+INSTALL(TARGETS logger LIBRARY DESTINATION ${LIBDIR}/${PROJECT_NAME}//plugins)
diff --git a/src/plugins/relay/CMakeLists.txt b/src/plugins/relay/CMakeLists.txt
index 6622239..c9b138b 100644
--- a/src/plugins/relay/CMakeLists.txt
+++ b/src/plugins/relay/CMakeLists.txt
@@ -11,7 +11,7 @@
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# along with this program. If not, see <http:/www.gnu.org/licenses/>.
#
ADD_LIBRARY(relay MODULE
@@ -27,4 +27,4 @@ SET_TARGET_PROPERTIES(relay PROPERTIES PREFIX "")
TARGET_LINK_LIBRARIES(relay)
-INSTALL(TARGETS relay LIBRARY DESTINATION lib/${PROJECT_NAME}/plugins)
+INSTALL(TARGETS relay LIBRARY DESTINATION ${LIBDIR}/${PROJECT_NAME}//plugins)
diff --git a/src/plugins/scripts/CMakeLists.txt b/src/plugins/scripts/CMakeLists.txt
index 36c2e25..3e3bb46 100644
--- a/src/plugins/scripts/CMakeLists.txt
+++ b/src/plugins/scripts/CMakeLists.txt
@@ -11,7 +11,7 @@
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# along with this program. If not, see <http:/www.gnu.org/licenses/>.
#
SET(LIB_SCRIPTS_SRC script.c script.h script-callback.c script-callback.h
diff --git a/src/plugins/scripts/lua/CMakeLists.txt b/src/plugins/scripts/lua/CMakeLists.txt
index cde09e6..f68eaad 100644
--- a/src/plugins/scripts/lua/CMakeLists.txt
+++ b/src/plugins/scripts/lua/CMakeLists.txt
@@ -28,4 +28,4 @@ IF(LUA_FOUND)
ENDIF(LUA_LIBRARY AND LUALIB_LIBRARY)
ENDIF(LUA_FOUND)
-INSTALL(TARGETS lua LIBRARY DESTINATION lib/${PROJECT_NAME}/plugins)
+INSTALL(TARGETS lua LIBRARY DESTINATION ${LIBDIR}/${PROJECT_NAME}/plugins)
diff --git a/src/plugins/scripts/perl/CMakeLists.txt b/src/plugins/scripts/perl/CMakeLists.txt
index 52950cf..196a8d1 100644
--- a/src/plugins/scripts/perl/CMakeLists.txt
+++ b/src/plugins/scripts/perl/CMakeLists.txt
@@ -35,4 +35,4 @@ IF(PERL_FOUND)
ENDIF(PERL_DYNALOADER)
ENDIF(PERL_FOUND)
-INSTALL(TARGETS perl LIBRARY DESTINATION lib/${PROJECT_NAME}/plugins)
+INSTALL(TARGETS perl LIBRARY DESTINATION ${LIBDIR}/${PROJECT_NAME}/plugins)
diff --git a/src/plugins/scripts/python/CMakeLists.txt b/src/plugins/scripts/python/CMakeLists.txt
index 8495c32..d682158 100644
--- a/src/plugins/scripts/python/CMakeLists.txt
+++ b/src/plugins/scripts/python/CMakeLists.txt
@@ -25,4 +25,4 @@ IF(PYTHON_FOUND)
TARGET_LINK_LIBRARIES(python ${PYTHON_LIBRARY} weechat_scripts)
ENDIF(PYTHON_FOUND)
-INSTALL(TARGETS python LIBRARY DESTINATION lib/weechat/plugins)
+INSTALL(TARGETS python LIBRARY DESTINATION ${LIBDIR}/${PROJECT_NAME}/plugins)
diff --git a/src/plugins/scripts/ruby/CMakeLists.txt b/src/plugins/scripts/ruby/CMakeLists.txt
index 452e479..f55dff8 100644
--- a/src/plugins/scripts/ruby/CMakeLists.txt
+++ b/src/plugins/scripts/ruby/CMakeLists.txt
@@ -24,4 +24,4 @@ IF(RUBY_FOUND)
TARGET_LINK_LIBRARIES(ruby ${RUBY_LIBRARY} weechat_scripts)
ENDIF(RUBY_FOUND)
-INSTALL(TARGETS ruby LIBRARY DESTINATION lib/${PROJECT_NAME}/plugins)
+INSTALL(TARGETS ruby LIBRARY DESTINATION ${LIBDIR}/${PROJECT_NAME}/plugins)
diff --git a/src/plugins/scripts/tcl/CMakeLists.txt b/src/plugins/scripts/tcl/CMakeLists.txt
index 58cbaa2..922e587 100644
--- a/src/plugins/scripts/tcl/CMakeLists.txt
+++ b/src/plugins/scripts/tcl/CMakeLists.txt
@@ -29,4 +29,4 @@ IF(TCL_FOUND)
ENDIF(TCL_FOUND)
-INSTALL(TARGETS tcl LIBRARY DESTINATION lib/weechat/plugins)
+INSTALL(TARGETS tcl LIBRARY DESTINATION ${LIBDIR}/${PROJECT_NAME}/plugins)
diff --git a/src/plugins/xfer/CMakeLists.txt b/src/plugins/xfer/CMakeLists.txt
index 4d8e8f5..39d08d0 100644
--- a/src/plugins/xfer/CMakeLists.txt
+++ b/src/plugins/xfer/CMakeLists.txt
@@ -11,7 +11,7 @@
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# along with this program. If not, see <http:/www.gnu.org/licenses/>.
#
ADD_LIBRARY(xfer MODULE
@@ -30,4 +30,4 @@ SET_TARGET_PROPERTIES(xfer PROPERTIES PREFIX "")
TARGET_LINK_LIBRARIES(xfer)
-INSTALL(TARGETS xfer LIBRARY DESTINATION lib/${PROJECT_NAME}/plugins)
+INSTALL(TARGETS xfer LIBRARY DESTINATION ${LIBDIR}/${PROJECT_NAME}//plugins)