Index: code/trunk/cmake/tools/FindVLD.cmake
===================================================================
--- code/trunk/cmake/tools/FindVLD.cmake	(revision 10268)
+++ code/trunk/cmake/tools/FindVLD.cmake	(revision 10624)
@@ -28,5 +28,5 @@
 FIND_LIBRARY(VLD_LIBRARY
   NAMES vld
-  PATH_SUFFIXES "Visual Leak Detector/lib/Win32"
+  PATH_SUFFIXES "Visual Leak Detector/lib/Win32" "../../lib/Win32"
 )
 
Index: code/trunk/cmake/tools/TargetUtilities.cmake
===================================================================
--- code/trunk/cmake/tools/TargetUtilities.cmake	(revision 10268)
+++ code/trunk/cmake/tools/TargetUtilities.cmake	(revision 10624)
@@ -35,4 +35,7 @@
  #      NO_SOURCE_GROUPS:  Don't create msvc source groups
  #      MODULE:            For dynamic module libraries (libraries only)
+ #      PLUGIN:            For dynamic plugin libraries (libraries only)
+ #                         Plugins are a special kind of modules that can be
+ #                         loaded and unloaded during runtime on demand
  #      WIN32:             Inherited from ADD_EXECUTABLE (executables only)
  #      PCH_NO_DEFAULT:    Do not make precompiled header files default if
@@ -77,9 +80,11 @@
 
 MACRO(ORXONOX_ADD_LIBRARY _target_name)
-  TU_ADD_TARGET(${_target_name} LIBRARY "MODULE" ${ARGN})
+  SET(_additional_switches MODULE PLUGIN)
+  TU_ADD_TARGET(${_target_name} LIBRARY "${_additional_switches}" ${ARGN})
 ENDMACRO(ORXONOX_ADD_LIBRARY)
 
 MACRO(ORXONOX_ADD_EXECUTABLE _target_name)
-  TU_ADD_TARGET(${_target_name} EXECUTABLE "WIN32" ${ARGN})
+  SET(_additional_switches WIN32)
+  TU_ADD_TARGET(${_target_name} EXECUTABLE "${_additional_switches}" ${ARGN})
   
   # When using Visual Studio we want to use the output directory as working
@@ -329,7 +334,16 @@
       LIBRARY_OUTPUT_DIRECTORY ${CMAKE_MODULE_OUTPUT_DIRECTORY} # Unix
     )
-    ADD_MODULE(${_target_name})
+    ADD_MODULE_OR_PLUGIN(${_target_name} ${CMAKE_MODULE_OUTPUT_DIRECTORY} ${MODULE_INSTALL_DIRECTORY} ${ORXONOX_MODULE_EXTENSION})
     # Ensure that the main program depends on the module
     SET(ORXONOX_MODULES ${ORXONOX_MODULES} ${_target_name} CACHE INTERNAL "")
+  ENDIF()
+
+  # Configure plugins
+  IF (_arg_PLUGIN)
+    SET_TARGET_PROPERTIES(${_target_name} PROPERTIES
+      RUNTIME_OUTPUT_DIRECTORY ${CMAKE_PLUGIN_OUTPUT_DIRECTORY} # Windows
+      LIBRARY_OUTPUT_DIRECTORY ${CMAKE_PLUGIN_OUTPUT_DIRECTORY} # Unix
+    )
+    ADD_MODULE_OR_PLUGIN(${_target_name} ${CMAKE_PLUGIN_OUTPUT_DIRECTORY} ${PLUGIN_INSTALL_DIRECTORY} ${ORXONOX_PLUGIN_EXTENSION})
   ENDIF()
 
@@ -372,4 +386,6 @@
     IF(_arg_MODULE)
       SET(_rpath "${MODULE_RPATH}")
+    ELSEIF(_arg_PLUGIN)
+      SET(_rpath "${PLUGIN_RPATH}")
     ELSE()
       SET(_rpath "${LIBRARY_RPATH}")
