From 673172e3ffb8e345b2bbfb6596ac3d79a1e17f14 Mon Sep 17 00:00:00 2001
From: Orcan Ogetbil <oget.fedora@gmail.com>
Date: Mon, 20 Dec 2010 04:54:36 +0000
Subject: Major cmake cleanup. Please see the ChangeLog.

---
 muse2/CMakeLists.txt                      |  77 ++++--
 muse2/ChangeLog                           |   5 +
 muse2/al/CMakeLists.txt                   |  81 ++++--
 muse2/awl/CMakeLists.txt                  | 192 ++++++-------
 muse2/cmake/QtWrapMacros.cmake            |  29 --
 muse2/config.h.in                         |  10 +-
 muse2/demos/CMakeLists.txt                |   6 +-
 muse2/grepmidi/CMakeLists.txt             |  20 +-
 muse2/muse/CMakeLists.txt                 | 430 ++++++++++++------------------
 muse2/muse/arranger/CMakeLists.txt        |  63 +++--
 muse2/muse/cliplist/CMakeLists.txt        |  48 +++-
 muse2/muse/ctrl/CMakeLists.txt            |  72 +++--
 muse2/muse/driver/CMakeLists.txt          |  52 +++-
 muse2/muse/instruments/CMakeLists.txt     |  65 +++--
 muse2/muse/liste/CMakeLists.txt           |  87 +++---
 muse2/muse/main.cpp                       |  30 +--
 muse2/muse/marker/CMakeLists.txt          | 111 ++++----
 muse2/muse/master/CMakeLists.txt          | 114 ++++----
 muse2/muse/midiedit/CMakeLists.txt        | 119 +++++----
 muse2/muse/mixer/CMakeLists.txt           |  74 ++++-
 muse2/muse/mplugins/CMakeLists.txt        | 105 +++++---
 muse2/muse/remote/CMakeLists.txt          |  61 ++++-
 muse2/muse/remote/pyapi.cpp               |   2 +-
 muse2/muse/song.cpp                       |   6 +-
 muse2/muse/waveedit/CMakeLists.txt        |  63 +++--
 muse2/muse/widgets/CMakeLists.txt         | 311 ++++++++++-----------
 muse2/packaging/CMakeLists.txt            |   9 +-
 muse2/plugins/doublechorus/CMakeLists.txt |  25 +-
 muse2/plugins/freeverb/CMakeLists.txt     |  27 +-
 muse2/plugins/pandelay/CMakeLists.txt     |  24 +-
 muse2/share/CMakeLists.txt                |  13 +-
 muse2/share/drummaps/CMakeLists.txt       |   6 +-
 muse2/share/html/CMakeLists.txt           |  16 +-
 muse2/share/instruments/CMakeLists.txt    |   6 +-
 muse2/share/locale/CMakeLists.txt         |   6 +-
 muse2/share/plugins/CMakeLists.txt        |  13 +-
 muse2/share/pybridge/CMakeLists.txt       |   6 +-
 muse2/share/scripts/CMakeLists.txt        |  17 +-
 muse2/share/templates/CMakeLists.txt      |  14 +-
 muse2/share/wallpapers/CMakeLists.txt     |   8 +-
 muse2/synti/CMakeLists.txt                |  12 +-
 muse2/synti/deicsonze/CMakeLists.txt      |  83 ++++--
 muse2/synti/deicsonze/deicsonze.cpp       |   9 +-
 muse2/synti/deicsonze/deicsonzegui.cpp    |   9 +-
 muse2/synti/fluid/CMakeLists.txt          |  65 +++--
 muse2/synti/fluidsynth/CMakeLists.txt     |  80 ++++--
 muse2/synti/libsynti/CMakeLists.txt       |  36 ++-
 muse2/synti/organ/CMakeLists.txt          |  53 +++-
 muse2/synti/s1/CMakeLists.txt             |  44 ++-
 muse2/synti/simpledrums2/CMakeLists.txt   |  65 +++--
 muse2/synti/vam/CMakeLists.txt            |  62 ++++-
 muse2/utils/CMakeLists.txt                |   7 +-
 52 files changed, 1746 insertions(+), 1202 deletions(-)
 delete mode 100644 muse2/cmake/QtWrapMacros.cmake

(limited to 'muse2')

diff --git a/muse2/CMakeLists.txt b/muse2/CMakeLists.txt
index 1cb3ee6a..0457bf26 100644
--- a/muse2/CMakeLists.txt
+++ b/muse2/CMakeLists.txt
@@ -30,11 +30,11 @@ endif(COMMAND cmake_policy)
 
 # set libdir if not use -DCMAKE_INSTALL_LIBDIR
 if (NOT CMAKE_INSTALL_LIBDIR)
-	SET(CMAKE_INSTALL_LIBDIR "lib")
+	SET(CMAKE_INSTALL_LIBDIR "${CMAKE_INSTALL_PREFIX}/lib")
 endif (NOT CMAKE_INSTALL_LIBDIR)
 
 IF(NOT DEFINED SHARE_INSTALL_PREFIX)
