diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1e61faf..435cf29 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -389,10 +389,11 @@ add_definitions(-DVSXU_INSTALL_LIB_DIR="${VSXU_INSTALL_LIB_DIR}")
 ################################################################################
 # VSXU LIBRARIES ###############################################################
 ################################################################################
-add_subdirectory(engine)
 add_subdirectory(engine_audiovisual)
 add_subdirectory(engine_graphics)
+# order matters - need to add plugins before engine to create static glue
 add_subdirectory(plugins)
+add_subdirectory(engine)
 add_subdirectory(widget)
 
 ################################################################################
--- vsxu-0.5.1/CMakeLists.txt.orig	2015-05-12 14:43:04.427596836 +0200
+++ vsxu-0.5.1/CMakeLists.txt	2015-05-12 14:43:13.995596648 +0200
@@ -56,27 +56,6 @@
 endif()
 
 ################################################################################
-# The pkg-config file
-################################################################################
-IF (UNIX OR VSXU_WINDOWS_LIB_BUILD)
-  if (VSXU_STATIC EQUAL 1 AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/plugins/static_factory_pkgconfig_libs")
-    file (STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/plugins/static_factory_pkgconfig_libs" VSXU_PLUGIN_PKGCONFIG_LIBS)
-    CONFIGURE_FILE (${CMAKE_CURRENT_SOURCE_DIR}/libvsxu.pc.in.static
-                    ${CMAKE_CURRENT_BINARY_DIR}/libvsxu.pc
-                    @ONLY)
-
-  else()
-    CONFIGURE_FILE (${CMAKE_CURRENT_SOURCE_DIR}/libvsxu.pc.in.dynamic
-                    ${CMAKE_CURRENT_BINARY_DIR}/libvsxu.pc
-                    @ONLY)
-  endif()
-
-  INSTALL (FILES ${CMAKE_CURRENT_BINARY_DIR}/libvsxu.pc
-           DESTINATION ${VSXU_INSTALL_LIB_DIR}/pkgconfig)
-ENDIF()
-
-
-################################################################################
 # CPACK OPTIONS ################################################################
 ################################################################################
 SET(CPACK_PACKAGE_NAME "vsxu")
@@ -417,6 +396,27 @@
     add_subdirectory(tools/vsxl)
 endif(UNIX)
 
+################################################################################
+# The pkg-config file
+################################################################################
+IF (UNIX OR VSXU_WINDOWS_LIB_BUILD)
+  if (VSXU_STATIC EQUAL 1 AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/plugins/static_factory_pkgconfig_libs")
+    file (STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/plugins/static_factory_pkgconfig_libs" VSXU_PLUGIN_PKGCONFIG_LIBS)
+    CONFIGURE_FILE (${CMAKE_CURRENT_SOURCE_DIR}/libvsxu.pc.in.static
+                    ${CMAKE_CURRENT_BINARY_DIR}/libvsxu.pc
+                    @ONLY)
+
+  else()
+    CONFIGURE_FILE (${CMAKE_CURRENT_SOURCE_DIR}/libvsxu.pc.in.dynamic
+                    ${CMAKE_CURRENT_BINARY_DIR}/libvsxu.pc
+                    @ONLY)
+  endif()
+
+  INSTALL (FILES ${CMAKE_CURRENT_BINARY_DIR}/libvsxu.pc
+           DESTINATION ${VSXU_INSTALL_LIB_DIR}/pkgconfig)
+ENDIF()
+
+
 
 
 