@@ -411,4 +427,9 @@
         RUNTIME DESTINATION ${MODULE_INSTALL_DIRECTORY}
         LIBRARY DESTINATION ${MODULE_INSTALL_DIRECTORY}
+      )
+    ELSEIF(_arg_PLUGIN)
+      INSTALL(TARGETS ${_target_name}
+        RUNTIME DESTINATION ${PLUGIN_INSTALL_DIRECTORY}
+        LIBRARY DESTINATION ${PLUGIN_INSTALL_DIRECTORY}
       )
     ELSE()
@@ -428,4 +449,9 @@
             CONFIGURATIONS ${_config}
           )
+        ELSEIF(_arg_PLUGIN)
+          INSTALL(FILES ${_location_we}.pdb
+            DESTINATION ${PLUGIN_INSTALL_DIRECTORY}
+            CONFIGURATIONS ${_config}
+          )
         ELSE()
           INSTALL(FILES ${_location_we}.pdb
@@ -441,8 +467,8 @@
 
 
-# Creates a helper file with name <name_of_the_library>${ORXONOX_MODULE_EXTENSION}
-# This helps finding dynamically loadable modules at runtime
-
-FUNCTION(ADD_MODULE _target)
+# Creates a helper file with name <name_of_the_library>.<extension>
+# This helps finding dynamically loadable modules or plugins at runtime
+
+FUNCTION(ADD_MODULE_OR_PLUGIN _target_name _output_dir _install_dir _extension)
   # We use the properties to get the name because the librarys name may differ from
   # the target name (for example orxonox <-> liborxonox)
@@ -451,6 +477,6 @@
     CMAKE_POLICY(SET CMP0026 OLD) # we only use the file's name, not its actual location, so the old policy is fine
   ENDIF()
-  GET_TARGET_PROPERTY(_target_loc ${_target} LOCATION)
-  GET_FILENAME_COMPONENT(_target_name ${_target_loc} NAME_WE)
+  GET_TARGET_PROPERTY(_target_loc ${_target_name} LOCATION)
+  GET_FILENAME_COMPONENT(_target_filename ${_target_loc} NAME_WE)
   IF (POLICY CMP0026)
     CMAKE_POLICY(POP) # set policy back to original settings
@@ -459,23 +485,23 @@
   IF(CMAKE_CONFIGURATION_TYPES)
     FOREACH(_config ${CMAKE_CONFIGURATION_TYPES})
-      SET(_module_filename ${CMAKE_MODULE_OUTPUT_DIRECTORY}/${_config}/${_target_name}${ORXONOX_MODULE_EXTENSION})
-
-      FILE(WRITE ${_module_filename})
+      SET(_helper_filename ${_output_dir}/${_config}/${_target_filename}${_extension})
+
+      FILE(WRITE ${_helper_filename} ${_target_name})
 
       INSTALL(
-        FILES ${_module_filename}
-        DESTINATION ${MODULE_INSTALL_DIRECTORY}
+        FILES ${_helper_filename}
+        DESTINATION ${_install_dir}
         CONFIGURATIONS ${_config}
       )
     ENDFOREACH()
   ELSE()
-    SET(_module_filename ${CMAKE_MODULE_OUTPUT_DIRECTORY}/${_target_name}${ORXONOX_MODULE_EXTENSION})
-
-    FILE(WRITE ${_module_filename})
+    SET(_helper_filename ${_output_dir}/${_target_filename}${_extension})
+
+    FILE(WRITE ${_helper_filename} ${_target_name})
 
     INSTALL(
-      FILES ${_module_filename}
-      DESTINATION ${MODULE_INSTALL_DIRECTORY}
+      FILES ${_helper_filename}
+      DESTINATION ${_install_dir}
     )
   ENDIF()
-ENDFUNCTION(ADD_MODULE)
+ENDFUNCTION(ADD_MODULE_OR_PLUGIN)