-        SET(SHARE_INSTALL_PREFIX share)
+        SET(SHARE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/share")
 ENDIF(NOT DEFINED SHARE_INSTALL_PREFIX)
 
 #set(CMAKE_BUILD_TYPE debug)
@@ -68,13 +68,37 @@ SET(MusE_VERSION       "2.0.1")
 SET(MusE_VERSION_FULL  "2.0.1")
 SET(MusE_INSTALL_NAME  "muse-2.0")
 
-SET(MUSE_MODULES_DIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/${MusE_INSTALL_NAME}/modules)
-SET(CMAKE_INSTALL_RPATH ${MUSE_MODULES_DIR})
+## The library where we will install the shared components:
+SET(MusE_MODULES_DIR ${CMAKE_INSTALL_LIBDIR}/${MusE_INSTALL_NAME}/modules)
+SET(CMAKE_INSTALL_RPATH ${MusE_MODULES_DIR})
 
-EXEC_PROGRAM( svnversion
-      ARGS ${PROJECT_SOURCE_DIR}
-      OUTPUT_VARIABLE MusE_SVNVER )
-      
+## Synthesizers directory
+SET(MusE_SYNTHI_DIR ${CMAKE_INSTALL_LIBDIR}/${MusE_INSTALL_NAME}/synthi)
+
+## Plugins directory
+SET(MusE_PLUGINS_DIR ${CMAKE_INSTALL_LIBDIR}/${MusE_INSTALL_NAME}/plugins)
+
+## Top documentation dir
+IF(NOT DEFINED MusE_DOC_DIR)
+      SET(MusE_DOC_DIR ${SHARE_INSTALL_PREFIX}/doc/${PROJECT_NAME}-${MusE_VERSION_FULL}/)
+ENDIF(NOT DEFINED MusE_DOC_DIR)
+
+## Data directory
+SET(MusE_SHARE_DIR ${SHARE_INSTALL_PREFIX}/${MusE_INSTALL_NAME})
+
+## Lib directory
+SET(MusE_LIB_DIR ${CMAKE_INSTALL_LIBDIR}/${MusE_INSTALL_NAME})
+
+FIND_PROGRAM(SVNVER svnversion)
+if (${SVNVER} STREQUAL "SVNVER-NOTFOUND")
+      SET (MusE_SVNVER 0)
+else (${SVNVER} STREQUAL "SVNVER-NOTFOUND")
+      EXEC_PROGRAM( svnversion
+            ARGS ${PROJECT_SOURCE_DIR}
+            OUTPUT_VARIABLE MusE_SVNVER )
+endif (${SVNVER} STREQUAL "SVNVER-NOTFOUND")
+
+# Do we need this? - Orcan:
 # include ( ${PROJECT_SOURCE_DIR}/cmake/WrapMacros.cmake)
 
 option ( ENABLE_LASH        "enable LASH Audio Session Handler"                              ON)
@@ -122,10 +146,6 @@ SET(QT_USE_QTUITOOLS TRUE)
 
 include(${QT_USE_FILE})
 
-# set (MUSE_QT_WRAP_CPP QT4_WRAP_CPP)
-# set (MUSE_QT_WRAP_UI QT4_WRAP_UI)
-include ( ${PROJECT_SOURCE_DIR}/cmake/QtWrapMacros.cmake)
-
 
 ##
 ## find doxygen
@@ -283,15 +303,6 @@ add_custom_command(
       WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
       )
 
-# uninstall custom target
-# CONFIGURE_FILE(
-#     "${CMAKE_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
-#     "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
-#     IMMEDIATE @ONLY)
-# 
-# ADD_CUSTOM_TARGET(uninstall
-#     "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
-
 include_directories(
    .
    ${PROJECT_SOURCE_DIR}
@@ -343,7 +354,25 @@ set(CMAKE_CXX_FLAGS_DEBUG   "-g -DQT_DEBUG ${CMAKE_CXX_FLAGS_DEBUG}")
 #subdirs(al lib grepmidi plugins muse share demos synti )
 subdirs(al awl grepmidi plugins muse share synti packaging utils demos)
 
-# Uninstall support
+## Install doc files
+file (GLOB doc_files
+      AUTHORS
+      ChangeLog
+      COPYING
+      NEWS
+      README
+      README.de
+      README.effects-rack
+      README.instruments
+      README.ladspaguis
+      README.shortcuts
+      README.softsynth
+      README.translate
+      SECURITY
+      )
+INSTALL( FILES ${doc_files} DESTINATION ${MusE_DOC_DIR})
+
+## Uninstall support
 configure_file(
   "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
   "${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake"
@@ -352,7 +381,7 @@ configure_file(
 add_custom_target(uninstall
   "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake")
 
-# Show a summary of what we got
+## Show a summary of what we got
 summary_add("Lash support" HAVE_LASH)
 summary_add("OSC (Liblo) support" OSC_SUPPORT)
 summary_add("DSSI support" DSSI_SUPPORT)
@@ -361,7 +390,7 @@ summary_add("Fluidsynth support" HAVE_FLUIDSYNTH)
 summary_add("Experimental features" ENABLE_EXPERIMENTAL)
 summary_show()
 
-# Make the user aware of what type they're building.
+## Make the user aware of what type they're building.
 if (NOT CMAKE_BUILD_TYPE)
     message(" Build type: CMAKE_BUILD_TYPE is empty. Plain un-optimized build.")
 else (NOT CMAKE_BUILD_TYPE)
diff --git a/muse2/ChangeLog b/muse2/ChangeLog
index d8df5204..2b608260 100644
--- a/muse2/ChangeLog
+++ b/muse2/ChangeLog
@@ -7,6 +7,11 @@
         - Individual parts are now built as shared libraries. (Orcan)
         - Moved main() and first degree relatives into main.cpp (Orcan)
         - Fixed bad link in README. Updated German README. (Orcan)
+        - Major clean-up in all CMakeLists.txt files. Hopefully, this will be the last time. 
+          Unified their notation. Added copyright notices to those which were missing. 
+        - Defined MusE_SHARE_DIR and MusE_LIB_DIR in config.h.in so that these directories 
+          can be accessed conveniently in the code. (Orcan)
+        - Install documentation files to the standard docdir specified by FHS. (Orcan)
 18.12.2010:
         - Fixed transport shortcuts not working in some windows or situations. (Tim)
           Added event->ignore to PartCanvas::keyPress. Added setFocusPolicy() to WaveView, Master.
diff --git a/muse2/al/CMakeLists.txt b/muse2/al/CMakeLists.txt
index 6e2881b8..a0031143 100644
--- a/muse2/al/CMakeLists.txt
+++ b/muse2/al/CMakeLists.txt
@@ -1,40 +1,79 @@
+#=============================================================================
+#  MusE
+#  Linux Music Editor
+#  $Id:$
 #
+#  Copyright (C) 2002-2006 by Werner Schweer and others
 #
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License version 2.
 #
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  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, write to the Free Software
+#  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#=============================================================================
 
 include(${PROJECT_SOURCE_DIR}/pch.txt)
 
-set (al_src
-   al.cpp sig.cpp xml.cpp dsp.cpp 
-   )
-
+##
+## List of source files to compile
+##
+file (GLOB al_source_files
+      al.cpp
+      dsp.cpp
+      sig.cpp
+      xml.cpp
+      )
 if (USE_SSE)
-      set(al_src ${al_src} dspSSE.cpp dspXMM.cpp)
+      file (GLOB al_source_files
+      ${al_source_files}
+      dspSSE.cpp
+      dspXMM.cpp
+      )
 endif (USE_SSE)
 
+##
+## Define target
+##
 add_library(al SHARED
-   ${al_src}
-   ${PROJECT_BINARY_DIR}/all.h.pch
-   )
-
-install(TARGETS al DESTINATION ${MUSE_MODULES_DIR})
-
-target_link_libraries ( al
-      ${QT_LIBRARIES}
+      ${PROJECT_BINARY_DIR}/all.h.pch
+      ${al_source_files}
       )
 
+##
+## Compilation flags and target name
+##
 set_target_properties( al
       PROPERTIES OUTPUT_NAME muse_al
       )
-
 set_source_files_properties(
-   al.cpp sig.cpp xml.cpp dsp.cpp 
-   dspXMM.cpp
-   PROPERTIES COMPILE_FLAGS "-fPIC -include ${PROJECT_BINARY_DIR}/all.h"
-   )
+      al.cpp
+      dsp.cpp 
+      dspXMM.cpp
+      sig.cpp
+      xml.cpp
+      PROPERTIES COMPILE_FLAGS "-fPIC -include ${PROJECT_BINARY_DIR}/all.h"
+      )
+set_source_files_properties(
+      dspSSE.cpp
+      PROPERTIES COMPILE_FLAGS "-x assembler"
+      )
 
-set_source_files_properties( dspSSE.cpp
-   PROPERTIES COMPILE_FLAGS "-x assembler"
-   )
+##
+## Linkage
+##
+target_link_libraries ( al
+      ${QT_LIBRARIES}
+      )
 
+##
+## Install location
+##
+install(TARGETS al 
+      DESTINATION ${MusE_MODULES_DIR}
+      )
diff --git a/muse2/awl/CMakeLists.txt b/muse2/awl/CMakeLists.txt
index c9b0cc28..e8599030 100644
--- a/muse2/awl/CMakeLists.txt
+++ b/muse2/awl/CMakeLists.txt
@@ -4,7 +4,7 @@
 #  $Id:$
 #
 #  Copyright (C) 2002-2006 by Werner Schweer and others
-#                                                                                                                                                                                                             
+#
 #  This program is free software; you can redistribute it and/or modify
 #  it under the terms of the GNU General Public License version 2.
 #
@@ -18,112 +18,112 @@
 #  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #=============================================================================
 
-include(${PROJECT_SOURCE_DIR}/pch.txt)
-
-MACRO(WRAP_CPP outfiles )
-   FOREACH(it ${ARGN})
-      SET(${outfiles} ${${outfiles}} ${it}.cpp)
-      ENDFOREACH(it)
-   ENDMACRO(WRAP_CPP)
-
-MACRO(WRAP_H outfiles )
-   FOREACH(it ${ARGN})
-      SET(${outfiles} ${${outfiles}} ${it}.h)
-      ENDFOREACH(it)
-   ENDMACRO(WRAP_H)
-
-set(mocs
-      aslider knob panknob slider volknob volslider floatentry
-      volentry panentry midivolentry midipanentry midipanknob
-      mslider midimslider midimeter combobox checkbox 
-      posedit
-      pitchedit 
-      # poslabel 
-      pitchlabel tempolabel 
-      sigedit 
-      # tcanvas
-      tempoedit drawbar
+##
+## Expand Qt macros in source files
+##
+QT4_WRAP_CPP (awl_mocs
+      aslider.h
+      # awlplugin.h
+      checkbox.h
+      combobox.h
+      drawbar.h
+      floatentry.h
+      knob.h
+      midimeter.h
+      midimslider.h
+      midipanentry.h
+      midipanknob.h
+      midivolentry.h
+      mslider.h
+      panentry.h
+      panknob.h
+      pitchedit.h
+      pitchlabel.h
+      posedit.h
+      # poslabel.h
+      sigedit.h
+      slider.h
+      # tcanvas.h
+      tempoedit.h
+      tempolabel.h
+      volentry.h
+      volknob.h
+      volslider.h
       )
 
-WRAP_H(mocH ${mocs})
-WRAP_CPP(mocCPP ${mocs})
-
-QT4_WRAP_CPP (moc_headers ${mocH})
+##
+## List of source files to compile
+##
+file (GLOB awl_source_files
+      aslider.cpp
+      awl.cpp
+      # awlplugin.cpp
+      checkbox.cpp
+      combobox.cpp
+      drawbar.cpp
+      floatentry.cpp
+      knob.cpp
+      # ltest.cpp
+      midimeter.cpp
+      midimslider.cpp
+      midipanentry.cpp
+      midipanknob.cpp
+      midivolentry.cpp
+      mslider.cpp
+      panentry.cpp
+      panknob.cpp
+      pitchedit.cpp
+      pitchlabel.cpp
+      posedit.cpp
+      # poslabel.cpp
+      sigedit.cpp
+      slider.cpp
+      # tcanvas.cpp
+      tempoedit.cpp
+      tempolabel.cpp
+      utils.cpp
+      volentry.cpp
+      volknob.cpp
+      volslider.cpp
+      )
 
-set(awl_src
-      awl.cpp utils.cpp  ${mocCPP} ${moc_headers}
+##
+## Define target
+##
+add_library ( awl SHARED
+      ${awl_source_files}
+      ${awl_mocs}
       )
 
-# TODO: Better filtering
-file (GLOB SOURCE_FILES *.cpp *.h )
-set (FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${SOURCE_FILES} CACHE INTERNAL "")
+##
+## Append to the list of translations
+##
+set (FILES_TO_TRANSLATE
+      ${FILES_TO_TRANSLATE}
+      ${SOURCE_FILES}
+      CACHE INTERNAL ""
+      )
 
-add_library (
-      awl
-      SHARED
-      ${awl_src}
-      ${PROJECT_BINARY_DIR}/all.h.pch
+##
+## Compilation flags and target name
+##
+set_target_properties( awl
+      PROPERTIES COMPILE_FLAGS "-fPIC -include ${PROJECT_BINARY_DIR}/all.h"
+      OUTPUT_NAME muse_awl
       )
 
+##
+## Linkage
+##
 target_link_libraries ( awl
       ${QT_LIBRARIES}
       al
       )
 
-set_target_properties( awl
-   PROPERTIES COMPILE_FLAGS "-fPIC -include ${PROJECT_BINARY_DIR}/all.h"
-              OUTPUT_NAME muse_awl
-   )
-
-install(TARGETS awl DESTINATION ${MUSE_MODULES_DIR})
+##
+## Install location
+##
+install(TARGETS awl
+      DESTINATION ${MusE_MODULES_DIR}
+      )
 
-# IF (APPLE)
-#    message("Not yet able to build awlplugin under OS X.")
-# ELSE (APPLE)
-# 
-#    #
-#    #  build libawlplugin.so
-#    #
-#    QT4_WRAP_CPP (moc_awlplugin_headers
-#       awlplugin.h
-#       volknob.h knob.h aslider.h
-#       slider.h volslider.h mslider.h
-#       posedit.h poslabel.h
-#       tempoedit.h tempolabel.h
-#       combobox.h checkbox.h
-#       panknob.h midipanknob.h
-#       floatentry.h
-#       drawbar.h
-#       )
-# 
-#    add_library ( awlplugin SHARED
-#        awlplugin.cpp
-#        volknob.cpp knob.cpp aslider.cpp
-#        slider.cpp volslider.cpp mslider.cpp
-#        posedit.cpp poslabel.cpp
-#        tempoedit.cpp tempolabel.cpp
-#        combobox.cpp checkbox.cpp
-#        panknob.cpp midipanknob.cpp
-#        floatentry.cpp
-#        drawbar.cpp
-#        ${moc_awlplugin_headers}
-#        ${PROJECT_BINARY_DIR}/all-pic.h.pch
-#        )
-# 
-#    set_target_properties( awlplugin
-#       PROPERTIES COMPILE_FLAGS
-#          "-D_GNU_SOURCE -D_REENTRANT -DHAVE_CONFIG_H -DQT_PLUGIN -DQT_SHARED -DQT_NO_DEBUG -include ${PROJECT_BINARY_DIR}/all-pic.h"
-#       )
-#    target_link_libraries( awlplugin
-#       al pthread asound
-#       )
-# 
-#    install( TARGETS awlplugin DESTINATION ${QT_PLUGINS_DIR}/designer/ )
-# 
-#    add_executable( ltest ltest.cpp )
-#    target_link_libraries ( ltest
-#       awlplugin
-#       ${QT_LIBRARIES}
-#       )
-# 
-# ENDIF (APPLE)
diff --git a/muse2/cmake/QtWrapMacros.cmake b/muse2/cmake/QtWrapMacros.cmake
deleted file mode 100644
index c2d1cbab..00000000
--- a/muse2/cmake/QtWrapMacros.cmake
+++ /dev/null
@@ -1,29 +0,0 @@
-  ## QT4_WRAP_UI3(outfiles inputfile ... )   
-  ##
-  ## Adapted from QT4_WRAP_UI in FindQt4.cmake module, for MusE, by Tim.
-  ##
-  ##
-  
-  MACRO (QT4_WRAP_UI3 outfiles )
-    QT4_EXTRACT_OPTIONS(ui_files ui_options ${ARGN})
-
-    FOREACH (it ${ui_files})
-      GET_FILENAME_COMPONENT(outfile ${it} NAME_WE)
-      GET_FILENAME_COMPONENT(infile ${it} ABSOLUTE)
-      # SET(outfile_h ${CMAKE_CURRENT_BINARY_DIR}/ui_${outfile}.h)
-      SET(outfile_h ${CMAKE_CURRENT_BINARY_DIR}/${outfile}.h)
-      SET(outfile_cpp ${CMAKE_CURRENT_BINARY_DIR}/ui_${outfile}.cpp)
-      ADD_CUSTOM_COMMAND(OUTPUT ${outfile_h} ${outfile_cpp}
-        COMMAND ${QT_UIC3_EXECUTABLE}
-        ARGS ${ui_options} -o ${outfile_h} ${infile}
-        COMMAND ${QT_UIC3_EXECUTABLE}
-        ARGS ${ui_options} -o ${outfile_cpp} -impl ${outfile_h} ${infile}
-        COMMAND ${QT_MOC_EXECUTABLE}
-        ARGS ${outfile_h} >> ${outfile_cpp}
-        MAIN_DEPENDENCY ${infile})
-      SET(${outfiles} ${${outfiles}} ${outfile_h} ${outfile_cpp})
-    ENDFOREACH (it)
-
-  ENDMACRO (QT4_WRAP_UI3)
-
- 
diff --git a/muse2/config.h.in b/muse2/config.h.in
index 6d3e678b..2fa3148c 100644
--- a/muse2/config.h.in
+++ b/muse2/config.h.in
@@ -23,13 +23,9 @@
 #cmakedefine DSSI_SUPPORT
 #cmakedefine VST_SUPPORT
 #cmakedefine USE_SSE
-#cmakedefine JACK103
-#cmakedefine JACK107
 
-#define INSTALL_NAME     "${MusE_INSTALL_NAME}"
-#define INSTPREFIX       "${CMAKE_INSTALL_PREFIX}"
-#define LIBINSTPREFIX    "${CMAKE_INSTALL_LIBDIR}"
-#define SHAREINSTPREFIX  "${SHARE_INSTALL_PREFIX}"
 #define VERSION          "${MusE_VERSION_FULL}"
 #define SVNVERSION       "${MusE_SVNVER}"
-#define PACKAGE_NAME      "MusE"
+#define PACKAGE_NAME     "MusE"
+#define SHAREDIR         "${MusE_SHARE_DIR}"
+#define LIBDIR           "${MusE_LIB_DIR}"
diff --git a/muse2/demos/CMakeLists.txt b/muse2/demos/CMakeLists.txt
index ae6318d9..c5d18766 100644
--- a/muse2/demos/CMakeLists.txt
+++ b/muse2/demos/CMakeLists.txt
@@ -18,5 +18,9 @@
 #  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #=============================================================================
 
-install_files ( /${SHARE_INSTALL_PREFIX}/${MusE_INSTALL_NAME}/demos .*\\.med )
+file (GLOB med_files *.med)
+
+install( FILES ${med_files}
+      DESTINATION ${MusE_SHARE_DIR}/demos
+      )
 
diff --git a/muse2/grepmidi/CMakeLists.txt b/muse2/grepmidi/CMakeLists.txt
index 55084217..ff607aca 100644
--- a/muse2/grepmidi/CMakeLists.txt
+++ b/muse2/grepmidi/CMakeLists.txt
@@ -18,7 +18,23 @@
 #  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #=============================================================================
 
-add_executable ( grepmidi grepmidi.cpp )
+##
+## List of source files to compile
+##
+file (GLOB grepmidi_source_files
+      grepmidi.cpp
+      )
 
-install_targets ( /bin grepmidi )
+##
+## Define target
+##
+add_executable ( grepmidi
+      ${grepmidi_source_files}
+      )
 
+##
+## Install location
+##
+install(TARGETS grepmidi 
+      DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
+      )
diff --git a/muse2/muse/CMakeLists.txt b/muse2/muse/CMakeLists.txt
index 9c8bbfb4..aa1d9d18 100644
--- a/muse2/muse/CMakeLists.txt
+++ b/muse2/muse/CMakeLists.txt
@@ -25,306 +25,212 @@ include_directories(
       )
 
 set (SubDirs 
-     widgets master midiedit mixer arranger 
-     liste driver waveedit ctrl cliplist 
-     instruments marker mplugins      
-    )
+      arranger 
+      cliplist 
+      ctrl
+      driver
+      instruments
+      liste
+      marker
+      master
+      midiedit
+      mixer
+      mplugins      
+      waveedit
+      widgets
+      )
 
 if (ENABLE_PYTHON)
-set ( PYREM_CPP_FLAGS "-DENABLE_PYTHON" )
-set ( PYLIBS ${PYTHON_LIB} remote) 
-set ( SubDirs ${SubDirs} remote )
+      set ( PYREM_CPP_FLAGS "-DENABLE_PYTHON" )
+      set ( PYLIBS ${PYTHON_LIB} remote) 
+      set ( SubDirs ${SubDirs} remote )
 endif (ENABLE_PYTHON)
 
 subdirs (${SubDirs})
 
-
+##
+## Expand Qt macros in source files
+##
 QT4_WRAP_CPP ( muse_moc_headers
-#       projectpropsdialog.h
-# 	projectdialog.h
-#       templatedialog.h
-#       preferences.h
-#       plugingui.h
-#       midiplugin.h
-#       muse.h
-#       song.h
-#       transport.h
-#       conf.h
-#       editor.h
-# 	cobject.h
-#       transpose.h
-#       track.h
-#       miditrackbase.h
-#       midisynti.h
-#       miditrack.h
-#       wavetrack.h
-#       audiotrack.h
-#       audiooutput.h
-#       audioinput.h
-#       audiogroup.h
-#       synth.h
-#       exportmidi.h
-#       importmidi.h
-#       midiinport.h
-#       midioutport.h
-#       astrip.h
-#       midirack.h
-#       mixer.h
-#       mstrip.h
-#       rack.h
-#       routedialog.h
-#       strip.h
-#       arranger.h
-#       canvas.h
-#       configtrack.h
-#       partdrag.h
-#       tllineedit.h
-#       tlswidget.h
-#       tlwidget.h
-#       trackdrag.h
-#       trackinfo.h
-      
-      plugin.h 
       app.h 
-      song.h 
-      transport.h 
+      appearance.h
+      cobject.h 
       conf.h 
       confmport.h 
       midieditor.h 
-      cobject.h 
-      value.h 
-      transpose.h 
       miditransform.h 
-      appearance.h
+      plugin.h 
+      song.h 
+      transport.h 
+      transpose.h 
+      value.h 
       )
 
+##
+## Resource files
+##
 QT4_ADD_RESOURCES (muse_qrc_files 
 		  muse.qrc
 		  )
 
-file (GLOB SOURCE_FILES
-#       ticksynth.cpp
-#       vst.cpp
-#       dssihost.cpp
-#       synth.cpp
-#       plugin.cpp
-#       ladspaplugin.cpp
-#       auxplugin.cpp
-#       pipeline.cpp
-# 	mtc.cpp
-#       thread.cpp
-#       audio.cpp
-# 	audioprefetch.cpp
-#       audiowriteback.cpp
-#       globals.cpp
-#       sync.cpp
-# 	part.cpp
-#       undo.cpp
-#       songfile.cpp
-#       midi.cpp
-#       importmidi.cpp
-#       importmidi.h
-#       midifile.cpp
-#       icons.cpp
-#       event.cpp
-#       eventlist.cpp
-#       midieventbase.cpp
-#       waveevent.cpp
-#       midievent.cpp
-# 	wave.cpp
-#       seqmsg.cpp
-# 	help.cpp
-# 	midictrl.cpp
-#       fifo.cpp
-#       helper.cpp
-#       route.cpp
-#       shortcuts.cpp
-#       ctrl.cpp
-#       gconfig.cpp
-#       midirc.cpp
-#       midififo.cpp
-#       midioutport.cpp
-#       midiinport.cpp
-#       midiout.cpp
-# 
-#       projectpropsdialog.cpp
-# 	projectdialog.cpp
-#       templatedialog.cpp
-#       preferences.cpp
-#       plugingui.cpp
-#       midiplugin.cpp
-#       muse.cpp
-#       song.cpp
-#       songpart.cpp
-#       songtrack.cpp
-#       transport.cpp
-#       conf.cpp
-#       editor.cpp
-# 	cobject.cpp
-#       transpose.cpp
-#       track.cpp
-#       miditrackbase.cpp
-#       midisynti.cpp
-#       miditrack.cpp
-#       wavetrack.cpp
-#       audiotrack.cpp
-#       audiooutput.cpp
-#       audioinput.cpp
-#       audiogroup.cpp
-#       exportmidi.cpp
-#       revision.cpp
-#       jack.cpp dummyaudio.cpp
-#       astrip.cpp
-#       midirack.cpp
-#       mixer.cpp
-#       mstrip.cpp
-#       rack.cpp
-#       routedialog.cpp
-#       strip.cpp
-# 
-#       arranger.cpp
-#       canvas.cpp
-#       configtrack.cpp
-#       partdrag.cpp
-#       tllineedit.cpp
-#       tlswidget.cpp
-#       tlwidget.cpp
-#       tlwlayout.cpp
-#       trackdrag.cpp
-#       trackinfo.cpp
-      
-      ticksynth.h ticksynth.cpp 
-      vst.h vst.cpp
-      dssihost.h dssihost.cpp 
-      osc.cpp osc.h 
-      stringparam.cpp stringparam.h 
-      synth.h synth.cpp  
-      plugin.cpp plugin.h 
-      mtc.cpp mtc.h 
-      thread.cpp thread.h 
-      audio.cpp audio.h 
-      audioprefetch.cpp audioprefetch.h 
-      audioconvert.cpp audioconvert.h 
-      globals.cpp globals.h 
-      sync.cpp sync.h 
-      midiport.cpp midiport.h 
-      part.cpp part.h 
-      tempo.cpp tempo.h 
-      pos.cpp pos.h 
-      sig.cpp sig.h 
-      key.cpp key.h 
-      undo.cpp undo.h 
-      songfile.cpp 
-      midi.cpp midi.h 
-      importmidi.cpp 
-      exportmidi.cpp 
-      midifile.h midifile.cpp 
-      xml.cpp xml.h 
-      event.cpp event.h eventbase.h evdata.h 
+file (GLOB core_source_files
+      app.cpp
+      appearance.cpp
+      audio.cpp
+      audioconvert.cpp
+      audioprefetch.cpp
+      audiotrack.cpp
+      cobject.cpp
+      conf.cpp
+      confmport.cpp
+      ctrl.cpp
+      dssihost.cpp 
+      event.cpp
       eventlist.cpp 
-      midievent.h midievent.cpp 
-      waveevent.h waveevent.cpp 
-      mpevent.cpp mpevent.h 
-      track.cpp track.h 
-      audiotrack.cpp wavetrack.cpp 
-      wave.cpp wave.h 
-      seqmsg.cpp 
-      device.h 
-      globaldefs.h 
-      ladspa.h 
-      app.cpp app.h 
-      song.cpp song.h 
-      transport.cpp transport.h 
-      conf.cpp conf.h 
-      confmport.cpp confmport.h 
+      exportmidi.cpp 
+      gconfig.cpp 
+      globals.cpp
       help.cpp 
-      midieditor.cpp midieditor.h 
-      cobject.cpp cobject.h 
-      value.cpp value.h 
-      midictrl.cpp midictrl.h 
-      transpose.cpp transpose.h 
-      miditransform.cpp miditransform.h 
-      appearance.cpp appearance.h 
-      node.cpp node.h 
-      midiseq.cpp midiseq.h 
-      helper.cpp helper.h 
-      debug.h memory.h memory.cpp 
-      mididev.h mididev.cpp 
-      route.h route.cpp
-      shortcuts.h shortcuts.cpp 
-      ctrl.cpp ctrl.h 
-      gconfig.h gconfig.cpp 
-      fastlog.h 
-      default_click.h
+      helper.cpp
+      importmidi.cpp 
+      key.cpp
+      memory.cpp 
+      midi.cpp
+      midictrl.cpp
+      mididev.cpp 
+      midieditor.cpp
+      midievent.cpp 
+      midifile.cpp 
+      midiport.cpp
+      midiseq.cpp
+      miditransform.cpp
+      mpevent.cpp
+      mtc.cpp
+      node.cpp
+      osc.cpp
+      part.cpp
+      plugin.cpp
+      pos.cpp
+      route.cpp
+      seqmsg.cpp 
+      shortcuts.cpp 
+      sig.cpp
+      song.cpp
+      songfile.cpp 
+      stringparam.cpp
+      sync.cpp
+      synth.cpp  
+      tempo.cpp
+      thread.cpp
+      ticksynth.cpp 
+      track.cpp
+      transport.cpp
+      transpose.cpp
+      undo.cpp
+      value.cpp
+      vst.cpp
+      wave.cpp
+      waveevent.cpp 
+      wavetrack.cpp 
+      xml.cpp
       )
-
-file (GLOB MAIN_SOURCE_FILES
+file (GLOB main_source_files
       main.cpp
       )
-
-file (GLOB ICONS_SOURCE_FILES
-      icons.cpp icons.h
-      )
-
-add_executable ( muse
-      ${MAIN_SOURCE_FILES}
+file (GLOB icons_source_files
+      icons.cpp
       )
 
+##
+## Define target
+##
 add_library ( core SHARED
       ${muse_qrc_files}
       ${muse_moc_headers}
-      # ${muse_ui_headers}
-      ${PROJECT_BINARY_DIR}/all.h.pch
-      ${SOURCE_FILES}
+      ${core_source_files}
+      )
+add_executable ( muse
+      ${main_source_files}
       )
-
 add_library ( icons SHARED
-      ${ICONS_SOURCE_FILES}
+      ${icons_source_files}
       )
 
-set (FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${MAIN_SOURCE_FILES} ${SOURCE_FILES} CACHE INTERNAL "")
-
-# AM_CXXFLAGS +=-DSVNVERSION=\"$(shell svnversion)\"
-# EXEC_PROGRAM( svnversion
-#      ARGS ${PROJECT_SOURCE_DIR}
-#      OUTPUT_VARIABLE SVNVER )
+set (FILES_TO_TRANSLATE
+      ${FILES_TO_TRANSLATE}
+      ${main_source_files}
+      ${core_source_files}
+      CACHE INTERNAL ""
+      )
 
-# add_definitions ( -DINSTLIBDIR=${LIBRARY_OUTPUT_DIRECTORY} )
-include_directories (midiedit arranger liste widgets mixer driver waveedit mplugins instruments remote)
+##
+## Directories that will be passed to the compiler with -I flag
+##
+include_directories (
+      arranger
+      driver
+      instruments
+      liste
+      midiedit
+      mixer
+      mplugins
+      remote
+      waveedit
+      widgets
+      )
 
 # Make sure to include the uic generated headers paths.
 include_directories(
-      ${CMAKE_CURRENT_BINARY_DIR}/midiedit ${CMAKE_CURRENT_BINARY_DIR}/arranger ${CMAKE_CURRENT_BINARY_DIR}/liste ${CMAKE_CURRENT_BINARY_DIR}/widgets 
-      ${CMAKE_CURRENT_BINARY_DIR}/mixer ${CMAKE_CURRENT_BINARY_DIR}/driver ${CMAKE_CURRENT_BINARY_DIR}/waveedit ${CMAKE_CURRENT_BINARY_DIR}/mplugins 
-      ${CMAKE_CURRENT_BINARY_DIR}/instruments ${CMAKE_CURRENT_BINARY_DIR}/remote
+      ${CMAKE_CURRENT_BINARY_DIR}/arranger
+      ${CMAKE_CURRENT_BINARY_DIR}/driver
+      ${CMAKE_CURRENT_BINARY_DIR}/instruments
+      ${CMAKE_CURRENT_BINARY_DIR}/liste
+      ${CMAKE_CURRENT_BINARY_DIR}/midiedit
+      ${CMAKE_CURRENT_BINARY_DIR}/mixer
+      ${CMAKE_CURRENT_BINARY_DIR}/mplugins 
+      ${CMAKE_CURRENT_BINARY_DIR}/remote
+      ${CMAKE_CURRENT_BINARY_DIR}/waveedit
+      ${CMAKE_CURRENT_BINARY_DIR}/widgets 
       )
 
+##
+## Compilation flags and target name
+##
 set_target_properties( core
       # PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h"
-      # PROPERTIES COMPILE_FLAGS "-Imidiedit -Iarranger -Iliste -Iwidgets -Imixer -Idriver -Iwaveedit -Implugins -Iinstruments -Iremote ${PYREM_CPP_FLAGS} -DSVNVERSION='\"${SVNVER}\"' -include ${PROJECT_BINARY_DIR}/all.h "
-      # PROPERTIES COMPILE_FLAGS "${PYREM_CPP_FLAGS} -DINSTPREFIX='\"${CMAKE_INSTALL_PREFIX}\"' -DINSTLIBDIR='\"${LIBRARY_OUTPUT_DIRECTORY}\"' -DSVNVERSION='\"${SVNVER}\"' -include ${PROJECT_BINARY_DIR}/all.h "
+      # PROPERTIES COMPILE_FLAGS "-Imidiedit -Iarranger -Iliste -Iwidgets -Imixer -Idriver -Iwaveedit -Implugins -Iinstruments -Iremote ${PYREM_CPP_FLAGS} -include ${PROJECT_BINARY_DIR}/all.h "
+      # PROPERTIES COMPILE_FLAGS "${PYREM_CPP_FLAGS} -DINSTPREFIX='\"${CMAKE_INSTALL_PREFIX}\"' -DINSTLIBDIR='\"${LIBRARY_OUTPUT_DIRECTORY}\"' -include ${PROJECT_BINARY_DIR}/all.h "
       PROPERTIES COMPILE_FLAGS "${PYREM_CPP_FLAGS} -include ${PROJECT_BINARY_DIR}/all.h -fPIC"
-                 OUTPUT_NAME muse_core
+      OUTPUT_NAME muse_core
       )
-
 set_target_properties( muse
       PROPERTIES OUTPUT_NAME muse2
       )
-
 set_target_properties( icons
       PROPERTIES OUTPUT_NAME muse_icons
       )
 
+##
+## Linkage
+##
 target_link_libraries(core
-      
-      midiedit ctrl 
-      liste mixer driver marker 
-      master waveedit mplugins arranger 
-      cliplist instruments widgets 
-      icons
-      synti       
       al      
+      arranger 
       awl
+      cliplist
+      ctrl
+      driver
+      icons
+      instruments
+      liste
+      marker
+      master
+      midiedit
+      mixer
+      mplugins
+      synti       
+      waveedit
+      widgets 
       
       ${QT_LIBRARIES}
       QtSvg
@@ -336,6 +242,14 @@ target_link_libraries(core
       dl
       )
 
+if(HAVE_LASH)
+      target_link_libraries(core ${LASH_LIBRARIES})
+endif(HAVE_LASH)
+
+if(OSC_SUPPORT)
+      target_link_libraries(core ${LIBLO_LIBRARIES})
+endif(OSC_SUPPORT)
+
 target_link_libraries(muse
       midiedit
       core
@@ -345,14 +259,14 @@ target_link_libraries(icons
       ${QT_LIBRARIES}
       )	
 
-if(HAVE_LASH)
-      target_link_libraries(core ${LASH_LIBRARIES})
-endif(HAVE_LASH)
-
-if(OSC_SUPPORT)
-      target_link_libraries(core ${LIBLO_LIBRARIES})
-endif(OSC_SUPPORT)
-
-install ( TARGETS muse RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin/ )
-install(TARGETS core icons DESTINATION ${MUSE_MODULES_DIR})
+##
+## Install location
+##
+install( TARGETS muse 
+      RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin/
+      )
+install(TARGETS core icons
+      DESTINATION
+      ${MusE_MODULES_DIR}
+      )
 
diff --git a/muse2/muse/arranger/CMakeLists.txt b/muse2/muse/arranger/CMakeLists.txt
index adc7ef61..bb425339 100644
--- a/muse2/muse/arranger/CMakeLists.txt
+++ b/muse2/muse/arranger/CMakeLists.txt
@@ -18,41 +18,66 @@
 #  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #=============================================================================
 
+#
+# Expand Qt macros
+#
 QT4_WRAP_CPP (arranger_mocs
+      alayout.h
       arranger.h 
       pcanvas.h 
       tlist.h 
-      alayout.h
       )
 
-file (GLOB SOURCE_FILES
-      arranger.cpp arranger.h 
-      pcanvas.cpp pcanvas.h 
-      tlist.cpp tlist.h 
-      alayout.cpp alayout.h 
-      trackinfo.cpp trackautomationview.h
+#
+# List of source files to compile
+#
+file (GLOB arranger_source_files
+      alayout.cpp
+      arranger.cpp
+      pcanvas.cpp
+      tlist.cpp
+      trackinfo.cpp
       )
 
+#
+# Define target
+#
 add_library ( arranger SHARED
-      ${SOURCE_FILES}
+      ${arranger_source_files}
       ${arranger_mocs}
-      # ${arranger_ui_headers}
       )
 
+#
+# Append to the list of translations
+#
+set (FILES_TO_TRANSLATE
+      ${FILES_TO_TRANSLATE}
+      ${arranger_source_files}
+      CACHE INTERNAL ""
+      )
+
+#
+# Compilation flags and target name
+#
+set_target_properties( arranger
+      PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -fPIC"
+      OUTPUT_NAME muse_arranger
+      )
+
+#
+# Linkage
+#
 target_link_libraries ( arranger
       ${QT_LIBRARIES}
       awl
+      mixer
       widgets
       )
 
-set (FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${SOURCE_FILES} CACHE INTERNAL "")
-
-install(TARGETS arranger DESTINATION ${MUSE_MODULES_DIR})
-
-add_dependencies(arranger mixer)
-
-set_target_properties( arranger
-  PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -fPIC"
-             OUTPUT_NAME muse_arranger
-  )
+#
+# Install location
+#
+install(TARGETS arranger
+      DESTINATION ${MusE_MODULES_DIR}
+      )
 
diff --git a/muse2/muse/cliplist/CMakeLists.txt b/muse2/muse/cliplist/CMakeLists.txt
index 52a5a791..33936c48 100644
--- a/muse2/muse/cliplist/CMakeLists.txt
+++ b/muse2/muse/cliplist/CMakeLists.txt
@@ -18,32 +18,58 @@
 #  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #=============================================================================
 
+##
+## Expand Qt macros in source files
+##
 QT4_WRAP_CPP (cliplist_mocs
-        cliplist.h
+      cliplist.h
       )
 
-file (GLOB SOURCE_FILES
+##
+## List of source files to compile
+##
+file (GLOB cliplist_source_files
       cliplist.cpp 
-      cliplist.h
       )
 
+##
+## Define target
+##
 add_library ( cliplist SHARED
-      ${SOURCE_FILES}
+      ${cliplist_source_files}
       ${cliplist_mocs}
-      # ${cliplist_ui_headers}
       )
 
-set (FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${SOURCE_FILES} CACHE INTERNAL "")
+##
+## Append to the list of translations
+##
+set (FILES_TO_TRANSLATE
+      ${FILES_TO_TRANSLATE}
+      ${cliplist_source_files}
+      CACHE INTERNAL ""
+      )
+
+##
+## Compilation flags and target name
+##
+set_target_properties( cliplist
+      PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -fPIC"
+      OUTPUT_NAME muse_cliplist
+      )
 
+##
+## Linkage
+##
 target_link_libraries ( cliplist
       ${QT_LIBRARIES}
       awl
       )
 
-install(TARGETS cliplist DESTINATION ${MUSE_MODULES_DIR})
+##
+## Install location
+##
+install(TARGETS cliplist
+      DESTINATION ${MusE_MODULES_DIR}
+      )
 
-set_target_properties( cliplist
-  PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -fPIC"
-             OUTPUT_NAME muse_cliplist
-  )
 
diff --git a/muse2/muse/ctrl/CMakeLists.txt b/muse2/muse/ctrl/CMakeLists.txt
index 24b8bb3e..731632f7 100644
--- a/muse2/muse/ctrl/CMakeLists.txt
+++ b/muse2/muse/ctrl/CMakeLists.txt
@@ -18,46 +18,68 @@
 #  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #=============================================================================
 
+##
+## Expand Qt macros in source files
+##
 QT4_WRAP_CPP (ctrl_mocs
-#       configmidictrl.h
-#       definemidictrl.h
-#       ctrldialog.h
-#       ctrledit.h
-        
-      ctrledit.h 
+      # configmidictrl.h
+      # ctrldialog.h
+      # definemidictrl.h
       ctrlcanvas.h 
+      ctrledit.h 
       ctrlpanel.h
       )
 
-file (GLOB SOURCE_FILES
-      ctrledit.cpp ctrledit.h 
-      ctrlcanvas.cpp ctrlcanvas.h 
-      ctrlpanel.cpp ctrlpanel.h
+##
+## List of source files to compile
+##
+file (GLOB ctrl_source_files
+      ctrlcanvas.cpp
+      ctrledit.cpp 
+      ctrlpanel.cpp
       )
 
+##
+## Define target
+##
 add_library ( ctrl SHARED
-#       configmidictrl.cpp
-#       definemidictrl.cpp
-#       ctrldialog.cpp
-#       ctrleditor.cpp
-#       ctrledit.cpp
-      
-      ${SOURCE_FILES}
+      # configmidictrl.cpp
+      # definemidictrl.cpp
+      # ctrldialog.cpp
+      # ctrleditor.cpp
+      ${ctrl_source_files}
       ${ctrl_mocs}
-      # ${ctrl_ui_headers}
       )
 
-set (FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${SOURCE_FILES} CACHE INTERNAL "")
+##
+## Append to the list of translations
+##
+set (FILES_TO_TRANSLATE
+      ${FILES_TO_TRANSLATE}
+      ${ctrl_source_files}
+      CACHE INTERNAL ""
+      )
 
+##
+## Compilation flags and target name
+##
+set_target_properties( ctrl
+      PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -fPIC"
+      OUTPUT_NAME muse_ctrl
+      )
+
+##
+## Linkage
+##
 target_link_libraries ( ctrl
       ${QT_LIBRARIES}
       widgets
       )
 
-install(TARGETS ctrl DESTINATION ${MUSE_MODULES_DIR})
-
-set_target_properties( ctrl
-  PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -fPIC"
-             OUTPUT_NAME muse_ctrl
-  )
+##
+## Install location
+##
+install(TARGETS ctrl
+      DESTINATION ${MusE_MODULES_DIR}
+      )
 
diff --git a/muse2/muse/driver/CMakeLists.txt b/muse2/muse/driver/CMakeLists.txt
index 0116fc1f..fbac3f0b 100644
--- a/muse2/muse/driver/CMakeLists.txt
+++ b/muse2/muse/driver/CMakeLists.txt
@@ -18,21 +18,46 @@
 #  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #=============================================================================
 
-file (GLOB SOURCE_FILES
-       audiodev.h alsamidi.cpp alsamidi.h jack.cpp jackaudio.h 
-       dummyaudio.cpp alsatimer.cpp alsatimer.h timerdev.h rtctimer.cpp rtctimer.h 
-       jackmidi.cpp jackmidi.h
+##
+## List of source files to compile
+##
+file (GLOB driver_source_files
+       alsamidi.cpp
+       alsatimer.cpp
+       dummyaudio.cpp
+       jack.cpp
+       jackmidi.cpp
+       rtctimer.cpp
        )
 
+##
+## Define target
+##
 add_library ( driver SHARED
        # ${PROJECT_BINARY_DIR}/all.h.pch
-       ${SOURCE_FILES}
+       ${driver_source_files}
        )
 
-set (FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${SOURCE_FILES} CACHE INTERNAL "")
+##
+## Append to the list of translations
+##
+set (FILES_TO_TRANSLATE
+      ${FILES_TO_TRANSLATE}
+      ${driver_source_files}
+      CACHE INTERNAL ""
+      )
 
-install(TARGETS driver DESTINATION ${MUSE_MODULES_DIR})
+##
+## Compilation flags and target name
+##
+set_target_properties( driver
+      PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -fPIC"
+      OUTPUT_NAME muse_driver
+      )
 
+##
+## Linkage
+##
 target_link_libraries ( driver
       ${ALSA_LIBRARIES}
       ${JACK_LIBRARIES}
@@ -40,10 +65,9 @@ target_link_libraries ( driver
       mplugins
       )
 
-
-
-set_target_properties( driver
-  PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -fPIC"
-             OUTPUT_NAME muse_driver
-  )
-
+##
+## Install location
+##
+install(TARGETS driver
+      DESTINATION ${MusE_MODULES_DIR}
+      )
diff --git a/muse2/muse/instruments/CMakeLists.txt b/muse2/muse/instruments/CMakeLists.txt
index 8930edf0..b068798a 100644
--- a/muse2/muse/instruments/CMakeLists.txt
+++ b/muse2/muse/instruments/CMakeLists.txt
@@ -18,45 +18,72 @@
 #  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #=============================================================================
 
+##
+## Expand Qt macros in source files
+##
 QT4_WRAP_CPP ( instruments_mocs
-   # minstrument.h editinstrument.h
    editinstrument.h
+   # minstrument.h
    )
 
-file (GLOB UI_FILES
+##
+## UI files
+##
+file (GLOB instruments_ui_files
+      # ccontrollerbase.ui # not built. It needs to be converted to Qt4 for revival.
       editinstrumentbase.ui
       )
+QT4_WRAP_UI ( instruments_uis ${instruments_ui_files} )
 
-QT4_WRAP_UI ( instruments_ui_headers
-      ${UI_FILES}
-      )
-
-# Note that ccontrollerbase.ui is not built. It needs to be converted to Qt4 for revival.
-
-file (GLOB SOURCE_FILES
-   minstrument.cpp
+##
+## List of source files to compile
+##
+file (GLOB instruments_source_files
    editinstrument.cpp
-   minstrument.h
    editinstrument.h
+   minstrument.cpp
+   minstrument.h
    )
 
+##
+## Define target
+##
 add_library ( instruments SHARED
-   ${SOURCE_FILES}
+   ${instruments_source_files}
    ${instruments_mocs}
-   ${instruments_ui_headers}
+   ${instruments_uis}
    )
 
-set (FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${SOURCE_FILES} ${UI_FILES} CACHE INTERNAL "")
+##
+## Append to the list of translations
+##
+set (FILES_TO_TRANSLATE
+      ${FILES_TO_TRANSLATE}
+      ${instruments_source_files}
+      ${instruments_ui_files}
+      CACHE INTERNAL ""
+      )
 
-install(TARGETS instruments DESTINATION ${MUSE_MODULES_DIR})
+##
+## Compilation flags and target name
+##
+set_target_properties( instruments
+      PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -fPIC"
+      OUTPUT_NAME muse_instruments
+      )
 
+##
+## Linkage
+##
 target_link_libraries ( instruments
       ${QT_LIBRARIES}
       icons
       )
 
-set_target_properties( instruments
-   PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -fPIC"
-              OUTPUT_NAME muse_instruments
-   )
+##
+## Install location
+##
+install(TARGETS instruments
+      DESTINATION ${MusE_MODULES_DIR}
+      )
 
diff --git a/muse2/muse/liste/CMakeLists.txt b/muse2/muse/liste/CMakeLists.txt
index 72081478..4c0b61a4 100644
--- a/muse2/muse/liste/CMakeLists.txt
+++ b/muse2/muse/liste/CMakeLists.txt
@@ -18,57 +18,80 @@
 #  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #=============================================================================
 
+##
+## Expand Qt macros in source files
+##
 QT4_WRAP_CPP ( liste_mocs
-#       listedit.h
-#       ctrllistedit.h
-#       tracklistedit.h
-#       partlistedit.h
-#       ieventdialog.h
-      
+      # listedit.h
+      # ctrllistedit.h
+      # tracklistedit.h
+      # partlistedit.h
+      # ieventdialog.h
+      editevent.h      
       listedit.h 
-      editevent.h
       )
 
-file (GLOB UI_FILES
+##
+## UI files
+##
+file (GLOB liste_ui_files
       editctrlbase.ui
       )
+QT4_WRAP_UI ( liste_uis ${liste_ui_files} )
 
-QT4_WRAP_UI ( UIC
-      ${UI_FILES}
-      )
-
-file (GLOB SOURCE_FILES
-#       listedit.cpp listedit.h
-#       ctrllistedit.cpp ctrllistedit.h
-#       partlistedit.cpp partlistedit.h
-#       tracklistedit.cpp tracklistedit.h
-#       ieventdialog.cpp ieventdialog.h
-      listedit.cpp listedit.h 
-      editevent.cpp editevent.h 
+##
+## List of source files to compile
+##
+file (GLOB liste_source_files
+      # listedit.cpp
+      # ctrllistedit.cpp
+      # partlistedit.cpp
+      # tracklistedit.cpp
+      # ieventdialog.cpp
+      editevent.cpp
+      listedit.cpp
       )
 
+##
+## Define target
+##
 add_library ( liste SHARED
-      ${SOURCE_FILES}
+      ${liste_source_files}
       ${liste_mocs}
-      ${liste_ui_headers}
-      ${UIC}
+      ${liste_uis}
       )
 
-set (FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${SOURCE_FILES} ${UI_FILES} CACHE INTERNAL "")
+##
+## Append to the list of translations
+##
+set (FILES_TO_TRANSLATE
+      ${FILES_TO_TRANSLATE}
+      ${liste_source_files}
+      ${liste_ui_files}
+      CACHE INTERNAL ""
+      )
 
-install(TARGETS liste DESTINATION ${MUSE_MODULES_DIR})
+##
+## Compilation flags and target name
+##
+set_target_properties( liste
+      PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -fPIC"
+      OUTPUT_NAME muse_liste
+      )
 
+##
+## Linkage
+##
 target_link_libraries ( liste
       ${QT_LIBRARIES}
       awl
       widgets
       )
 
-add_dependencies(liste widgets)
-
-set_target_properties( liste
-   PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -fPIC"
-              OUTPUT_NAME muse_liste
-   )
-
+##
+## Install location
+##
+install(TARGETS liste
+      DESTINATION ${MusE_MODULES_DIR}
+      )
 
diff --git a/muse2/muse/main.cpp b/muse2/muse/main.cpp
index a11b2e0b..76917aec 100644
--- a/muse2/muse/main.cpp
+++ b/muse2/muse/main.cpp
@@ -159,8 +159,7 @@ static QString localeList()
       {
       // Find out what translations are available:
       QStringList deliveredLocaleListFiltered;
-      QString distLocale = QString(INSTPREFIX) + "/" + SHAREINSTPREFIX + "/"
-                           + INSTALL_NAME + "/locale";
+      QString distLocale = QString(SHAREDIR) + "/locale";
       QFileInfo distLocaleFi(distLocale);
       if (distLocaleFi.isDir()) {
             QDir dir = QDir(distLocale);
@@ -243,26 +242,17 @@ int main(int argc, char* argv[])
             museGlobal = p;
 
       if (museGlobal.isEmpty()) {
-            //QString museGlobal(INSTPREFIX);
-            //QString museGlobalLibDir(INSTLIBDIR); 
-            //QString museGlobalLibDir(LIBINSTPREFIX); // This has no prefix.
-            //museGlobalLib   =  museGlobalLibDir + "/muse";
-            //museGlobalShare =  museGlobal + "/share/muse";
-            
-            // p4.0.7
-            museGlobalLib   =  QString(INSTPREFIX) + QString("/") +
-                               QString(LIBINSTPREFIX) + QString("/") + 
-                               QString(INSTALL_NAME);   
-            //museGlobalShare =  museGlobal + QString("/share/") + QString(INSTALL_NAME);   
-            museGlobalShare =  QString(INSTPREFIX) + QString("/") +                                             
-                               QString(SHAREINSTPREFIX) + QString("/") +  // This has no prefix. Default is "share", set in top cmake script.
-                               QString(INSTALL_NAME);   
+            museGlobalLib   = QString(LIBDIR);
+            museGlobalShare = QString(SHAREDIR);
             }
       else {
-            //museGlobalLib   = museGlobal + "/lib";
-            //museGlobalShare = museGlobal + "/share";
-            museGlobalLib   = museGlobal + QString("/") + QString(LIBINSTPREFIX);    // p4.0.7
-            museGlobalShare = museGlobal + QString("/") + QString(SHAREINSTPREFIX);
+            // Doesn't it make more sense to hardcode these dirs? 
+            // Well... They will be set properly anyways...
+            // Need to discuss this with Tim. - Orcan
+            museGlobalLib   = museGlobal + "/lib";
+            museGlobalShare = museGlobal + "/share";
+            //museGlobalLib   = museGlobal + QString("/") + QString(LIBINSTPREFIX);    // p4.0.7
+            //museGlobalShare = museGlobal + QString("/") + QString(SHAREINSTPREFIX);
             }
       museProject = museProjectInitPath; //getcwd(0, 0);
       configName  = QString(getenv("HOME")) + QString("/.MusE");
diff --git a/muse2/muse/marker/CMakeLists.txt b/muse2/muse/marker/CMakeLists.txt
index bc2b54ee..7ed5a40a 100644
--- a/muse2/muse/marker/CMakeLists.txt
+++ b/muse2/muse/marker/CMakeLists.txt
@@ -1,77 +1,76 @@
+#=============================================================================
+#  MusE
+#  Linux Music Editor
+#  $Id:$
 #
+#  Copyright (C) 2002-2006 by Werner Schweer and others
 #
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License version 2.
 #
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  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, write to the Free Software
+#  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#=============================================================================
 
-# MACRO(WRAP_CPP outfiles )
-#    FOREACH(it ${ARGN})
-#       SET(${outfiles} ${${outfiles}} ${it}.cpp)
-#       ENDFOREACH(it)
-#    ENDMACRO(WRAP_CPP)
-# 
-# MACRO(WRAP_H outfiles )
-#    FOREACH(it ${ARGN})
-#       SET(${outfiles} ${${outfiles}} ${it}.h)
-#       ENDFOREACH(it)
-#    ENDMACRO(WRAP_H)
-# 
-# MACRO(WRAP_UI outfiles )
-#    FOREACH(it ${ARGN})
-#       SET(${outfiles} ${${outfiles}} ${it}.ui)
-#       ENDFOREACH(it)
-#    ENDMACRO(WRAP_UI)
-# 
-# set(mocs
-#       markerview
-#       )
-# 
-# WRAP_H(mocH ${mocs})
-# WRAP_CPP(mocCPP ${mocs})
-# 
-# QT4_WRAP_CPP (moc_headers ${mocH})
-# 
-# set (uics
-#    )
-# 
-# WRAP_UI(uiUI ${uics})
-# QT4_WRAP_UI (ui_headers ${uiUI})
-# 
-# set ( marker_src ${mocCPP} ${moc_headers})
-# 
-# add_library ( marker STATIC ${marker_src})
-# set_target_properties( marker
-#    PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h"
-#    )
-
-
-
+##
+## Expand Qt macros in source files
+##
 QT4_WRAP_CPP ( marker_mocs
-        markerview.h
+      markerview.h
       )
 
-file (GLOB SOURCE_FILES
-        marker.cpp marker.h 
-        markerview.cpp # markerview.h
-        )
+##
+## List of source files to compile
+##
+file (GLOB marker_source_files
+      marker.cpp
+      markerview.cpp
+      )
 
+##
+## Define target
+##
 add_library ( marker SHARED
-        ${SOURCE_FILES}
-        # ${marker_ui_headers}
-        ${marker_mocs}
+      ${marker_source_files}
+      # ${marker_ui_headers}
+      ${marker_mocs}
       )
 
-set (FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${SOURCE_FILES} CACHE INTERNAL "")
+##
+## Append to the list of translations
+##
+set (FILES_TO_TRANSLATE
+      ${FILES_TO_TRANSLATE}
+      ${marker_source_files}
+      CACHE INTERNAL ""
+      )
 
-install(TARGETS marker DESTINATION ${MUSE_MODULES_DIR})
+##
+## Compilation flags and target name
+##
+set_target_properties( marker
+      PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -fPIC"
+      OUTPUT_NAME muse_marker
+      )
 
+##
+## Linkage
+##
 target_link_libraries ( marker
       ${QT_LIBRARIES}
       awl
       icons
       )
 
-set_target_properties( marker
-      PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -fPIC"
-                 OUTPUT_NAME muse_marker
+##
+## Install location
+##
+install(TARGETS marker
+      DESTINATION ${MusE_MODULES_DIR}
       )
-
diff --git a/muse2/muse/master/CMakeLists.txt b/muse2/muse/master/CMakeLists.txt
index 84977163..bf2cebb7 100644
--- a/muse2/muse/master/CMakeLists.txt
+++ b/muse2/muse/master/CMakeLists.txt
@@ -1,70 +1,71 @@
+#=============================================================================
+#  MusE
+#  Linux Music Editor
+#  $Id:$
 #
+#  Copyright (C) 2002-2006 by Werner Schweer and others
 #
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License version 2.
 #
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  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, write to the Free Software
+#  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#=============================================================================
 
-# MACRO(WRAP_CPP outfiles )
-#    FOREACH(it ${ARGN})
-#       SET(${outfiles} ${${outfiles}} ${it}.cpp)
-#       ENDFOREACH(it)
-#    ENDMACRO(WRAP_CPP)
-# 
-# MACRO(WRAP_H outfiles )
-#    FOREACH(it ${ARGN})
-#       SET(${outfiles} ${${outfiles}} ${it}.h)
-#       ENDFOREACH(it)
-#    ENDMACRO(WRAP_H)
-# 
-# MACRO(WRAP_UI outfiles )
-#    FOREACH(it ${ARGN})
-#       SET(${outfiles} ${${outfiles}} ${it}.ui)
-#       ENDFOREACH(it)
-#    ENDMACRO(WRAP_UI)
-# 
-# set( mocs master masteredit )
-# 
-# WRAP_H(mocH ${mocs})
-# WRAP_CPP(mocCPP ${mocs})
-# 
-# QT4_WRAP_CPP (moc_headers ${mocH})
-# 
-# set ( master_src ${mocCPP} ${moc_headers})
-# 
-# add_library ( master STATIC ${master_src})
-# set_target_properties( master
-#    PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h"
-#    )
-# 
-# 
-
-
-
-
+##
+## Expand Qt macros in source files
+##
 QT4_WRAP_CPP ( master_mocs
-        lmaster.h 
-        masteredit.h 
-        master.h 
-        tscale.h
+      lmaster.h 
+      masteredit.h 
+      master.h 
+      tscale.h
       )
 
-
-file (GLOB SOURCE_FILES
-        lmaster.cpp # lmaster.h 
-        masteredit.cpp # masteredit.h 
-        master.cpp # master.h 
-        tscale.cpp # tscale.h
+##
+## List of source files to compile
+##
+file (GLOB master_source_files
+        lmaster.cpp
+        masteredit.cpp
+        master.cpp
+        tscale.cpp
         )
 
+##
+## Define target
+##
 add_library ( master SHARED
-        ${SOURCE_FILES}
-        # ${master_ui_headers}
-        ${master_mocs}
+      ${master_source_files}
+      ${master_mocs}
       )
 
-set (FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${SOURCE_FILES} CACHE INTERNAL "")
+##
+## Append to the list of translations
+##
+set (FILES_TO_TRANSLATE
+      ${FILES_TO_TRANSLATE}
+      ${master_source_files}
+      CACHE INTERNAL ""
+      )
 
-install(TARGETS master DESTINATION ${MUSE_MODULES_DIR})
+##
+## Compilation flags and target name
+##
+set_target_properties( master
+      PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -fPIC"
+      OUTPUT_NAME muse_master
+      )
 
+##
+## Linkage
+##
 target_link_libraries ( master
       ${QT_LIBRARIES}
       al
@@ -72,8 +73,9 @@ target_link_libraries ( master
       widgets
       )
 
-set_target_properties( master
-      PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -fPIC"
-                 OUTPUT_NAME muse_master
+##
+## Install location
+##
+install(TARGETS master
+      DESTINATION ${MusE_MODULES_DIR}
       )
-
diff --git a/muse2/muse/midiedit/CMakeLists.txt b/muse2/muse/midiedit/CMakeLists.txt
index 1a77748a..d7bdd8ed 100644
--- a/muse2/muse/midiedit/CMakeLists.txt
+++ b/muse2/muse/midiedit/CMakeLists.txt
@@ -18,74 +18,76 @@
 #  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #=============================================================================
 
+##
+## Expand Qt macros in source files
+##
 QT4_WRAP_CPP ( midiedit_mocs
-#       midicmd.h
-#       gatetime.h
-#       velocity.h
-#       quantconfig.h
-#       dcanvas.h
-#       drumedit.h
-#       ecanvas.h
-#       midieditor.h
-#       pianoroll.h
-#       prcanvas.h
-#       miditracker.h
-#       trackpattern.h
-      
-      pianoroll.h 
+      # gatetime.h
+      # midicmd.h
+      # midieditor.h
+      # miditracker.h
+      # trackpattern.h
+      # velocity.h
+      dcanvas.h 
+      dlist.h 
+      drumedit.h 
+      ecanvas.h
       piano.h 
+      pianoroll.h 
       prcanvas.h 
       quantconfig.h 
-      drumedit.h 
-      dlist.h 
-      dcanvas.h 
-      ecanvas.h
       )
 
-file (GLOB SOURCE_FILES
-#      midicmd.h
-#      gatetime.h
-#       midicmd.cpp
-#       gatetime.cpp
-#       velocity.cpp
-#       quantconfig.cpp
-#       citem.h
-#       cmd.h
-#       drummap.h
-#       midicmd.h
-#       citem.cpp
-#       dcanvas.cpp
-#       drumedit.cpp
-#       drummap.cpp
-#       ecanvas.cpp
-#       midieditor.cpp
-#       pianoroll.cpp
-#       prcanvas.cpp
-#       miditracker.cpp
-#       trackpattern.cpp
-      
-      drummap.cpp drummap.h 
-      cmd.h 
-      pianoroll.cpp # pianoroll.h 
-      piano.cpp # piano.h 
-      prcanvas.cpp # prcanvas.h 
-      quantconfig.cpp # quantconfig.h 
-      drumedit.cpp # drumedit.h 
-      dlist.cpp # dlist.h 
-      dcanvas.cpp # dcanvas.h 
-      ecanvas.cpp # ecanvas.h
+##
+## List of source files to compile
+##
+file (GLOB midiedit_source_files
+      # citem.cpp
+      # gatetime.cpp
+      # midicmd.cpp
+      # midieditor.cpp
+      # miditracker.cpp
+      # trackpattern.cpp
+      # velocity.cpp
+      dcanvas.cpp
+      dlist.cpp
+      drumedit.cpp
+      drummap.cpp
+      ecanvas.cpp
+      piano.cpp
+      pianoroll.cpp
+      prcanvas.cpp
+      quantconfig.cpp
       )
 
+##
+## Define target
+##
 add_library ( midiedit SHARED
-      ${SOURCE_FILES}
-      # ${midiedit_ui_headers}
+      ${midiedit_source_files}
       ${midiedit_mocs}
       )
 
-set (FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${SOURCE_FILES} CACHE INTERNAL "")
+##
+## Append to the list of translations
+##
+set (FILES_TO_TRANSLATE
+      ${FILES_TO_TRANSLATE}
+      ${midiedit_source_files}
+      CACHE INTERNAL ""
+      )
 
-install(TARGETS midiedit DESTINATION ${MUSE_MODULES_DIR})
+##
+## Compilation flags and target name
+##
+set_target_properties( midiedit
+      PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -fPIC"
+      OUTPUT_NAME muse_midiedit
+      )
 
+##
+## Linkage
+##
 target_link_libraries ( midiedit
       ${QT_LIBRARIES}
       al
@@ -93,8 +95,9 @@ target_link_libraries ( midiedit
       widgets
       )
 
-set_target_properties( midiedit
-      PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -fPIC"
-                 OUTPUT_NAME muse_midiedit
+##
+## Install location
+##
+install(TARGETS midiedit
+      DESTINATION ${MusE_MODULES_DIR}
       )
-
diff --git a/muse2/muse/mixer/CMakeLists.txt b/muse2/muse/mixer/CMakeLists.txt
index 52e08248..62a4ed11 100644
--- a/muse2/muse/mixer/CMakeLists.txt
+++ b/muse2/muse/mixer/CMakeLists.txt
@@ -18,38 +18,84 @@
 #  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #=============================================================================
 
-QT4_WRAP_CPP ( mixer_mocs amixer.h strip.h astrip.h mstrip.h meter.h rack.h panknob.h auxknob.h routedialog.h )
+##
+## Expand Qt macros in source files
+##
+QT4_WRAP_CPP ( mixer_mocs
+      amixer.h
+      astrip.h
+      auxknob.h
+      meter.h
+      mstrip.h
+      panknob.h
+      rack.h
+      routedialog.h
+      strip.h
+      )
 
-file (GLOB UI_FILES routedialogbase.ui )
-QT4_WRAP_UI ( mixer_uis ${UI_FILES} )
+##
+## UI files
+##
+file (GLOB mixer_ui_files
+      routedialogbase.ui
+      )
+QT4_WRAP_UI ( mixer_uis ${mixer_ui_files} )
 
-file (GLOB SOURCE_FILES
+##
+## List of source files to compile
+##
+file (GLOB mixer_source_files
       amixer.cpp  
+      astrip.cpp
+      auxknob.cpp 
       meter.cpp 
-      rack.cpp 
+      mstrip.cpp
       panknob.cpp 
-      auxknob.cpp 
+      rack.cpp 
       routedialog.cpp 
-      strip.cpp astrip.cpp mstrip.cpp
+      strip.cpp
       )
 
+##
+## Define target
+##
 add_library ( mixer SHARED
-      ${SOURCE_FILES}
+      ${mixer_source_files}
       ${mixer_mocs}
       ${mixer_uis}
       )
 
-set (FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${SOURCE_FILES} ${UI_FILES} CACHE INTERNAL "")
+##
+## Append to the list of translations
+##
+set (FILES_TO_TRANSLATE
+      ${FILES_TO_TRANSLATE}
+      ${mixer_source_files}
+      ${mixer_ui_files}
+      CACHE INTERNAL ""
+      )
+
+##
+## Compilation flags and target name
+##
+set_target_properties ( mixer
+      PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -fPIC"
+      OUTPUT_NAME muse_mixer
+      )
 
+##
+## Linkage
+##
 target_link_libraries ( mixer
       ${QT_LIBRARIES}
       widgets
       )
 
-install(TARGETS mixer DESTINATION ${MUSE_MODULES_DIR})
+##
+## Install location
+##
+install(TARGETS mixer
+      DESTINATION ${MusE_MODULES_DIR}
+      )
 
-set_target_properties ( mixer
-   PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -fPIC"
-              OUTPUT_NAME muse_mixer
-   )
 
diff --git a/muse2/muse/mplugins/CMakeLists.txt b/muse2/muse/mplugins/CMakeLists.txt
index 3395ff0a..a6db14f6 100644
--- a/muse2/muse/mplugins/CMakeLists.txt
+++ b/muse2/muse/mplugins/CMakeLists.txt
@@ -18,27 +18,9 @@
 #  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #=============================================================================
 
-# subdirs(
-#         libmidiplugin
-#         splitlayer
-#         filter 
-#       metronom
-#       transform
-#       trigg 
-#       dump
-#       drumglue
-#  )
-# 
-# set ( CMAKE_CXX_FLAGS 
-#       "${CMAKE_CXX_FLAGS} -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SHARED -fPIC"
-#       )
-# 
-# set ( CMAKE_LDD_FLAGS -module -avoid-version )
-
-
-file (GLOB UI_FILES midifilter.ui mrconfigbase.ui )
-QT4_WRAP_UI ( mplugins_uis ${UI_FILES} )
-
+##
+## Expand Qt macros in source files
+##
 if ( ENABLE_EXPERIMENTAL )
       QT4_WRAP_UI ( mplugins_experimental_uis rhythmbase.ui)
       set ( experimental_hdrs rhythm.h )
@@ -47,46 +29,81 @@ if ( ENABLE_EXPERIMENTAL )
             ${mplugins_experimental_uis}
             )
 endif ( ENABLE_EXPERIMENTAL )
+QT4_WRAP_CPP ( mplugins_mocs
+      midifilterimpl.h
+      midiitransform.h
+      mittranspose.h
+      mrconfig.h
+      ${experimental_hdrs}
+      )
 
-QT4_WRAP_CPP ( mplugins_mocs  mittranspose.h midiitransform.h midifilterimpl.h mrconfig.h ${experimental_hdrs} )
+##
+## UI files
+##
+file (GLOB mplugins_ui_files
+      midifilter.ui
+      mrconfigbase.ui
+      )
+QT4_WRAP_UI ( mplugins_uis ${mplugins_ui_files} )
 
-file (GLOB SOURCE_FILES
-      mitplugin.cpp mitplugin.h 
-      mittranspose.cpp 
-      midiitransform.cpp 
+##
+## List of source files to compile
+##
+file (GLOB mplugins_source_files
       midifilterimpl.cpp 
+      midiitransform.cpp 
+      mitplugin.cpp
+      mittranspose.cpp 
       mrconfig.cpp 
-      random.cpp random.h 
+      random.cpp
       )
 
+##
+## Define target
+##
 add_library ( mplugins SHARED
-      ${SOURCE_FILES}
+      ${mplugins_source_files}
       ${mplugins_mocs}
       ${mplugins_uis}
       ${experimental_srcs}
       )
 
-set (FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${SOURCE_FILES} ${UI_FILES} CACHE INTERNAL "")
-
-install(TARGETS mplugins DESTINATION ${MUSE_MODULES_DIR})
-
-add_dependencies(mplugins widgets)
-
-target_link_libraries( mplugins
-   # midiplugin
-   ${QT_LIBRARIES}
-   widgets
-   )
+##
+## Append to the list of translations
+##
+set (FILES_TO_TRANSLATE
+      ${FILES_TO_TRANSLATE}
+      ${mplugins_source_files}
+      ${mplugins_ui_files}
+      CACHE INTERNAL ""
+      )
 
+##
+## Compilation flags and target name
+##
 # - tell cmake to name target transform.so instead of 
 #   libtransform.so
 # - use precompiled header files
 #
 set_target_properties ( mplugins
-   # PROPERTIES PREFIX ""
-   PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -fPIC"
-              OUTPUT_NAME muse_mplugins
-   )
+      # PROPERTIES PREFIX ""
+      PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -fPIC"
+      OUTPUT_NAME muse_mplugins
+      )
 
-# install_targets ( /${CMAKE_INSTALL_LIBDIR}/${MusE_INSTALL_NAME}/midiplugins/ transform )
+##
+## Linkage
+##
+target_link_libraries( mplugins
+      # midiplugin
+      ${QT_LIBRARIES}
+      widgets
+      )
+
+##
+## Install location
+##
+install(TARGETS mplugins
+      DESTINATION ${MusE_MODULES_DIR}
+      )
 
diff --git a/muse2/muse/remote/CMakeLists.txt b/muse2/muse/remote/CMakeLists.txt
index 01605975..87ad9672 100644
--- a/muse2/muse/remote/CMakeLists.txt
+++ b/muse2/muse/remote/CMakeLists.txt
@@ -1,25 +1,58 @@
+#=============================================================================
+#  MusE
+#  Linux Music Editor
+#  $Id:$
 #
+#  Copyright (C) 2002-2006 by Werner Schweer and others
 #
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License version 2.
 #
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  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, write to the Free Software
+#  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#=============================================================================
 
-include(${PROJECT_SOURCE_DIR}/pch.txt)
-
-file (GLOB remote_src
-   pyapi.cpp
-   )
+##
+## List of source files to compile
+##
+file (GLOB remote_source_files
+      pyapi.cpp
+      )
 
+##
+## Define target
+##
 add_library(remote SHARED
-   ${remote_src}
-   ${PROJECT_BINARY_DIR}/all.h.pch
-   )
-
-set (FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${remote_src} CACHE INTERNAL "")
+      ${remote_source_files}
+      ${PROJECT_BINARY_DIR}/all.h.pch
+      )
 
-install(TARGETS remote DESTINATION ${MUSE_MODULES_DIR})
+##
+## Append to the list of translations
+##
+set (FILES_TO_TRANSLATE
+      ${FILES_TO_TRANSLATE}
+      ${remote_source_files}
+      CACHE INTERNAL ""
+      )
 
+##
+## Compilation flags and target name
+##
 set_source_files_properties(
-   pyapi.cpp
-   PROPERTIES COMPILE_FLAGS "-fPIC -include ${PROJECT_BINARY_DIR}/all.h -include ${PYTHON_INCLUDES} -DENABLE_PYTHON"
-   )
+      pyapi.cpp
+      PROPERTIES COMPILE_FLAGS "-fPIC -include ${PROJECT_BINARY_DIR}/all.h -include ${PYTHON_INCLUDES} -DENABLE_PYTHON"
+      )
 
+##
+## Install location
+##
+install(TARGETS remote
+      DESTINATION ${MusE_MODULES_DIR}
+      )
diff --git a/muse2/muse/remote/pyapi.cpp b/muse2/muse/remote/pyapi.cpp
index ee64226a..84543b18 100644
--- a/muse2/muse/remote/pyapi.cpp
+++ b/muse2/muse/remote/pyapi.cpp
@@ -980,7 +980,7 @@ static void* pyapithreadfunc(void*)
 
       PyObject *pMainModule     = PyImport_AddModule( "__main__" );
       PyObject *pMainDictionary = PyModule_GetDict( pMainModule );
-      string launcherfilename = string(INSTPREFIX) + string("/share/muse/pybridge/museplauncher.py");
+      string launcherfilename = string(SHAREDIR) + string("/pybridge/museplauncher.py");
       printf("Initiating MusE Pybridge launcher from %s\n", launcherfilename.c_str());
       FILE* fp = fopen(launcherfilename.c_str(),"r");
       PyRun_File(fp, launcherfilename.c_str(), Py_file_input, pMainDictionary, pMainDictionary);
diff --git a/muse2/muse/song.cpp b/muse2/muse/song.cpp
index 22506d3a..329cdd97 100644
--- a/muse2/muse/song.cpp
+++ b/muse2/muse/song.cpp
@@ -3725,8 +3725,7 @@ void Song::populateScriptMenu(QMenu* menuPlugins, QObject* receiver)
       //
       // List scripts
       // 
-      QString distScripts = QString(INSTPREFIX) + "/" + SHAREINSTPREFIX + "/" 
-                            + INSTALL_NAME + "/scripts";
+      QString distScripts = QString(SHAREDIR) + "/scripts";
       QString home = "";
       if (getenv("HOME") != NULL)
             home = QString(getenv("HOME"));
@@ -3783,8 +3782,7 @@ void Song::populateScriptMenu(QMenu* menuPlugins, QObject* receiver)
 QString Song::getScriptPath(int id, bool isdelivered)
 {
       if (isdelivered) {
-            QString path = QString(INSTPREFIX) + "/" + SHAREINSTPREFIX + "/" + INSTALL_NAME 
-                           + "/scripts/" + deliveredScriptNames[id];
+            QString path = QString(SHAREDIR) + "/scripts/" + deliveredScriptNames[id];
             return path;
             }
 
diff --git a/muse2/muse/waveedit/CMakeLists.txt b/muse2/muse/waveedit/CMakeLists.txt
index cdd148ff..24696887 100644
--- a/muse2/muse/waveedit/CMakeLists.txt
+++ b/muse2/muse/waveedit/CMakeLists.txt
@@ -18,43 +18,70 @@
 #  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #=============================================================================
 
+##
+## Expand Qt macros in source files
+##
 QT4_WRAP_CPP ( waveedit_mocs
+      editgain.h
       waveedit.h
       waveview.h
-      editgain.h
       )
 
-file (GLOB UI_FILES
+##
+## UI files
+##
+file (GLOB waveedit_ui_files
       editgainbase.ui
       )
+QT4_WRAP_UI (waveedit_ui_headers ${waveedit_ui_files} )
 
-QT4_WRAP_UI (waveedit_ui_headers
-      ${UI_FILES}
-      )
-
-file (GLOB SOURCE_FILES
+##
+## List of source files to compile
+##
+file (GLOB waveedit_source_files
+      editgain.cpp
       waveedit.cpp
       waveview.cpp
-      editgain.cpp
       )
 
+##
+## Define target
+##
 add_library ( waveedit SHARED
-      ${SOURCE_FILES}
+      ${waveedit_source_files}
       ${waveedit_ui_headers}
       ${waveedit_mocs}
       )
 
-set (FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${SOURCE_FILES} ${UI_FILES} CACHE INTERNAL "")
+##
+## Append to the list of translations
+##
+set (FILES_TO_TRANSLATE
+      ${FILES_TO_TRANSLATE}
+      ${waveedit_source_files}
+      ${waveedit_ui_files}
+      CACHE INTERNAL ""
+      )
 
-install(TARGETS waveedit DESTINATION ${MUSE_MODULES_DIR})
+##
+## Compilation flags and target name
+##
+set_target_properties( waveedit
+      PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -fPIC"
+      OUTPUT_NAME muse_waveedit
+      )
 
+##
+## Linkage
+##
 target_link_libraries( waveedit
-   ${QT_LIBRARIES}
-   widgets
-   )
-
+      ${QT_LIBRARIES}
+      widgets
+      )
 
-set_target_properties( waveedit
-      PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -fPIC"
-                 OUTPUT_NAME muse_waveedit
+##
+## Install location
+##
+install(TARGETS waveedit
+      DESTINATION ${MusE_MODULES_DIR}
       )
diff --git a/muse2/muse/widgets/CMakeLists.txt b/muse2/muse/widgets/CMakeLists.txt
index 989fea4a..e27650ef 100644
--- a/muse2/muse/widgets/CMakeLists.txt
+++ b/muse2/muse/widgets/CMakeLists.txt
@@ -18,120 +18,69 @@
 #  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #=============================================================================
 
-include(${PROJECT_SOURCE_DIR}/pch.txt)
-
-# FIXME: Can't build shared widgets library while using QT3 support for the widgets code. 
-# QT3's QWidgetPlugin no longer supported in QT4. Our code would have to be native QT4...
-# Rules seem OK but get compile errors.
-
-# IF (APPLE)
-#    message("Not yet able to build musewidgetsplugin under OS X.")
-# ELSE (APPLE)
-# 
-#    #
-#    #  build libmusewidgetsplugin.so
-#    #
-#    QT4_WRAP_CPP (moc_widgetsplugin_headers
-#       posedit.h poslabel.h   sigedit.h     pitchedit.h pitchlabel.h tempolabel.h 
-#       slider.h  sliderbase.h doublelabel.h dentry.h    checkbox.h   combobox.h
-#       )
-# 
-#    add_library ( musewidgetsplugin SHARED
-#        sclif.cpp  scldiv.cpp mmath.cpp scldraw.cpp  dimap.cpp drange.cpp 
-#        
-#        posedit.cpp poslabel.cpp sigedit.cpp pitchedit.cpp pitchlabel.cpp tempolabel.cpp 
-#        slider.cpp sliderbase.cpp doublelabel.cpp dentry.cpp checkbox.cpp combobox.cpp
-#       
-#        musewidgetsplug.cpp 
-#        sigedit.h 
-#        ${PROJECT_SOURCE_DIR}/muse/xml.cpp ${PROJECT_SOURCE_DIR}/muse/tempo.cpp 
-#        ${PROJECT_SOURCE_DIR}/muse/sig.cpp ${PROJECT_SOURCE_DIR}/muse/pos.cpp
-#        
-#        ${moc_widgetsplugin_headers}
-#        ${PROJECT_BINARY_DIR}/all-pic.h.pch
-#        )
-# 
-#    set_target_properties( musewidgetsplugin
-#       PROPERTIES COMPILE_FLAGS
-#          "-D_GNU_SOURCE -D_REENTRANT -DHAVE_CONFIG_H -DQT_PLUGIN -DQT_SHARED -DQT_NO_DEBUG -include ${PROJECT_BINARY_DIR}/all-pic.h"
-#       )
-#    target_link_libraries( musewidgetsplugin
-#       # TODO: what do we need here?
-#       al pthread asound
-#       )
-# 
-#    # install( TARGETS awlplugin DESTINATION ${QT_PLUGINS_DIR}/designer/ )
-#    # install_targets ( /${CMAKE_INSTALL_LIBDIR}/${MusE_INSTALL_NAME}/plugins/ musewidgetsplugin )
-#    install( TARGETS musewidgetsplugin DESTINATION ${CMAKE_INSTALL_LIBDIR}/${MusE_INSTALL_NAME}/plugins/ )
-#    
-# # 
-# #    add_executable( ltest ltest.cpp )
-# #    target_link_libraries ( ltest
-# #       musewidgetsplugin
-# #       ${QT_LIBRARIES}
-# #       )
-# # 
-#
-# ENDIF (APPLE)
- 
-
+##
+## Expand Qt macros in source files
+##
 QT4_WRAP_CPP (widget_mocs
-      scrollscale.h  
-      view.h  
-      nentry.h  
-      mtscale.h  
-      sigscale.h  
-      hitscale.h  
-      intlabel.h  
-      doublelabel.h  
+      aboutbox_impl.h 
+      action.h
+      bigtime.h  
       canvas.h  
-      noteinfo.h  
-      dentry.h  
-      siglabel.h  
-      # ttoolbar.h  
-      ttoolbutton.h  
-      tb1.h  
-      lcombo.h  
-      swidget.h  
-      tempolabel.h  
-      tools.h  
-      popupmenu.h  
-      ctrlcombo.h  
-      sliderbase.h  
-      slider.h  
-      midisyncimpl.h  
-      header.h  
-      knob.h  
-      mlabel.h  
-      genset.h  
-      mixdowndialog.h  
-      spinboxFP.h  
-      spinbox.h  
+      checkbox.h  
       comboQuant.h  
-      bigtime.h  
+      combobox.h  
       comment.h  
-      splitter.h  
+      ctrlcombo.h  
+      dentry.h  
+      didyouknow.h
+      doublelabel.h  
+      filedialog.h  
       gatetime.h  
-      velocity.h  
+      genset.h  
+      header.h  
+      hitscale.h  
+      intlabel.h  
+      knob.h  
+      lcombo.h  
       metronome.h  
-      # posedit.h  
+      midisyncimpl.h  
+      mixdowndialog.h  
+      mlabel.h  
+      mtscale.h  
+      nentry.h  
+      noteinfo.h  
       pitchedit.h  
       pitchlabel.h  
+      popupmenu.h  
+      # posedit.h  
       poslabel.h  
-      filedialog.h  
-      # sigedit.h  
-      shortcutconfig.h  
+      scrollscale.h  
       shortcutcapturedialog.h  
-      combobox.h  
-      aboutbox_impl.h 
-      checkbox.h  
-      vscale.h  
-      action.h
+      shortcutconfig.h  
+      # sigedit.h  
+      siglabel.h  
+      sigscale.h  
+      slider.h  
+      sliderbase.h  
       songinfo.h
-      didyouknow.h
+      spinbox.h  
+      spinboxFP.h  
+      splitter.h  
+      swidget.h  
+      tb1.h  
+      tempolabel.h  
+      tools.h  
+      # ttoolbar.h  
+      ttoolbutton.h  
+      velocity.h  
+      view.h  
+      vscale.h  
       )
 
-file (GLOB UI_FILES
+##
+## UI files
+##
+file (GLOB widgets_ui_files
       aboutbox.ui  
       appearancebase.ui 
       cliplisteditorbase.ui  
@@ -157,107 +106,117 @@ file (GLOB UI_FILES
       transposebase.ui  
       velocitybase.ui  
       )
+QT4_WRAP_UI (widget_ui_headers ${widgets_ui_files})
 
-QT4_WRAP_UI (widget_ui_headers ${UI_FILES})      
-
-# add_custom_command(OUTPUT ui_midisync.h
-#      COMMAND ${QT_UIC_EXECUTABLE}
-#      ARGS -o ${CMAKE_CURRENT_BINARY_DIR}/ui_midisync.h ${CMAKE_CURRENT_SOURCE_DIR}/midisync.ui
-#      DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/midisync.ui
-#      )
-
-# ADD_FILE_DEPENDENCIES(moc_midisync.cxx ${CMAKE_CURRENT_BINARY_DIR}/ui_midisync.h)
-
-file (GLOB SOURCE_FILES
-      utils.cpp 
+##
+## List of source files to compile
+##
+file (GLOB widgets_source_files
+      aboutbox_impl.cpp 
+      bigtime.cpp 
+      canvas.cpp 
+      checkbox.cpp 
       citem.cpp
-      vscale.cpp
+      comboQuant.cpp 
+      combobox.cpp  
+      comment.cpp 
+      ctrlcombo.cpp 
+      dentry.cpp 
+      dimap.cpp
+      doublelabel.cpp 
       drange.cpp
-      sclif.cpp
-      dimap.cpp dimap.h  
-      scldiv.cpp scldiv.h  
-      mmath.cpp mmath.h  
-      scldraw.cpp scldraw.h  
-      action.h  
-      scrollscale.cpp  
-      view.cpp    
-      nentry.cpp 
-      mtscale.cpp 
-      sigscale.cpp 
+      filedialog.cpp 
+      gatetime.cpp 
+      genset.cpp 
+      header.cpp 
       hitscale.cpp 
       intlabel.cpp 
-      doublelabel.cpp 
-      canvas.cpp 
-      noteinfo.cpp 
-      dentry.cpp 
-      siglabel.cpp 
-      ttoolbar.cpp 
-      ttoolbutton.cpp 
-      tb1.cpp   
+      knob.cpp 
       lcombo.cpp 
-      swidget.cpp 
-      tempolabel.cpp 
-      tools.cpp 
-      ctrlcombo.cpp 
-      sliderbase.cpp 
-      slider.cpp 
+      metronome.cpp 
       midisyncimpl.cpp 
-      header.cpp 
-      knob.cpp 
-      mlabel.cpp 
-      genset.cpp 
       mixdowndialog.cpp 
-      spinboxFP.cpp 
-      spinbox.cpp 
-      comboQuant.cpp 
-      bigtime.cpp 
-      comment.cpp 
-      splitter.cpp  
-      gatetime.cpp 
-      velocity.cpp 
-      metronome.cpp 
-      # posedit.cpp 
-      section.h 
+      mlabel.cpp 
+      mmath.cpp
+      mtscale.cpp 
+      nentry.cpp 
+      noteinfo.cpp 
       pitchedit.cpp 
       pitchlabel.cpp 
+      popupmenu.cpp 
+      # posedit.cpp 
       poslabel.cpp 
-      filedialog.cpp 
-      # sigedit.cpp 
-      shortcutconfig.cpp 
+      scldiv.cpp
+      scldraw.cpp
+      sclif.cpp
+      scrollscale.cpp  
       shortcutcapturedialog.cpp 
-      combobox.cpp  
-      checkbox.cpp 
-      aboutbox_impl.cpp 
-      popupmenu.cpp 
-      menutitleitem.h  
+      shortcutconfig.cpp 
+      # sigedit.cpp 
+      siglabel.cpp 
+      sigscale.cpp 
+      slider.cpp 
+      sliderbase.cpp 
+      spinbox.cpp 
+      spinboxFP.cpp 
+      splitter.cpp  
+      swidget.cpp 
+      tb1.cpp   
+      tempolabel.cpp 
+      tools.cpp 
+      ttoolbar.cpp 
+      ttoolbutton.cpp 
+      utils.cpp 
+      velocity.cpp 
+      view.cpp    
+      vscale.cpp
       )
 
+##
+## Define target
+##
 add_library ( widgets SHARED 
       ${widget_ui_headers}
       ${widget_mocs}
-      ${SOURCE_FILES}
+      ${widgets_source_files}
+      )
+
+##
+## Append to the list of translations
+##
+set (FILES_TO_TRANSLATE
+      ${FILES_TO_TRANSLATE}
+      ${widgets_source_files}
+      ${widgets_ui_files}
+      CACHE INTERNAL ""
       )
 
+##
+## Compilation flags and target name
+##
+set_target_properties( widgets
+      # PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h ${MUSECXXFLAGS} -I../ -I${PROJECT_SOURCE_DIR}/synti "
+      PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h ${MUSECXXFLAGS} -I../ -I${PROJECT_SOURCE_DIR}/synti -fPIC"
+      OUTPUT_NAME muse_widgets
+      )
+
+##
+## Linkage
+##
 target_link_libraries ( widgets
       ${QT_LIBRARIES}
       icons
       )
 
-set (FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${SOURCE_FILES} ${UI_FILES} CACHE INTERNAL "")
-
-install(TARGETS widgets DESTINATION ${MUSE_MODULES_DIR})
-
+##
+## Install location
+##
+install(TARGETS widgets
+      DESTINATION
+      ${MusE_MODULES_DIR}
+      )
 
-# AM_CXXFLAGS +=-DSVNVERSION=\"$(shell svnversion)\"
-# EXEC_PROGRAM( svnversion
-#      ARGS ${PROJECT_SOURCE_DIR}
-#      OUTPUT_VARIABLE SVNVER )
 
-set_target_properties( widgets
-   # PROPERTIES COMPILE_FLAGS "-DSVNVERSION='\"${SVNVER}\"' -include ${PROJECT_BINARY_DIR}/all.h ${MUSECXXFLAGS} -I../ -I${PROJECT_SOURCE_DIR}/synti "
-   PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h ${MUSECXXFLAGS} -I../ -I${PROJECT_SOURCE_DIR}/synti -fPIC"
-              OUTPUT_NAME muse_widgets
-   )
 
 
 
diff --git a/muse2/packaging/CMakeLists.txt b/muse2/packaging/CMakeLists.txt
index e49b38ce..e9b749b2 100644
--- a/muse2/packaging/CMakeLists.txt
+++ b/muse2/packaging/CMakeLists.txt
@@ -18,5 +18,10 @@
 #  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #=============================================================================
 
-install_files ( /${SHARE_INSTALL_PREFIX}/icons/hicolor/64x64/apps/ muse_icon.png)
-install_files ( /${SHARE_INSTALL_PREFIX}/applications/ muse.desktop)
+install( FILES muse_icon.png
+      DESTINATION ${SHARE_INSTALL_PREFIX}/icons/hicolor/64x64/apps/
+      )
+install( FILES muse.desktop
+      DESTINATION ${SHARE_INSTALL_PREFIX}/applications/
+      )
+
diff --git a/muse2/plugins/doublechorus/CMakeLists.txt b/muse2/plugins/doublechorus/CMakeLists.txt
index 35d2c42b..04ea864f 100644
--- a/muse2/plugins/doublechorus/CMakeLists.txt
+++ b/muse2/plugins/doublechorus/CMakeLists.txt
@@ -18,10 +18,26 @@
 #  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #=============================================================================
 
+##
+## List of source files to compile
+##
+file (GLOB doublechorus_source_files
+      doublechorus.cpp
+      doublechorusmodel.cpp
+      simplechorusmodel.cpp
+      )
+
+##
+## Define target
+##
 add_library ( doublechorus SHARED
-      doublechorus.cpp doublechorusmodel.cpp simplechorusmodel.cpp
+      ${doublechorus_source_files}
       )
 
+
+##
+## Compilation flags and target name
+##
 # tell cmake to name the target doublechorus.so instead of
 # libdoublechorus.so
 #
@@ -30,4 +46,9 @@ set_target_properties (doublechorus
       #COMPILE_FLAGS "-O3"
       )
 
-install_targets ( /${CMAKE_INSTALL_LIBDIR}/${MusE_INSTALL_NAME}/plugins doublechorus)
+##
+## Install location
+##
+install( TARGETS doublechorus
+      DESTINATION ${MusE_PLUGINS_DIR}
+      )
diff --git a/muse2/plugins/freeverb/CMakeLists.txt b/muse2/plugins/freeverb/CMakeLists.txt
index 9083099c..da43dc98 100644
--- a/muse2/plugins/freeverb/CMakeLists.txt
+++ b/muse2/plugins/freeverb/CMakeLists.txt
@@ -18,10 +18,24 @@
 #  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #=============================================================================
 
+##
+## List of source files to compile
+##
+file (GLOB freeverb_source_files
+      freeverb.cpp
+      revmodel.cpp
+      )
+
+##
+## Define target
+##
 add_library ( freeverb SHARED
-      freeverb.cpp revmodel.cpp
+      ${freeverb_source_files}
       )
 
+##
+## Compilation flags and target name
+##
 # tell cmake to name the target freeverb.so instead of
 # libfreeverb.so
 #
@@ -30,4 +44,13 @@ set_target_properties (freeverb
       COMPILE_FLAGS "-O2"
       )
 
-install_targets ( /${CMAKE_INSTALL_LIBDIR}/${MusE_INSTALL_NAME}/plugins freeverb)
+##
+## Install location
+##
+install( TARGETS freeverb
+      DESTINATION ${MusE_PLUGINS_DIR}
+      )
+install( FILES readme.txt
+      DESTINATION ${MusE_DOC_DIR}/freeverb
+      )
+
diff --git a/muse2/plugins/pandelay/CMakeLists.txt b/muse2/plugins/pandelay/CMakeLists.txt
index 6e48a9ea..02900cb3 100644
--- a/muse2/plugins/pandelay/CMakeLists.txt
+++ b/muse2/plugins/pandelay/CMakeLists.txt
@@ -18,10 +18,25 @@
 #  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #=============================================================================
 
+##
+## List of source files to compile
+##
+file (GLOB pandelay_source_files
+      ladspapandelay.cpp
+      pandelay.cpp
+      pandelaymodel.cpp
+      )
+
+##
+## Define target
+##
 add_library ( pandelay SHARED
-      pandelay.cpp ladspapandelay.cpp pandelaymodel.cpp
+      ${pandelay_source_files}
       )
 
+##
+## Compilation flags and target name
+##
 # tell cmake to name the target pandelay.so instead of
 # libpandelay.so
 #
@@ -30,4 +45,9 @@ set_target_properties (pandelay
       #COMPILE_FLAGS "-O3"
       )
 
-install_targets ( /${CMAKE_INSTALL_LIBDIR}/${MusE_INSTALL_NAME}/plugins pandelay)
+##
+## Install location
+##
+install( TARGETS pandelay
+      DESTINATION ${MusE_PLUGINS_DIR}
+      )
diff --git a/muse2/share/CMakeLists.txt b/muse2/share/CMakeLists.txt
index bb923315..817e2910 100644
--- a/muse2/share/CMakeLists.txt
+++ b/muse2/share/CMakeLists.txt
@@ -18,6 +18,15 @@
 #  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #=============================================================================
 
-subdirs( drummaps html instruments locale plugins pybridge scripts templates wallpapers)
-# subdirs( drummaps instruments locale plugins pybridge scripts templates wallpapers)
+subdirs(
+      drummaps
+      html
+      instruments
+      locale
+      plugins
+      pybridge
+      scripts
+      templates
+      wallpapers
+      )
 
diff --git a/muse2/share/drummaps/CMakeLists.txt b/muse2/share/drummaps/CMakeLists.txt
index 45d5de36..92af890a 100644
--- a/muse2/share/drummaps/CMakeLists.txt
+++ b/muse2/share/drummaps/CMakeLists.txt
@@ -18,5 +18,9 @@
 #  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #=============================================================================
 
-install_files( /${SHARE_INSTALL_PREFIX}/${MusE_INSTALL_NAME}/drummaps .*\\.map )
+file (GLOB drummaps_files *.map)
+
+install( FILES ${drummaps_files}
+      DESTINATION ${MusE_SHARE_DIR}/drummaps
+      )
 
diff --git a/muse2/share/html/CMakeLists.txt b/muse2/share/html/CMakeLists.txt
index f737d3d5..e771637a 100644
--- a/muse2/share/html/CMakeLists.txt
+++ b/muse2/share/html/CMakeLists.txt
@@ -18,11 +18,13 @@
 #  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #=============================================================================
 
-# FIXME: Won't work.
-#install_files( /${SHARE_INSTALL_PREFIX}/${MusE_INSTALL_NAME}/html .*\\.html .*\\.txt .*\\.jpg )  
-
-install_files( /${SHARE_INSTALL_PREFIX}/${MusE_INSTALL_NAME}/html .*\\.html )  
-install_files( /${SHARE_INSTALL_PREFIX}/${MusE_INSTALL_NAME}/html .*\\.jpg )  
-# FIXME: Installs CMakeLists.txt !!!
-install_files( /${SHARE_INSTALL_PREFIX}/${MusE_INSTALL_NAME}/html .*\\.txt )  
+file (GLOB html_files
+      *.css
+      *.html
+      *.jpg
+      toc_.txt
+      )
 
+install( FILES ${html_files}
+      DESTINATION ${MusE_DOC_DIR}/html
+      )
diff --git a/muse2/share/instruments/CMakeLists.txt b/muse2/share/instruments/CMakeLists.txt
index ec1e45dd..5338d7b3 100644
--- a/muse2/share/instruments/CMakeLists.txt
+++ b/muse2/share/instruments/CMakeLists.txt
@@ -18,5 +18,9 @@
 #  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #=============================================================================
 
-install_files( /${SHARE_INSTALL_PREFIX}/${MusE_INSTALL_NAME}/instruments .*\\.idf )
+file (GLOB instruments_files *.idf)
+
+install( FILES ${instruments_files}
+      DESTINATION ${MusE_SHARE_DIR}/instruments
+      )
 
diff --git a/muse2/share/locale/CMakeLists.txt b/muse2/share/locale/CMakeLists.txt
index 454ed830..112cd56b 100644
--- a/muse2/share/locale/CMakeLists.txt
+++ b/muse2/share/locale/CMakeLists.txt
@@ -59,6 +59,6 @@ if (UPDATE_TRANSLATIONS)
             )
 endif (UPDATE_TRANSLATIONS)
 
-#install_files( /${SHARE_INSTALL_PREFIX}/${MusE_INSTALL_NAME}/locale .*\\.qm )
-install(FILES ${QM_FILES} DESTINATION
-      ${CMAKE_INSTALL_PREFIX}/${SHARE_INSTALL_PREFIX}/${MusE_INSTALL_NAME}/locale)
+install(FILES ${QM_FILES}
+      DESTINATION ${MusE_SHARE_DIR}/locale
+      )
diff --git a/muse2/share/plugins/CMakeLists.txt b/muse2/share/plugins/CMakeLists.txt
index 6499c28b..9aa4b92c 100644
--- a/muse2/share/plugins/CMakeLists.txt
+++ b/muse2/share/plugins/CMakeLists.txt
@@ -18,8 +18,15 @@
 #  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #=============================================================================
 
-file (GLOB UI_FILES *.ui)
-set (FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${UI_FILES} CACHE INTERNAL "")
+file (GLOB plugins_ui_files *.ui)
 
-install_files ( /${SHARE_INSTALL_PREFIX}/${MusE_INSTALL_NAME}/plugins .*\\.ui )
+set (FILES_TO_TRANSLATE 
+      ${FILES_TO_TRANSLATE}
+      ${plugins_ui_files}
+      CACHE INTERNAL ""
+      )
+
+install( FILES ${plugins_ui_files}
+      DESTINATION ${MusE_SHARE_DIR}/plugins
+      )
 
diff --git a/muse2/share/pybridge/CMakeLists.txt b/muse2/share/pybridge/CMakeLists.txt
index 30c455aa..bee3a0d0 100644
--- a/muse2/share/pybridge/CMakeLists.txt
+++ b/muse2/share/pybridge/CMakeLists.txt
@@ -18,5 +18,9 @@
 #  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #=============================================================================
 
-install_files( /${SHARE_INSTALL_PREFIX}/${MusE_INSTALL_NAME}/pybridge .*\\.py )
+file (GLOB pybridge_files *.py)
+
+install( FILES ${pybridge_files}
+      DESTINATION ${MusE_SHARE_DIR}/pybridge
+      )
 
diff --git a/muse2/share/scripts/CMakeLists.txt b/muse2/share/scripts/CMakeLists.txt
index 3fc898d1..5a7be7db 100644
--- a/muse2/share/scripts/CMakeLists.txt
+++ b/muse2/share/scripts/CMakeLists.txt
@@ -18,12 +18,15 @@
 #  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #=============================================================================
 
-file(GLOB script_files DoNothing 
-                       RemoveShortEvents 
-                       DoubleSpeed 
-                       ConstantLength 
-                       SwingQuantize1
-    )
+file(GLOB script_files
+      DoNothing 
+      RemoveShortEvents 
+      DoubleSpeed 
+      ConstantLength 
+      SwingQuantize1
+      )
+
 install (PROGRAMS ${script_files}
-         DESTINATION ${CMAKE_INSTALL_PREFIX}/${SHARE_INSTALL_PREFIX}/${MusE_INSTALL_NAME}/scripts)
+      DESTINATION ${MusE_SHARE_DIR}/scripts
+      )
 
diff --git a/muse2/share/templates/CMakeLists.txt b/muse2/share/templates/CMakeLists.txt
index bf047ce7..3bdb6d8a 100644
--- a/muse2/share/templates/CMakeLists.txt
+++ b/muse2/share/templates/CMakeLists.txt
@@ -18,13 +18,9 @@
 #  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #=============================================================================
 
-install_files ( /${SHARE_INSTALL_PREFIX}/${MusE_INSTALL_NAME}/templates .*\\.med
-#    audio.med
-#    # empty.med 
-#    default.med
-#    midiGM.med
-#    monorecord.med
-#    synti.med 
-#    # ns5r.med
-   )
+file (GLOB templates_files *.med)
+
+install( FILES ${templates_files}
+      DESTINATION ${MusE_SHARE_DIR}/templates
+      )
 
diff --git a/muse2/share/wallpapers/CMakeLists.txt b/muse2/share/wallpapers/CMakeLists.txt
index 219010cb..a4332ec5 100644
--- a/muse2/share/wallpapers/CMakeLists.txt
+++ b/muse2/share/wallpapers/CMakeLists.txt
@@ -18,5 +18,9 @@
 #  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #=============================================================================
 
-install_files ( /${SHARE_INSTALL_PREFIX}/${MusE_INSTALL_NAME}/wallpapers .*\\.gif )
-install_files ( /${SHARE_INSTALL_PREFIX}/${MusE_INSTALL_NAME}/wallpapers .*\\.jpg )
+file (GLOB wallpapers_files *.gif *.jpg)
+
+install( FILES ${wallpapers_files}
+      DESTINATION ${MusE_SHARE_DIR}/wallpapers
+      )
+
diff --git a/muse2/synti/CMakeLists.txt b/muse2/synti/CMakeLists.txt
index d4e558d5..73e6d349 100644
--- a/muse2/synti/CMakeLists.txt
+++ b/muse2/synti/CMakeLists.txt
@@ -27,9 +27,15 @@ include_directories(
    ${PROJECT_SOURCE_DIR}/synti
    )
 
-# set (SubDirs libsynti organ deicsonze deicsonze2 simpledrums vam)
-# set (SubDirs libsynti organ deicsonze simpledrums vam)
-set (SubDirs libsynti organ deicsonze simpledrums2 vam)
+set (SubDirs
+      deicsonze
+      # deicsonze2
+      libsynti
+      organ
+      # simpledrums
+      simpledrums2
+      vam
+      )
 
 if (ENABLE_EXPERIMENTAL)
       set (SubDirs ${SubDirs} s1 )
diff --git a/muse2/synti/deicsonze/CMakeLists.txt b/muse2/synti/deicsonze/CMakeLists.txt
index 05546081..c311b05a 100644
--- a/muse2/synti/deicsonze/CMakeLists.txt
+++ b/muse2/synti/deicsonze/CMakeLists.txt
@@ -18,54 +18,91 @@
 #  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #=============================================================================
 
-include(${PROJECT_SOURCE_DIR}/pch.txt)
-
-QT4_WRAP_CPP ( deicsonze_mocs deicsonzegui.h )
+##
+## Expand Qt macros in source files
+##
+QT4_WRAP_CPP ( deicsonze_mocs
+      deicsonzegui.h
+      )
 
-file (GLOB UI_FILES deicsonzegui.ui )
-QT4_WRAP_UI ( deicsonze_uis ${UI_FILES} )
+##
+## UI files
+##
+file (GLOB deicsonze_ui_files
+      deicsonzegui.ui
+      )
+QT4_WRAP_UI ( deicsonze_uis ${deicsonze_ui_files} )
 
+##
+## Resource files
+##
 QT4_ADD_RESOURCES (deicsonze_qrc_files
-                  deicsonze.qrc
-                  )
+      deicsonze.qrc
+      )
 
-file (GLOB SOURCE_FILES
+##
+## List of source files to compile
+##
+file (GLOB deicsonze_source_files
       deicsonze.cpp
       deicsonzepreset.cpp
       deicsonzeplugin.cpp
       deicsonzefilter.cpp
       deicsonzegui.cpp
-      deicsonzegui.h
       )
 
+##
+## Define target
+##
 add_library ( deicsonze SHARED
-      ${SOURCE_FILES}
-      ${PROJECT_BINARY_DIR}/all.h
-      ${PROJECT_BINARY_DIR}/all-pic.h.pch
+      ${deicsonze_source_files}
       ${deicsonze_mocs}
       ${deicsonze_uis}
       ${deicsonze_qrc_files}
       )
 
-set (FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${SOURCE_FILES} ${UI_FILES} CACHE INTERNAL "")
-
-target_link_libraries( deicsonze synti )
+##
+## Append to the list of translations
+##
+set (FILES_TO_TRANSLATE
+      ${FILES_TO_TRANSLATE}
+      ${deicsonze_source_files}
+      ${deicsonze_ui_files}
+      CACHE INTERNAL ""
+      )
 
+##
+## Compilation flags and target name
+##
 # - tell cmake to name target deicsonze.so instead of
 #   libdeicsonze.so
 # - use precompiled header files
 #
 set_target_properties ( deicsonze
-   PROPERTIES PREFIX ""
-   #COMPILE_FLAGS "-O2 -include ${PROJECT_BINARY_DIR}/all-pic.h"
-   COMPILE_FLAGS "-fvisibility=hidden -include ${PROJECT_BINARY_DIR}/all-pic.h"
-   )
+      PROPERTIES PREFIX ""
+      #COMPILE_FLAGS "-O2 -include ${PROJECT_BINARY_DIR}/all-pic.h"
+      COMPILE_FLAGS "-fvisibility=hidden -include ${PROJECT_BINARY_DIR}/all-pic.h"
+      )
 
+##
+## Linkage
+##
 target_link_libraries(deicsonze
-      al awl synti
+      al
+      awl
+      synti
       ${QT_LIBRARIES}
       )
 
-install_targets ( /${CMAKE_INSTALL_LIBDIR}/${MusE_INSTALL_NAME}/synthi/ deicsonze )
-
-install_files ( /share/${MusE_INSTALL_NAME}/presets/deicsonze SutulaBank.dei )
+##
+## Install location
+##
+install( TARGETS deicsonze
+      DESTINATION ${MusE_SYNTHI_DIR}
+      )
+install( FILES SutulaBank.dei
+      DESTINATION ${MusE_SHARE_DIR}/presets/deicsonze
+      )
+install( FILES README TODO
+      DESTINATION ${MusE_DOC_DIR}/deicsonze
+      )
diff --git a/muse2/synti/deicsonze/deicsonze.cpp b/muse2/synti/deicsonze/deicsonze.cpp
index 6d86eda9..049daeed 100644
--- a/muse2/synti/deicsonze/deicsonze.cpp
+++ b/muse2/synti/deicsonze/deicsonze.cpp
@@ -121,13 +121,7 @@ DeicsOnze::DeicsOnze() : Mess(2) {
   _saveConfig = true;
   _isInitSet = true; //false if an initial bank must be download
   
-  ///_initSetPath = INSTPREFIX "/share/muse-" VERSION "/presets/deicsonze/SutulaBank.dei";
-  //"/usr/local/share/muse-1.0pre1/presets/deicsonze/SutulaBank.dei";
-  
-  // Tim.
-  QString sharePath(QString(INSTPREFIX) + QString("/") +                                             
-                            QString(SHAREINSTPREFIX) + QString("/") +  // This has no prefix. Default is "share", set in top cmake script.
-                            QString(INSTALL_NAME));   
+  QString sharePath(SHAREDIR);
   _initSetPath = sharePath + QString("/presets/deicsonze/SutulaBank.dei");
   
   
@@ -135,7 +129,6 @@ DeicsOnze::DeicsOnze() : Mess(2) {
   //INSTPREFIX + "/share/" + PACKAGEVERSION + "/presets/deicsonze/ARCH_ALIN";
   _isBackgroundPix = true; //false if an initial bank must be download
   
-  ///_backgroundPixPath = INSTPREFIX "/share/muse-" VERSION "/wallpapers/paper2.jpg";
   //"/usr/local/share/muse-1.0pre1/wallpapers/abstractdeicsonze1.jpg";
   _backgroundPixPath = sharePath + QString("/wallpapers/paper2.jpg");    // Tim.
   
diff --git a/muse2/synti/deicsonze/deicsonzegui.cpp b/muse2/synti/deicsonze/deicsonzegui.cpp
index 8f9fafd0..84cf4d22 100644
--- a/muse2/synti/deicsonze/deicsonzegui.cpp
+++ b/muse2/synti/deicsonze/deicsonzegui.cpp
@@ -440,18 +440,11 @@ DeicsOnzeGui::DeicsOnzeGui(DeicsOnze* deicsOnze)
   setEnabledPreset(false);
   
   // Tim.
-  QString sharePath(QString(INSTPREFIX) + QString("/") +                                             
-                            QString(SHAREINSTPREFIX) + QString("/") +  // This has no prefix. Default is "share", set in top cmake script.
-                            QString(INSTALL_NAME));   
-                            
+  QString sharePath(SHAREDIR);                            
   updateInitSetPath
-    ///(INSTPREFIX "/share/muse-" VERSION "/presets/deicsonze/SutulaBank.dei");
     (sharePath + QString("/presets/deicsonze/SutulaBank.dei"));    // Tim.
     
-    //"/usr/local/share/muse-1.0pre1/presets/deicsonze/SutulaBank.dei")
-    //);
   updateBackgroundPixPath
-    ///(INSTPREFIX "/share/muse-" VERSION "/wallpapers/paper2.jpg");
     (sharePath + QString("/wallpapers/paper2.jpg"));    // Tim.
     
   updateBackgroundPixCheckBox(true);
diff --git a/muse2/synti/fluid/CMakeLists.txt b/muse2/synti/fluid/CMakeLists.txt
index 6a99c3f0..1367436a 100644
--- a/muse2/synti/fluid/CMakeLists.txt
+++ b/muse2/synti/fluid/CMakeLists.txt
@@ -18,45 +18,78 @@
 #  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #=============================================================================
 
-QT4_WRAP_CPP ( fluid_mocs fluidgui.h )
+##
+## Expand Qt macros in source files
+##
+QT4_WRAP_CPP ( fluid_mocs
+      fluidgui.h
+      )
 
-file (GLOB UI_FILES fluidguibase.ui )
-QT4_WRAP_UI (  fluid_uis ${UI_FILES} )
+##
+## UI files
+##
+file (GLOB fluid_ui_files
+      fluidguibase.ui
+      )
+QT4_WRAP_UI ( fluid_uis ${fluid_ui_files} )
 
-file (GLOB SOURCE_FILES
+##
+## List of source files to compile
+##
+file (GLOB fluid_source_files
       fluid.cpp 
       fluidgui.cpp
-      fluidgui.h
       )
 
+##
+## Define target
+##
 add_library ( fluid SHARED 
-      ${SOURCE_FILES}
+      ${fluid_source_files}
       ${fluid_mocs}
       ${fluid_uis}
       )
 
-set (FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${SOURCE_FILES} ${UI_FILES} CACHE INTERNAL "")
-
-# target_link_libraries( fluid synti )
+##
+## Append to the list of translations
+##
+set (FILES_TO_TRANSLATE
+      ${FILES_TO_TRANSLATE}
+      ${fluid_source_files}
+      ${fluid_ui_files}
+      CACHE INTERNAL ""
+      )
 
+##
+## Compilation flags and target name
+##
 # - tell cmake to name target fluid.so instead of 
 #   libfluid.so
 # - use precompiled header files
 #
 set_target_properties ( fluid
-   PROPERTIES PREFIX ""
-   COMPILE_FLAGS "-fvisibility=hidden -include ${PROJECT_BINARY_DIR}/all-pic.h"
-   LINK_FLAGS "${FLUIDSYN_LDFLAGS}"   # "-lfluidsynth"
-   )
+      PROPERTIES PREFIX ""
+      COMPILE_FLAGS "-fvisibility=hidden -include ${PROJECT_BINARY_DIR}/all-pic.h"
+      LINK_FLAGS "${FLUIDSYN_LDFLAGS}"   # "-lfluidsynth"
+      )
+
+##
+## Linkage
+##
 target_link_libraries(fluid
       synti
       ${QT_LIBRARIES}
-      # Can't do this. FLUIDSYN_LIBRARIES = fluidsynth, which is the name of our fluidsynth.so shared synthesizer library.
+      # Can't do this. FLUIDSYN_LIBRARIES = fluidsynth, which is the name 
+      # of our fluidsynth.so shared synthesizer library.
       # This caused ../fluidsynth/fluidsynth.so to appear in the link line.
       # ${FLUIDSYN_LIBRARIES}
       # Try giving full path: Nope, path is empty!
       # ${FLUIDSYN_LIBRARY_DIRS}/${FLUIDSYN_LIBRARIES}
       )
 
-install_targets ( /${CMAKE_INSTALL_LIBDIR}/${MusE_INSTALL_NAME}/synthi/ fluid )
-
+##
+## Install location
+##
+install( TARGETS fluid 
+      DESTINATION ${MusE_SYNTHI_DIR}
+      )
diff --git a/muse2/synti/fluidsynth/CMakeLists.txt b/muse2/synti/fluidsynth/CMakeLists.txt
index 41aef6a9..930d12d5 100644
--- a/muse2/synti/fluidsynth/CMakeLists.txt
+++ b/muse2/synti/fluidsynth/CMakeLists.txt
@@ -18,55 +18,89 @@
 #  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #=============================================================================
 
-QT4_WRAP_CPP ( fluidsynth_mocs fluidsynthgui.h )
+##
+## Expand Qt macros in source files
+##
+QT4_WRAP_CPP ( fluidsynth_mocs
+      fluidsynthgui.h
+      )
 
-file (GLOB UI_FILES fluidsynthguibase.ui )
-QT4_WRAP_UI ( fluidsynth_uis ${UI_FILES} )
+##
+## UI files
+##
+file (GLOB fluidsynth_ui_files
+      fluidsynthguibase.ui
+      )
+QT4_WRAP_UI ( fluidsynth_uis ${fluidsynth_ui_files} )
 
+##
+## Resource files
+##
 QT4_ADD_RESOURCES (fluidsynth_qrc_files
-                  fluidsynth.qrc
-                  )
+      fluidsynth.qrc
+      )
 
-file (GLOB SOURCE_FILES
+##
+## List of source files to compile
+##
+file (GLOB fluidsynth_source_files
       fluidsynti.cpp 
       fluidsynthgui.cpp
-      fluidsynthgui.h
       )
 
+##
+## Define target
+##
 add_library ( fluidsynth SHARED 
-      ${SOURCE_FILES}
+      ${fluidsynth_source_files}
       ${fluidsynth_mocs}
       ${fluidsynth_uis}
       ${fluidsynth_qrc_files}
       )
 
-set (FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${SOURCE_FILES} ${UI_FILES} CACHE INTERNAL "")
-
-# target_link_libraries( fluidsynth synti )
+##
+## Append to the list of translations
+##
+set (FILES_TO_TRANSLATE 
+      ${FILES_TO_TRANSLATE}
+      ${fluidsynth_source_files}
+      ${fluidsynth_ui_files}
+      CACHE INTERNAL ""
+      )
 
+##
+## Compilation flags and target name
+##
 # - tell cmake to name target fluidsynth.so instead of 
 #   libfluidsynth.so
 # - use precompiled header files
 #
 set_target_properties ( fluidsynth 
-   PROPERTIES PREFIX ""
-   COMPILE_FLAGS "-fvisibility=hidden -include ${PROJECT_BINARY_DIR}/all-pic.h"
-   LINK_FLAGS "${FLUIDSYN_LDFLAGS}"   # "-lfluidsynth"
-   )
+      PROPERTIES PREFIX ""
+      COMPILE_FLAGS "-fvisibility=hidden -include ${PROJECT_BINARY_DIR}/all-pic.h"
+      LINK_FLAGS "${FLUIDSYN_LDFLAGS}"   # "-lfluidsynth"
+      )
+
 
+##
+## Linkage
+##
 target_link_libraries(fluidsynth
       synti
       ${QT_LIBRARIES}
-      # Can't do this here, since FLUIDSYN_LIBRARIES evaluates to 'fluidsynth', the same name as our target.
+      # Can't do this here, since FLUIDSYN_LIBRARIES evaluates 
+      # to 'fluidsynth', the same name as our target.
       # ${FLUIDSYN_LIBRARIES}
       # Try giving full path:  Nope, path is empty!
       #${FLUIDSYN_LIBRARY_DIRS}/${FLUIDSYN_LIBRARIES}
       )
 
-install_targets ( /${CMAKE_INSTALL_LIBDIR}/${MusE_INSTALL_NAME}/synthi/ fluidsynth )
-
-# FIXME: Won't work
-# install_files ( /${MusE_INSTALL_NAME}/synthi TODO README.txt )
-
-install_files ( /${SHARE_INSTALL_PREFIX}/${MusE_INSTALL_NAME}/synthi/fluidsynth TODO )
-install_files ( /${SHARE_INSTALL_PREFIX}/${MusE_INSTALL_NAME}/synthi/fluidsynth README.txt )
+##
+## Install location
+##
+install( TARGETS fluidsynth 
+      DESTINATION ${MusE_SYNTHI_DIR}
+      )
+install( FILES README.txt TODO
+      DESTINATION ${MusE_DOC_DIR}/fluidsynth/
+      )
diff --git a/muse2/synti/libsynti/CMakeLists.txt b/muse2/synti/libsynti/CMakeLists.txt
index 0b257249..8b7a662b 100644
--- a/muse2/synti/libsynti/CMakeLists.txt
+++ b/muse2/synti/libsynti/CMakeLists.txt
@@ -20,7 +20,10 @@
 
 include(${PROJECT_SOURCE_DIR}/pch.txt)
 
-file (GLOB SOURCE_FILES
+##
+## List of source files to compile
+##
+file (GLOB synti_source_files
       mess.cpp
       # mess2.cpp
       gui.cpp
@@ -31,20 +34,37 @@ file (GLOB SOURCE_FILES
       ## mpevent.cpp
       )
 
+##
+## Define target
+##
 add_library(synti SHARED
       ${PROJECT_BINARY_DIR}/all-pic.h.pch
-      ${SOURCE_FILES}
+      ${synti_source_files}
       )
 
-set (FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${SOURCE_FILES} CACHE INTERNAL "")
-
-install(TARGETS synti DESTINATION ${MUSE_MODULES_DIR})
+##
+## Append to the list of translations
+##
+set (FILES_TO_TRANSLATE
+      ${FILES_TO_TRANSLATE}
+      ${synti_source_files}
+      CACHE INTERNAL ""
+      )
 
+##
+## Compilation flags and target name
+##
 #
 # -fPIC is necessary for 64 bit systems
 #
 set_target_properties( synti
-   PROPERTIES COMPILE_FLAGS "-fPIC -include ${PROJECT_BINARY_DIR}/all-pic.h"
-              OUTPUT_NAME muse_synti
-   )
+      PROPERTIES COMPILE_FLAGS "-fPIC -include ${PROJECT_BINARY_DIR}/all-pic.h"
+      OUTPUT_NAME muse_synti
+      )
 
+##
+## Install location
+##
+install(TARGETS synti 
+      DESTINATION ${MusE_MODULES_DIR}
+      )
diff --git a/muse2/synti/organ/CMakeLists.txt b/muse2/synti/organ/CMakeLists.txt
index 92ffebee..0d8dda90 100644
--- a/muse2/synti/organ/CMakeLists.txt
+++ b/muse2/synti/organ/CMakeLists.txt
@@ -18,42 +18,73 @@
 #  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #=============================================================================
 
-QT4_WRAP_CPP ( organ_mocs organgui.h )
+##
+## Expand Qt macros in source files
+##
+QT4_WRAP_CPP ( organ_mocs
+      organgui.h
+      )
 
-file (GLOB UI_FILES organguibase.ui )
-QT4_WRAP_UI ( organ_uis ${UI_FILES} )
+##
+## UI files
+##
+file (GLOB organ_ui_files
+      organguibase.ui
+      )
+QT4_WRAP_UI ( organ_uis ${organ_ui_files} )
 
-file (GLOB SOURCE_FILES
+##
+## List of source files to compile
+##
+file (GLOB organ_source_files
       organ.cpp
       organgui.cpp
       # reverb.cpp
       # routing.cpp
-      # organgui.h
       )
 
+##
+## Define target
+##
 add_library ( organ SHARED
       ${PROJECT_SOURCE_DIR}/muse/xml.cpp
-      ${SOURCE_FILES}
+      ${organ_source_files}
       ${organ_mocs}
       ${organ_uis}
       )
 
-set (FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${SOURCE_FILES} ${UI_FILES} CACHE INTERNAL "")
+##
+## Append to the list of translations
+##
+set (FILES_TO_TRANSLATE
+      ${FILES_TO_TRANSLATE}
+      ${organ_source_files}
+      ${organ_ui_files}
+      CACHE INTERNAL ""
+      )
 
 # - tell cmake to name target organ.so instead of
 #   liborgan.so
 # - use precompiled header files
 #
 set_target_properties ( organ
-   PROPERTIES PREFIX ""
-   COMPILE_FLAGS "-fvisibility=hidden -O2 -include ${PROJECT_BINARY_DIR}/all-pic.h"
-   )
+      PROPERTIES PREFIX ""
+      COMPILE_FLAGS "-fvisibility=hidden -O2 -include ${PROJECT_BINARY_DIR}/all-pic.h"
+      )
 
+##
+## Linkage
+##
 target_link_libraries(organ
       synti
       # awl
       ${QT_LIBRARIES}
       )
 
-install_targets ( /${CMAKE_INSTALL_LIBDIR}/${MusE_INSTALL_NAME}/synthi/ organ )
+##
+## Install location
+##
+install( TARGETS organ
+      DESTINATION ${MusE_SYNTHI_DIR}
+      )
 
diff --git a/muse2/synti/s1/CMakeLists.txt b/muse2/synti/s1/CMakeLists.txt
index c1e74c03..93c62961 100644
--- a/muse2/synti/s1/CMakeLists.txt
+++ b/muse2/synti/s1/CMakeLists.txt
@@ -18,23 +18,51 @@
 #  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #=============================================================================
 
-file (GLOB SOURCE_FILES s1.cpp )
-add_library ( s1 SHARED ${SOURCE_FILES} )
+##
+## List of source files to compile
+##
+file (GLOB s1_source_files
+      s1.cpp
+      )
 
-set (FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${SOURCE_FILES} CACHE INTERNAL "")
+##
+## Define target
+##
+add_library ( s1 SHARED
+      ${s1_source_files}
+      )
 
-# target_link_libraries( s1 synti )
+##
+## Append to the list of translations
+##
+set (FILES_TO_TRANSLATE
+      ${FILES_TO_TRANSLATE}
+      ${s1_source_files}
+      CACHE INTERNAL ""
+      )
 
+##
+## Compilation flags and target name
+##
 # tell cmake to name target s1.so instead of 
 # libs1.so
 #
 set_target_properties ( s1 
-  PROPERTIES PREFIX "" 
-  COMPILE_FLAGS "-fvisibility=hidden"
-  )
+      PROPERTIES PREFIX "" 
+      COMPILE_FLAGS "-fvisibility=hidden"
+      )
 
+##
+## Linkage
+##
 target_link_libraries(s1
       synti
       )
-install_targets ( /${CMAKE_INSTALL_LIBDIR}/${MusE_INSTALL_NAME}/synthi/ s1 )
+
+##
+## Install location
+##
+install( TARGETS s1
+      DESTINATION ${MusE_SYNTHI_DIR}
+      )
 
diff --git a/muse2/synti/simpledrums2/CMakeLists.txt b/muse2/synti/simpledrums2/CMakeLists.txt
index 26d6b096..41fb8da5 100644
--- a/muse2/synti/simpledrums2/CMakeLists.txt
+++ b/muse2/synti/simpledrums2/CMakeLists.txt
@@ -18,43 +18,78 @@
 #  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #=============================================================================
 
-QT4_WRAP_CPP ( simpledrums_mocs simpledrumsgui.h ssplugingui.h )
+##
+## Expand Qt macros in source files
+##
+QT4_WRAP_CPP ( simpledrums_mocs
+      simpledrumsgui.h
+      ssplugingui.h
+      )
 
-file (GLOB UI_FILES simpledrumsguibase.ui sspluginchooserbase.ui )
-QT4_WRAP_UI ( simpledrums_uis ${UI_FILES} )
+##
+## UI files
+##
+file (GLOB simpledrums_ui_files 
+      simpledrumsguibase.ui
+      sspluginchooserbase.ui
+      )
+QT4_WRAP_UI ( simpledrums_uis ${simpledrums_ui_files} )
 
-file (GLOB SOURCE_FILES
+##
+## List of source files to compile
+##
+file (GLOB simpledrums_source_files
       simpledrums.cpp
       simpledrumsgui.cpp
-      simpledrums.h
       ssplugin.cpp
       ssplugingui.cpp
-      ssplugin.h
-      common.h
       )
 
+##
+## Define target
+##
 add_library ( simpledrums SHARED
-      ${SOURCE_FILES}
+      ${simpledrums_source_files}
       ${simpledrums_mocs}
       ${simpledrums_uis}
       )
 
-set (FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${SOURCE_FILES} ${UI_FILES} CACHE INTERNAL "")
+##
+## Append to the list of translations
+##
+set (FILES_TO_TRANSLATE
+      ${FILES_TO_TRANSLATE} 
+      ${simpledrums_source_files}
+      ${simpledrums_ui_files}
+      CACHE INTERNAL ""
+      )
 
+##
+## Compilation flags and target name
+##
 # - tell cmake to name target simpledrums.so instead of
 #   libsimpledrums.so
 # - use precompiled header files
 #
 set_target_properties ( simpledrums
-   PROPERTIES PREFIX ""
-   COMPILE_FLAGS "-O6 -fvisibility=hidden -include ${PROJECT_BINARY_DIR}/all-pic.h"
-   )
+      PROPERTIES PREFIX ""
+      COMPILE_FLAGS "-O6 -fvisibility=hidden -include ${PROJECT_BINARY_DIR}/all-pic.h"
+      )
 
+##
+## Linkage
+##
 target_link_libraries(simpledrums
       synti
-#      awl
       ${QT_LIBRARIES}
       )
 
-install_targets ( /${CMAKE_INSTALL_LIBDIR}/${MusE_INSTALL_NAME}/synthi/ simpledrums )
-
+##
+## Install location
+##
+install( TARGETS simpledrums 
+      DESTINATION ${MusE_SYNTHI_DIR}
+      )
+install( FILES COPYING README ReleaseNotes.txt
+      DESTINATION ${MusE_DOC_DIR}/simpledrums
+      )
diff --git a/muse2/synti/vam/CMakeLists.txt b/muse2/synti/vam/CMakeLists.txt
index d63e4144..31f2a12a 100644
--- a/muse2/synti/vam/CMakeLists.txt
+++ b/muse2/synti/vam/CMakeLists.txt
@@ -18,41 +18,75 @@
 #  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #=============================================================================
 
-QT4_WRAP_CPP ( vam_mocs vamgui.h )
+##
+## Expand Qt macros in source files
+##
+QT4_WRAP_CPP ( vam_mocs
+      vamgui.h
+      )
 
-file (GLOB UI_FILES vamguibase.ui ) 
-QT4_WRAP_UI ( vam_uis ${UI_FILES} )
+##
+## UI files
+##
+file (GLOB vam_ui_files
+      vamguibase.ui
+      ) 
+QT4_WRAP_UI ( vam_uis ${vam_ui_files} )
 
-file (GLOB SOURCE_FILES
+##
+## List of source files to compile
+##
+file (GLOB vam_source_files
       vam.cpp 
       vamgui.cpp
-      vamgui.h
       )
 
+##
+## Define target
+##
 add_library ( vam SHARED 
-      ${SOURCE_FILES}
+      ${vam_source_files}
       ${vam_mocs}
       ${vam_uis}
       )
 
-set (FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${SOURCE_FILES} ${UI_FILES} CACHE INTERNAL "")
-
-# target_link_libraries( vam synti )
+##
+## Append to the list of translations
+##
+set (FILES_TO_TRANSLATE
+      ${FILES_TO_TRANSLATE}
+      ${vam_source_files}
+      ${vam_ui_files}
+      CACHE INTERNAL ""
+      )
 
+##
+## Compilation flags and target name
+##
 # - tell cmake to name target vam.so instead of 
 #   libvam.so
 # - use precompiled header files
 #
 set_target_properties ( vam 
-   PROPERTIES PREFIX ""
-   COMPILE_FLAGS "-fvisibility=hidden -include ${PROJECT_BINARY_DIR}/all-pic.h"
-   )
+      PROPERTIES PREFIX ""
+      COMPILE_FLAGS "-fvisibility=hidden -include ${PROJECT_BINARY_DIR}/all-pic.h"
+      )
 
+##
+## Linkage
+##
 target_link_libraries(vam
       # al
       synti
       ${QT_LIBRARIES}
       )
 
-install_targets ( /${CMAKE_INSTALL_LIBDIR}/${MusE_INSTALL_NAME}/synthi/ vam )
-
+##
+## Install location
+##
+install( TARGETS vam
+      DESTINATION ${MusE_SYNTHI_DIR}
+      )
+install( FILES ChangeLog COPYING README TODO
+      DESTINATION ${MusE_DOC_DIR}/vam
+      )
diff --git a/muse2/utils/CMakeLists.txt b/muse2/utils/CMakeLists.txt
index 8d2b018f..d3082b7d 100644
--- a/muse2/utils/CMakeLists.txt
+++ b/muse2/utils/CMakeLists.txt
@@ -18,5 +18,8 @@
 #  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #=============================================================================
 
-install_files ( /${SHARE_INSTALL_PREFIX}/${MusE_INSTALL_NAME}/utils/ muse-find-unused-wavs)
-install_files ( /${SHARE_INSTALL_PREFIX}/${MusE_INSTALL_NAME}/utils/ muse-song-convert.py)
+install( FILES
+      muse-find-unused-wavs
+      muse-song-convert.py
+      DESTINATION ${MusE_SHARE_DIR}/utils/
+      )
-- 
cgit v1.2.3