From 6cad77308d5c794052daaf3dd301b89bc894bd63 Mon Sep 17 00:00:00 2001
From: Orcan Ogetbil <oget.fedora@gmail.com>
Date: Mon, 31 Jan 2011 18:50:38 +0000
Subject: added option to build internal modules statically

---
 muse2/CMakeLists.txt                  | 25 +++++++++++++++++++------
 muse2/ChangeLog                       |  4 ++++
 muse2/al/CMakeLists.txt               | 12 +++++++-----
 muse2/awl/CMakeLists.txt              | 13 +++++++------
 muse2/muse/CMakeLists.txt             | 15 ++++++++-------
 muse2/muse/arranger/CMakeLists.txt    | 13 +++++++------
 muse2/muse/cliplist/CMakeLists.txt    | 13 +++++++------
 muse2/muse/ctrl/CMakeLists.txt        | 13 +++++++------
 muse2/muse/driver/CMakeLists.txt      | 12 +++++++-----
 muse2/muse/instruments/CMakeLists.txt | 13 +++++++------
 muse2/muse/liste/CMakeLists.txt       | 13 +++++++------
 muse2/muse/marker/CMakeLists.txt      | 12 +++++++-----
 muse2/muse/master/CMakeLists.txt      | 12 +++++++-----
 muse2/muse/midiedit/CMakeLists.txt    | 15 +++++++++------
 muse2/muse/mixer/CMakeLists.txt       | 13 +++++++------
 muse2/muse/mplugins/CMakeLists.txt    | 13 +++++++------
 muse2/muse/remote/CMakeLists.txt      | 12 +++++++-----
 muse2/muse/waveedit/CMakeLists.txt    | 12 +++++++-----
 muse2/muse/widgets/CMakeLists.txt     | 18 +++++++-----------
 muse2/synti/libsynti/CMakeLists.txt   | 15 +++++++--------
 20 files changed, 152 insertions(+), 116 deletions(-)

(limited to 'muse2')

diff --git a/muse2/CMakeLists.txt b/muse2/CMakeLists.txt
index 0e948cd4..c2bb92cc 100644
--- a/muse2/CMakeLists.txt
+++ b/muse2/CMakeLists.txt
@@ -57,7 +57,6 @@ ENDIF(NOT DEFINED SHARE_INSTALL_PREFIX)
 # set(CMAKE_VERBOSE_MAKEFILE ON)
 
 set(CMAKE_INCLUDE_CURRENT_DIR TRUE)
-set(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
 set(CMAKE_SKIP_RULE_DEPENDENCY TRUE)
 
 # The MusE version number.
@@ -69,9 +68,8 @@ SET(MusE_VERSION_FULL  "2.0alpha")
 SET(MusE_INSTALL_NAME  "muse-2.0alpha")
 SET(MusE_EXEC_NAME     "muse2")
 
-## The library where we will install the shared components:
+## The directory 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})
 
 ## Synthesizers directory
 SET(MusE_SYNTHI_DIR ${CMAKE_INSTALL_LIBDIR}/${MusE_INSTALL_NAME}/synthi)
@@ -110,6 +108,15 @@ option ( ENABLE_FLUID       "enable fluidsynth softsynth plugins"
 option ( ENABLE_EXPERIMENTAL "enable building experimental features"                         OFF)
 option ( UPDATE_TRANSLATIONS "Update source translation share/locale/*.ts files 
          (WARNING: This will modify the .ts files in the source tree!!)"                     OFF)
+option ( MODULES_BUILD_STATIC "Build type of internal modules"                               OFF)
+
+if ( MODULES_BUILD_STATIC )
+      SET(MODULES_BUILD STATIC )
+else ( MODULES_BUILD_STATIC )
+      SET(MODULES_BUILD SHARED )
+      SET(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
+      SET(CMAKE_INSTALL_RPATH ${MusE_MODULES_DIR})
+endif ( MODULES_BUILD_STATIC )
 
 ##
 ## Just print a notice if this is OS X
@@ -349,9 +356,9 @@ IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
   INCLUDE(CPack)
 ENDIF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
 
-set(CMAKE_CXX_FLAGS         "-Wall -Wextra -Winvalid-pch -fno-exceptions ${CMAKE_CXX_FLAGS}")
-set(CMAKE_CXX_FLAGS_RELEASE "-O2 -fomit-frame-pointer -ffast-math -fstrength-reduce ${CMAKE_CXX_FLAGS_RELEASE}")
-set(CMAKE_CXX_FLAGS_DEBUG   "-g -DQT_DEBUG ${CMAKE_CXX_FLAGS_DEBUG}")
+set(CMAKE_CXX_FLAGS         "-Wall -Wextra -Winvalid-pch -fno-exceptions -fPIC ${CMAKE_CXX_FLAGS}")
+set(CMAKE_CXX_FLAGS_RELEASE "-O2 -fomit-frame-pointer -ffast-math -fstrength-reduce -fPIC ${CMAKE_CXX_FLAGS_RELEASE}")
+set(CMAKE_CXX_FLAGS_DEBUG   "-g -DQT_DEBUG -fPIC ${CMAKE_CXX_FLAGS_DEBUG}")
 
 # subdirs(al awl grepmidi plugins midiplugins muse share synti)
 # subdirs(al lib grepmidi plugins xpm muse share demos doc synti utils)
@@ -396,6 +403,12 @@ summary_add("Fluidsynth support" HAVE_FLUIDSYNTH)
 summary_add("Experimental features" ENABLE_EXPERIMENTAL)
 summary_show()
 
+if ( MODULES_BUILD_STATIC )
+    message (" Internal modules will be built statically into the final binary.")
+else ( MODULES_BUILD_STATIC )
+    message (" Internal modules will be built as shared components.")
+endif ( MODULES_BUILD_STATIC )
+
 ## 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.")
diff --git a/muse2/ChangeLog b/muse2/ChangeLog
index eeb6024e..f93c4101 100644
--- a/muse2/ChangeLog
+++ b/muse2/ChangeLog
@@ -1,3 +1,7 @@
+31.01.2011:
+        - added cmake option (-DMODULES_BUILD_STATIC=ON) to build the internal modules
+          statically. It should be possible to run muse from the build tree. (Orcan)
+        - Moved -fPIC to the global build flags. (Orcan)
 26.01.2011:
         - moved automation lines ontop of parts (rj)
         - fixes to automation editing, still many bugs though (rj)
diff --git a/muse2/al/CMakeLists.txt b/muse2/al/CMakeLists.txt
index a0031143..55e729ab 100644
--- a/muse2/al/CMakeLists.txt
+++ b/muse2/al/CMakeLists.txt
@@ -40,7 +40,7 @@ endif (USE_SSE)
 ##
 ## Define target
 ##
-add_library(al SHARED
+add_library(al ${MODULES_BUILD}
       ${PROJECT_BINARY_DIR}/all.h.pch
       ${al_source_files}
       )
@@ -57,7 +57,7 @@ set_source_files_properties(
       dspXMM.cpp
       sig.cpp
       xml.cpp
-      PROPERTIES COMPILE_FLAGS "-fPIC -include ${PROJECT_BINARY_DIR}/all.h"
+      PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h"
       )
 set_source_files_properties(
       dspSSE.cpp
@@ -74,6 +74,8 @@ target_link_libraries ( al
 ##
 ## Install location
 ##
-install(TARGETS al 
-      DESTINATION ${MusE_MODULES_DIR}
-      )
+if ( ${MODULES_BUILD} STREQUAL SHARED )
+      install(TARGETS al 
+            DESTINATION ${MusE_MODULES_DIR}
+            )
+endif ( ${MODULES_BUILD} STREQUAL SHARED )
diff --git a/muse2/awl/CMakeLists.txt b/muse2/awl/CMakeLists.txt
index 871186be..21772470 100644
--- a/muse2/awl/CMakeLists.txt
+++ b/muse2/awl/CMakeLists.txt
@@ -90,7 +90,7 @@ file (GLOB awl_source_files
 ##
 ## Define target
 ##
-add_library ( awl SHARED
+add_library ( awl ${MODULES_BUILD}
       ${awl_source_files}
       ${awl_mocs}
       )
@@ -108,7 +108,7 @@ set (FILES_TO_TRANSLATE
 ## Compilation flags and target name
 ##
 set_target_properties( awl
-      PROPERTIES COMPILE_FLAGS "-fPIC -include ${PROJECT_BINARY_DIR}/all.h"
+      PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h"
       OUTPUT_NAME muse_awl
       )
 
@@ -123,7 +123,8 @@ target_link_libraries ( awl
 ##
 ## Install location
 ##
-install(TARGETS awl
-      DESTINATION ${MusE_MODULES_DIR}
-      )
-
+if ( ${MODULES_BUILD} STREQUAL SHARED )
+      install(TARGETS awl
+            DESTINATION ${MusE_MODULES_DIR}
+            )
+endif ( ${MODULES_BUILD} STREQUAL SHARED )
diff --git a/muse2/muse/CMakeLists.txt b/muse2/muse/CMakeLists.txt
index 3a8c5564..0877d025 100644
--- a/muse2/muse/CMakeLists.txt
+++ b/muse2/muse/CMakeLists.txt
@@ -144,7 +144,7 @@ file (GLOB icons_source_files
 ##
 ## Define target
 ##
-add_library ( core SHARED
+add_library ( core ${MODULES_BUILD}
       ${muse_qrc_files}
       ${muse_moc_headers}
       ${core_source_files}
@@ -152,7 +152,7 @@ add_library ( core SHARED
 add_executable ( muse
       ${main_source_files}
       )
-add_library ( icons SHARED
+add_library ( icons ${MODULES_BUILD}
       ${icons_source_files}
       )
 
@@ -200,7 +200,7 @@ 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} -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"
+      PROPERTIES COMPILE_FLAGS "${PYREM_CPP_FLAGS} -include ${PROJECT_BINARY_DIR}/all.h"
       OUTPUT_NAME muse_core
       )
 set_target_properties( muse
@@ -264,8 +264,9 @@ target_link_libraries(icons
 install( TARGETS muse 
       RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin/
       )
-install(TARGETS core icons
-      DESTINATION
-      ${MusE_MODULES_DIR}
-      )
+if ( ${MODULES_BUILD} STREQUAL SHARED )
+      install(TARGETS core icons
+            DESTINATION ${MusE_MODULES_DIR}
+            )
+endif ( ${MODULES_BUILD} STREQUAL SHARED )
 
diff --git a/muse2/muse/arranger/CMakeLists.txt b/muse2/muse/arranger/CMakeLists.txt
index 21a06698..c681245e 100644
--- a/muse2/muse/arranger/CMakeLists.txt
+++ b/muse2/muse/arranger/CMakeLists.txt
@@ -41,7 +41,7 @@ file (GLOB arranger_source_files
 #
 # Define target
 #
-add_library ( arranger SHARED
+add_library ( arranger ${MODULES_BUILD}
       ${arranger_source_files}
       ${arranger_mocs}
       )
@@ -59,7 +59,7 @@ set (FILES_TO_TRANSLATE
 # Compilation flags and target name
 #
 set_target_properties( arranger
-      PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -fPIC"
+      PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h"
       OUTPUT_NAME muse_arranger
       )
 
@@ -76,7 +76,8 @@ target_link_libraries ( arranger
 #
 # Install location
 #
-install(TARGETS arranger
-      DESTINATION ${MusE_MODULES_DIR}
-      )
-
+if ( ${MODULES_BUILD} STREQUAL SHARED )
+      install(TARGETS arranger
+            DESTINATION ${MusE_MODULES_DIR}
+            )
+endif ( ${MODULES_BUILD} STREQUAL SHARED )
diff --git a/muse2/muse/cliplist/CMakeLists.txt b/muse2/muse/cliplist/CMakeLists.txt
index 7633b8bb..a37aa79d 100644
--- a/muse2/muse/cliplist/CMakeLists.txt
+++ b/muse2/muse/cliplist/CMakeLists.txt
@@ -35,7 +35,7 @@ file (GLOB cliplist_source_files
 ##
 ## Define target
 ##
-add_library ( cliplist SHARED
+add_library ( cliplist ${MODULES_BUILD}
       ${cliplist_source_files}
       ${cliplist_mocs}
       )
@@ -53,7 +53,7 @@ set (FILES_TO_TRANSLATE
 ## Compilation flags and target name
 ##
 set_target_properties( cliplist
-      PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -fPIC"
+      PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h"
       OUTPUT_NAME muse_cliplist
       )
 
@@ -69,8 +69,9 @@ target_link_libraries ( cliplist
 ##
 ## Install location
 ##
-install(TARGETS cliplist
-      DESTINATION ${MusE_MODULES_DIR}
-      )
-
+if ( ${MODULES_BUILD} STREQUAL SHARED )
+      install(TARGETS cliplist
+            DESTINATION ${MusE_MODULES_DIR}
+            )
+endif ( ${MODULES_BUILD} STREQUAL SHARED )
 
diff --git a/muse2/muse/ctrl/CMakeLists.txt b/muse2/muse/ctrl/CMakeLists.txt
index 731632f7..ca921775 100644
--- a/muse2/muse/ctrl/CMakeLists.txt
+++ b/muse2/muse/ctrl/CMakeLists.txt
@@ -42,7 +42,7 @@ file (GLOB ctrl_source_files
 ##
 ## Define target
 ##
-add_library ( ctrl SHARED
+add_library ( ctrl ${MODULES_BUILD}
       # configmidictrl.cpp
       # definemidictrl.cpp
       # ctrldialog.cpp
@@ -64,7 +64,7 @@ set (FILES_TO_TRANSLATE
 ## Compilation flags and target name
 ##
 set_target_properties( ctrl
-      PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -fPIC"
+      PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h"
       OUTPUT_NAME muse_ctrl
       )
 
@@ -79,7 +79,8 @@ target_link_libraries ( ctrl
 ##
 ## Install location
 ##
-install(TARGETS ctrl
-      DESTINATION ${MusE_MODULES_DIR}
-      )
-
+if ( ${MODULES_BUILD} STREQUAL SHARED )
+      install(TARGETS ctrl
+            DESTINATION ${MusE_MODULES_DIR}
+            )
+endif ( ${MODULES_BUILD} STREQUAL SHARED )
diff --git a/muse2/muse/driver/CMakeLists.txt b/muse2/muse/driver/CMakeLists.txt
index fbac3f0b..0f9857f1 100644
--- a/muse2/muse/driver/CMakeLists.txt
+++ b/muse2/muse/driver/CMakeLists.txt
@@ -33,7 +33,7 @@ file (GLOB driver_source_files
 ##
 ## Define target
 ##
-add_library ( driver SHARED
+add_library ( driver ${MODULES_BUILD}
        # ${PROJECT_BINARY_DIR}/all.h.pch
        ${driver_source_files}
        )
@@ -51,7 +51,7 @@ set (FILES_TO_TRANSLATE
 ## Compilation flags and target name
 ##
 set_target_properties( driver
-      PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -fPIC"
+      PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h"
       OUTPUT_NAME muse_driver
       )
 
@@ -68,6 +68,8 @@ target_link_libraries ( driver
 ##
 ## Install location
 ##
-install(TARGETS driver
-      DESTINATION ${MusE_MODULES_DIR}
-      )
+if ( ${MODULES_BUILD} STREQUAL SHARED )
+      install(TARGETS driver
+            DESTINATION ${MusE_MODULES_DIR}
+            )
+endif ( ${MODULES_BUILD} STREQUAL SHARED )
diff --git a/muse2/muse/instruments/CMakeLists.txt b/muse2/muse/instruments/CMakeLists.txt
index b068798a..bca57336 100644
--- a/muse2/muse/instruments/CMakeLists.txt
+++ b/muse2/muse/instruments/CMakeLists.txt
@@ -48,7 +48,7 @@ file (GLOB instruments_source_files
 ##
 ## Define target
 ##
-add_library ( instruments SHARED
+add_library ( instruments ${MODULES_BUILD}
    ${instruments_source_files}
    ${instruments_mocs}
    ${instruments_uis}
@@ -68,7 +68,7 @@ set (FILES_TO_TRANSLATE
 ## Compilation flags and target name
 ##
 set_target_properties( instruments
-      PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -fPIC"
+      PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h"
       OUTPUT_NAME muse_instruments
       )
 
@@ -83,7 +83,8 @@ target_link_libraries ( instruments
 ##
 ## Install location
 ##
-install(TARGETS instruments
-      DESTINATION ${MusE_MODULES_DIR}
-      )
-
+if ( ${MODULES_BUILD} STREQUAL SHARED )
+      install(TARGETS instruments
+            DESTINATION ${MusE_MODULES_DIR}
+            )
+endif ( ${MODULES_BUILD} STREQUAL SHARED )
diff --git a/muse2/muse/liste/CMakeLists.txt b/muse2/muse/liste/CMakeLists.txt
index 4c0b61a4..d25a2077 100644
--- a/muse2/muse/liste/CMakeLists.txt
+++ b/muse2/muse/liste/CMakeLists.txt
@@ -55,7 +55,7 @@ file (GLOB liste_source_files
 ##
 ## Define target
 ##
-add_library ( liste SHARED
+add_library ( liste ${MODULES_BUILD}
       ${liste_source_files}
       ${liste_mocs}
       ${liste_uis}
@@ -75,7 +75,7 @@ set (FILES_TO_TRANSLATE
 ## Compilation flags and target name
 ##
 set_target_properties( liste
-      PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -fPIC"
+      PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h"
       OUTPUT_NAME muse_liste
       )
 
@@ -91,7 +91,8 @@ target_link_libraries ( liste
 ##
 ## Install location
 ##
-install(TARGETS liste
-      DESTINATION ${MusE_MODULES_DIR}
-      )
-
+if ( ${MODULES_BUILD} STREQUAL SHARED )
+      install(TARGETS liste
+            DESTINATION ${MusE_MODULES_DIR}
+            )
+endif ( ${MODULES_BUILD} STREQUAL SHARED )
diff --git a/muse2/muse/marker/CMakeLists.txt b/muse2/muse/marker/CMakeLists.txt
index 7ed5a40a..1077eba1 100644
--- a/muse2/muse/marker/CMakeLists.txt
+++ b/muse2/muse/marker/CMakeLists.txt
@@ -36,7 +36,7 @@ file (GLOB marker_source_files
 ##
 ## Define target
 ##
-add_library ( marker SHARED
+add_library ( marker ${MODULES_BUILD}
       ${marker_source_files}
       # ${marker_ui_headers}
       ${marker_mocs}
@@ -55,7 +55,7 @@ set (FILES_TO_TRANSLATE
 ## Compilation flags and target name
 ##
 set_target_properties( marker
-      PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -fPIC"
+      PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h"
       OUTPUT_NAME muse_marker
       )
 
@@ -71,6 +71,8 @@ target_link_libraries ( marker
 ##
 ## Install location
 ##
-install(TARGETS marker
-      DESTINATION ${MusE_MODULES_DIR}
-      )
+if ( ${MODULES_BUILD} STREQUAL SHARED )
+      install(TARGETS marker
+            DESTINATION ${MusE_MODULES_DIR}
+            )
+endif ( ${MODULES_BUILD} STREQUAL SHARED )
diff --git a/muse2/muse/master/CMakeLists.txt b/muse2/muse/master/CMakeLists.txt
index bf2cebb7..ed2bd2db 100644
--- a/muse2/muse/master/CMakeLists.txt
+++ b/muse2/muse/master/CMakeLists.txt
@@ -41,7 +41,7 @@ file (GLOB master_source_files
 ##
 ## Define target
 ##
-add_library ( master SHARED
+add_library ( master ${MODULES_BUILD}
       ${master_source_files}
       ${master_mocs}
       )
@@ -59,7 +59,7 @@ set (FILES_TO_TRANSLATE
 ## Compilation flags and target name
 ##
 set_target_properties( master
-      PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -fPIC"
+      PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h"
       OUTPUT_NAME muse_master
       )
 
@@ -76,6 +76,8 @@ target_link_libraries ( master
 ##
 ## Install location
 ##
-install(TARGETS master
-      DESTINATION ${MusE_MODULES_DIR}
-      )
+if ( ${MODULES_BUILD} STREQUAL SHARED )
+      install(TARGETS master
+            DESTINATION ${MusE_MODULES_DIR}
+            )
+endif ( ${MODULES_BUILD} STREQUAL SHARED )
diff --git a/muse2/muse/midiedit/CMakeLists.txt b/muse2/muse/midiedit/CMakeLists.txt
index 94bed2b2..bfb2e882 100644
--- a/muse2/muse/midiedit/CMakeLists.txt
+++ b/muse2/muse/midiedit/CMakeLists.txt
@@ -63,7 +63,7 @@ file (GLOB midiedit_source_files
 ##
 ## Define target
 ##
-add_library ( midiedit SHARED
+add_library ( midiedit ${MODULES_BUILD}
       ${midiedit_source_files}
       ${midiedit_mocs}
       )
@@ -81,7 +81,7 @@ set (FILES_TO_TRANSLATE
 ## Compilation flags and target name
 ##
 set_target_properties( midiedit
-      PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -fPIC"
+      PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h"
       OUTPUT_NAME muse_midiedit
       )
 
@@ -94,12 +94,15 @@ target_link_libraries ( midiedit
       ctrl
       icons
       widgets
-      ctrl
       )
 
 ##
 ## Install location
 ##
-install(TARGETS midiedit
-      DESTINATION ${MusE_MODULES_DIR}
-      )
+if ( ${MODULES_BUILD} STREQUAL SHARED )
+      install(TARGETS midiedit
+            DESTINATION ${MusE_MODULES_DIR}
+            )
+else ( ${MODULES_BUILD} STREQUAL SHARED )
+      target_link_libraries (midiedit core)
+endif ( ${MODULES_BUILD} STREQUAL SHARED )
diff --git a/muse2/muse/mixer/CMakeLists.txt b/muse2/muse/mixer/CMakeLists.txt
index 62a4ed11..e313f44d 100644
--- a/muse2/muse/mixer/CMakeLists.txt
+++ b/muse2/muse/mixer/CMakeLists.txt
@@ -59,7 +59,7 @@ file (GLOB mixer_source_files
 ##
 ## Define target
 ##
-add_library ( mixer SHARED
+add_library ( mixer ${MODULES_BUILD}
       ${mixer_source_files}
       ${mixer_mocs}
       ${mixer_uis}
@@ -79,7 +79,7 @@ set (FILES_TO_TRANSLATE
 ## Compilation flags and target name
 ##
 set_target_properties ( mixer
-      PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -fPIC"
+      PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h"
       OUTPUT_NAME muse_mixer
       )
 
@@ -94,8 +94,9 @@ target_link_libraries ( mixer
 ##
 ## Install location
 ##
-install(TARGETS mixer
-      DESTINATION ${MusE_MODULES_DIR}
-      )
-
+if ( ${MODULES_BUILD} STREQUAL SHARED )
+      install(TARGETS mixer
+            DESTINATION ${MusE_MODULES_DIR}
+            )
+endif ( ${MODULES_BUILD} STREQUAL SHARED )
 
diff --git a/muse2/muse/mplugins/CMakeLists.txt b/muse2/muse/mplugins/CMakeLists.txt
index a6db14f6..470451e1 100644
--- a/muse2/muse/mplugins/CMakeLists.txt
+++ b/muse2/muse/mplugins/CMakeLists.txt
@@ -61,7 +61,7 @@ file (GLOB mplugins_source_files
 ##
 ## Define target
 ##
-add_library ( mplugins SHARED
+add_library ( mplugins ${MODULES_BUILD}
       ${mplugins_source_files}
       ${mplugins_mocs}
       ${mplugins_uis}
@@ -87,7 +87,7 @@ set (FILES_TO_TRANSLATE
 #
 set_target_properties ( mplugins
       # PROPERTIES PREFIX ""
-      PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -fPIC"
+      PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h"
       OUTPUT_NAME muse_mplugins
       )
 
@@ -103,7 +103,8 @@ target_link_libraries( mplugins
 ##
 ## Install location
 ##
-install(TARGETS mplugins
-      DESTINATION ${MusE_MODULES_DIR}
-      )
-
+if ( ${MODULES_BUILD} STREQUAL SHARED )
+      install(TARGETS mplugins
+            DESTINATION ${MusE_MODULES_DIR}
+            )
+endif ( ${MODULES_BUILD} STREQUAL SHARED )
diff --git a/muse2/muse/remote/CMakeLists.txt b/muse2/muse/remote/CMakeLists.txt
index 87ad9672..22943e71 100644
--- a/muse2/muse/remote/CMakeLists.txt
+++ b/muse2/muse/remote/CMakeLists.txt
@@ -28,7 +28,7 @@ file (GLOB remote_source_files
 ##
 ## Define target
 ##
-add_library(remote SHARED
+add_library(remote ${MODULES_BUILD}
       ${remote_source_files}
       ${PROJECT_BINARY_DIR}/all.h.pch
       )
@@ -47,12 +47,14 @@ set (FILES_TO_TRANSLATE
 ##
 set_source_files_properties(
       pyapi.cpp
-      PROPERTIES COMPILE_FLAGS "-fPIC -include ${PROJECT_BINARY_DIR}/all.h -include ${PYTHON_INCLUDES} -DENABLE_PYTHON"
+      PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -include ${PYTHON_INCLUDES} -DENABLE_PYTHON"
       )
 
 ##
 ## Install location
 ##
-install(TARGETS remote
-      DESTINATION ${MusE_MODULES_DIR}
-      )
+if ( ${MODULES_BUILD} STREQUAL SHARED )
+      install(TARGETS remote
+            DESTINATION ${MusE_MODULES_DIR}
+            )
+endif ( ${MODULES_BUILD} STREQUAL SHARED )
diff --git a/muse2/muse/waveedit/CMakeLists.txt b/muse2/muse/waveedit/CMakeLists.txt
index 24696887..b6646cbb 100644
--- a/muse2/muse/waveedit/CMakeLists.txt
+++ b/muse2/muse/waveedit/CMakeLists.txt
@@ -47,7 +47,7 @@ file (GLOB waveedit_source_files
 ##
 ## Define target
 ##
-add_library ( waveedit SHARED
+add_library ( waveedit ${MODULES_BUILD}
       ${waveedit_source_files}
       ${waveedit_ui_headers}
       ${waveedit_mocs}
@@ -67,7 +67,7 @@ set (FILES_TO_TRANSLATE
 ## Compilation flags and target name
 ##
 set_target_properties( waveedit
-      PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -fPIC"
+      PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h"
       OUTPUT_NAME muse_waveedit
       )
 
@@ -82,6 +82,8 @@ target_link_libraries( waveedit
 ##
 ## Install location
 ##
-install(TARGETS waveedit
-      DESTINATION ${MusE_MODULES_DIR}
-      )
+if ( ${MODULES_BUILD} STREQUAL SHARED )
+      install(TARGETS waveedit
+            DESTINATION ${MusE_MODULES_DIR}
+            )
+endif ( ${MODULES_BUILD} STREQUAL SHARED )
diff --git a/muse2/muse/widgets/CMakeLists.txt b/muse2/muse/widgets/CMakeLists.txt
index 92eacc66..cb3125d0 100644
--- a/muse2/muse/widgets/CMakeLists.txt
+++ b/muse2/muse/widgets/CMakeLists.txt
@@ -180,7 +180,7 @@ file (GLOB widgets_source_files
 ##
 ## Define target
 ##
-add_library ( widgets SHARED 
+add_library ( widgets ${MODULES_BUILD} 
       ${widget_ui_headers}
       ${widget_mocs}
       ${widgets_source_files}
@@ -201,7 +201,7 @@ set (FILES_TO_TRANSLATE
 ##
 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"
+      PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h ${MUSECXXFLAGS} -I../ -I${PROJECT_SOURCE_DIR}/synti"
       OUTPUT_NAME muse_widgets
       )
 
@@ -216,12 +216,8 @@ target_link_libraries ( widgets
 ##
 ## Install location
 ##
-install(TARGETS widgets
-      DESTINATION
-      ${MusE_MODULES_DIR}
-      )
-
-
-
-
-
+if ( ${MODULES_BUILD} STREQUAL SHARED )
+      install(TARGETS widgets
+            DESTINATION ${MusE_MODULES_DIR}
+            )
+endif ( ${MODULES_BUILD} STREQUAL SHARED )
diff --git a/muse2/synti/libsynti/CMakeLists.txt b/muse2/synti/libsynti/CMakeLists.txt
index 8b7a662b..0b0e480c 100644
--- a/muse2/synti/libsynti/CMakeLists.txt
+++ b/muse2/synti/libsynti/CMakeLists.txt
@@ -37,7 +37,7 @@ file (GLOB synti_source_files
 ##
 ## Define target
 ##
-add_library(synti SHARED
+add_library(synti ${MODULES_BUILD}
       ${PROJECT_BINARY_DIR}/all-pic.h.pch
       ${synti_source_files}
       )
@@ -54,17 +54,16 @@ set (FILES_TO_TRANSLATE
 ##
 ## 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"
+      PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all-pic.h"
       OUTPUT_NAME muse_synti
       )
 
 ##
 ## Install location
 ##
-install(TARGETS synti 
-      DESTINATION ${MusE_MODULES_DIR}
-      )
+if ( ${MODULES_BUILD} STREQUAL SHARED )
+      install(TARGETS synti 
+            DESTINATION ${MusE_MODULES_DIR}
+            )
+endif ( ${MODULES_BUILD} STREQUAL SHARED )
-- 
cgit v1.2.3