diff --git a/CMake/CMakeLists.txt b/CMake/CMakeLists.txt
index f3a62f2..b53df6f 100644
--- a/CMake/CMakeLists.txt
+++ b/CMake/CMakeLists.txt
@@ -13,10 +13,12 @@
 # directory, but can also be used for custom projects.
 #############################################################
 
-if(WIN32 OR APPLE)
-	set(OGRE_CMAKE_DIR "CMake")
-else()
-	set(OGRE_CMAKE_DIR "${OGRE_LIB_DIRECTORY}/OGRE/cmake")
+if(NOT DEFINED OGRE_CMAKE_DIR)
+  if(WIN32 OR APPLE)
+    set(OGRE_CMAKE_DIR "CMake")
+  else()
+    set(OGRE_CMAKE_DIR "${OGRE_LIB_DIRECTORY}/OGRE/cmake")
+  endif()
 endif()
 
 set(INST_FILES
diff --git a/CMake/Packages/FindFreeImage.cmake b/CMake/Packages/FindFreeImage.cmake
index 7c89ec5..d8314f0 100644
--- a/CMake/Packages/FindFreeImage.cmake
+++ b/CMake/Packages/FindFreeImage.cmake
@@ -43,7 +43,7 @@ find_path(FreeImage_INCLUDE_DIR NAMES FreeImage.h HINTS ${FreeImage_INC_SEARCH_P
 find_library(FreeImage_LIBRARY_REL NAMES ${FreeImage_LIBRARY_NAMES} HINTS ${FreeImage_LIB_SEARCH_PATH} ${FreeImage_PKGC_LIBRARY_DIRS} PATH_SUFFIXES "" Release RelWithDebInfo MinSizeRel)
 find_library(FreeImage_LIBRARY_DBG NAMES ${FreeImage_LIBRARY_NAMES_DBG} HINTS ${FreeImage_LIB_SEARCH_PATH} ${FreeImage_PKGC_LIBRARY_DIRS} PATH_SUFFIXES "" Debug)
 
-make_library_set(FreeImage_LIBRARY)
+make_library_set(FreeImage)
 
 findpkg_finish(FreeImage)
 
diff --git a/CMake/Packages/FindGLSLOptimizer.cmake b/CMake/Packages/FindGLSLOptimizer.cmake
index dd4b179..6f158fc 100644
--- a/CMake/Packages/FindGLSLOptimizer.cmake
+++ b/CMake/Packages/FindGLSLOptimizer.cmake
@@ -38,7 +38,7 @@ findpkg_framework(GLSL_Optimizer)
 find_path(GLSL_Optimizer_INCLUDE_DIR NAMES glsl_optimizer.h HINTS ${GLSL_Optimizer_INC_SEARCH_PATH} ${GLSL_Optimizer_PKGC_INCLUDE_DIRS} PATH_SUFFIXES GLSL_Optimizer)
 find_library(GLSL_Optimizer_LIBRARY_REL NAMES ${GLSL_Optimizer_LIBRARY_NAMES} HINTS ${GLSL_Optimizer_LIB_SEARCH_PATH} ${GLSL_Optimizer_PKGC_LIBRARY_DIRS} PATH_SUFFIXES "" Release RelWithDebInfo MinSizeRel)
 find_library(GLSL_Optimizer_LIBRARY_DBG NAMES ${GLSL_Optimizer_LIBRARY_NAMES_DBG} HINTS ${GLSL_Optimizer_LIB_SEARCH_PATH} ${GLSL_Optimizer_PKGC_LIBRARY_DIRS} PATH_SUFFIXES "" Debug)
-make_library_set(GLSL_Optimizer_LIBRARY)
+make_library_set(GLSL_Optimizer)
 
 findpkg_finish(GLSL_Optimizer)
 add_parent_dir(GLSL_Optimizer_INCLUDE_DIRS GLSL_Optimizer_INCLUDE_DIR)
diff --git a/CMake/Packages/FindHLSL2GLSL.cmake b/CMake/Packages/FindHLSL2GLSL.cmake
index 7125895..13a306f 100644
--- a/CMake/Packages/FindHLSL2GLSL.cmake
+++ b/CMake/Packages/FindHLSL2GLSL.cmake
@@ -38,7 +38,7 @@ findpkg_framework(HLSL2GLSL)
 find_path(HLSL2GLSL_INCLUDE_DIR NAMES hlsl2glsl.h HINTS ${HLSL2GLSL_INC_SEARCH_PATH} ${HLSL2GLSL_PKGC_INCLUDE_DIRS} PATH_SUFFIXES HLSL2GLSL)
 find_library(HLSL2GLSL_LIBRARY_REL NAMES ${HLSL2GLSL_LIBRARY_NAMES} HINTS ${HLSL2GLSL_LIB_SEARCH_PATH} ${HLSL2GLSL_PKGC_LIBRARY_DIRS} PATH_SUFFIXES "" Release RelWithDebInfo MinSizeRel)
 find_library(HLSL2GLSL_LIBRARY_DBG NAMES ${HLSL2GLSL_LIBRARY_NAMES_DBG} HINTS ${HLSL2GLSL_LIB_SEARCH_PATH} ${HLSL2GLSL_PKGC_LIBRARY_DIRS} PATH_SUFFIXES "" Debug)
-make_library_set(HLSL2GLSL_LIBRARY)
+make_library_set(HLSL2GLSL)
 
 findpkg_finish(HLSL2GLSL)
 add_parent_dir(HLSL2GLSL_INCLUDE_DIRS HLSL2GLSL_INCLUDE_DIR)
diff --git a/CMake/Packages/FindNVAPI.cmake b/CMake/Packages/FindNVAPI.cmake
index 95c70cd..893ce01 100644
--- a/CMake/Packages/FindNVAPI.cmake
+++ b/CMake/Packages/FindNVAPI.cmake
@@ -44,7 +44,7 @@ findpkg_framework(NVAPI)
 find_path(NVAPI_INCLUDE_DIR NAMES nvapi.h HINTS ${NVAPI_FRAMEWORK_INCLUDES} ${NVAPI_INC_SEARCH_PATH} ${NVAPI_PKGC_INCLUDE_DIRS} PATH_SUFFIXES NVAPI)
 find_library(NVAPI_LIBRARY_REL NAMES ${NVAPI_LIBRARY_NAMES} HINTS ${NVAPI_LIB_SEARCH_PATH} ${NVAPI_PKGC_LIBRARY_DIRS} PATH_SUFFIXES "" release relwithdebinfo minsizerel)
 find_library(NVAPI_LIBRARY_DBG NAMES ${NVAPI_LIBRARY_NAMES_DBG} HINTS ${NVAPI_LIB_SEARCH_PATH} ${NVAPI_PKGC_LIBRARY_DIRS} PATH_SUFFIXES "" debug)
-make_library_set(NVAPI_LIBRARY)
+make_library_set(NVAPI)
 
 findpkg_finish(NVAPI)
 add_parent_dir(NVAPI_INCLUDE_DIRS NVAPI_INCLUDE_DIR)
\ No newline at end of file
diff --git a/CMake/Packages/FindPOCO.cmake b/CMake/Packages/FindPOCO.cmake
index 6b6d7fa..3667b8b 100644
--- a/CMake/Packages/FindPOCO.cmake
+++ b/CMake/Packages/FindPOCO.cmake
@@ -50,7 +50,7 @@ findpkg_framework(POCO)
 find_path(POCO_INCLUDE_DIR NAMES Poco/Foundation.h HINTS ${POCO_INC_SEARCH_PATH} ${POCO_PKGC_INCLUDE_DIRS} PATH_SUFFIXES Foundation/include)
 find_library(POCO_LIBRARY_REL NAMES ${POCO_LIBRARY_NAMES} HINTS ${POCO_LIB_SEARCH_PATH} ${POCO_PKGC_LIBRARY_DIRS} PATH_SUFFIXES Linux/i686)
 find_library(POCO_LIBRARY_DBG NAMES ${POCO_LIBRARY_NAMES_DBG} HINTS ${POCO_LIB_SEARCH_PATH} ${POCO_PKGC_LIBRARY_DIRS} PATH_SUFFIXES Linux/i686)
-make_library_set(POCO_LIBRARY)
+make_library_set(POCO)
 
 findpkg_finish(POCO)
 
@@ -66,7 +66,7 @@ get_debug_names(POCO_Util_LIBRARY_NAMES)
 find_path(POCO_Util_INCLUDE_DIR NAMES Poco/Util/Util.h HINTS ${POCO_INCLUDE_DIR} ${POCO_INC_SEARCH_PATH} ${POCO_PKGC_INCLUDE_DIRS} PATH_SUFFIXES Util/include)
 find_library(POCO_Util_LIBRARY_REL NAMES ${POCO_Util_LIBRARY_NAMES} HINTS ${POCO_LIB_SEARCH_PATH} ${POCO_PKGC_LIBRARY_DIRS} PATH_SUFFIXES Linux/i686)
 find_library(POCO_Util_LIBRARY_DBG NAMES ${POCO_Util_LIBRARY_NAMES_DBG} HINTS ${POCO_LIB_SEARCH_PATH} ${POCO_PKGC_LIBRARY_DIRS} PATH_SUFFIXES Linux/i686)
-make_library_set(POCO_Util_LIBRARY)
+make_library_set(POCO_Util)
 findpkg_finish(POCO_Util)
 
 # Look for Poco's Net package
@@ -76,7 +76,7 @@ get_debug_names(POCO_Net_LIBRARY_NAMES)
 find_path(POCO_Net_INCLUDE_DIR NAMES Poco/Net/Net.h HINTS ${POCO_INCLUDE_DIR} ${POCO_INC_SEARCH_PATH} ${POCO_PKGC_INCLUDE_DIRS} PATH_SUFFIXES Net/include)
 find_library(POCO_Net_LIBRARY_REL NAMES ${POCO_Net_LIBRARY_NAMES} HINTS ${POCO_LIB_SEARCH_PATH} ${POCO_PKGC_LIBRARY_DIRS} PATH_SUFFIXES Linux/i686)
 find_library(POCO_Net_LIBRARY_DBG NAMES ${POCO_Net_LIBRARY_NAMES_DBG} HINTS ${POCO_LIB_SEARCH_PATH} ${POCO_PKGC_LIBRARY_DIRS} PATH_SUFFIXES Linux/i686)
-make_library_set(POCO_Net_LIBRARY)
+make_library_set(POCO_Net)
 findpkg_finish(POCO_Net)
 
 # Look for Poco's NetSSL package
@@ -86,7 +86,7 @@ get_debug_names(POCO_NetSSL_LIBRARY_NAMES)
 find_path(POCO_NetSSL_INCLUDE_DIR NAMES Poco/Net/NetSSL.h HINTS ${POCO_INCLUDE_DIR} ${POCO_INC_SEARCH_PATH} ${POCO_PKGC_INCLUDE_DIRS} PATH_SUFFIXES NetSSL/include)
 find_library(POCO_NetSSL_LIBRARY_REL NAMES ${POCO_NetSSL_LIBRARY_NAMES} HINTS ${POCO_LIB_SEARCH_PATH} ${POCO_PKGC_LIBRARY_DIRS} PATH_SUFFIXES Linux/i686)
 find_library(POCO_NetSSL_LIBRARY_DBG NAMES ${POCO_NetSSL_LIBRARY_NAMES_DBG} HINTS ${POCO_LIB_SEARCH_PATH} ${POCO_PKGC_LIBRARY_DIRS} PATH_SUFFIXES Linux/i686)
-make_library_set(POCO_NetSSL_LIBRARY)
+make_library_set(POCO_NetSSL)
 findpkg_finish(POCO_NetSSL)
 
 # Look for Poco's XML package
@@ -96,6 +96,6 @@ get_debug_names(POCO_XML_LIBRARY_NAMES)
 find_path(POCO_XML_INCLUDE_DIR NAMES Poco/XML/XML.h HINTS ${POCO_INCLUDE_DIR} ${POCO_INC_SEARCH_PATH} ${POCO_PKGC_INCLUDE_DIRS} PATH_SUFFIXES XML/include)
 find_library(POCO_XML_LIBRARY_REL NAMES ${POCO_XML_LIBRARY_NAMES} HINTS ${POCO_LIB_SEARCH_PATH} ${POCO_PKGC_LIBRARY_DIRS} PATH_SUFFIXES Linux/i686)
 find_library(POCO_XML_LIBRARY_DBG NAMES ${POCO_XML_LIBRARY_NAMES_DBG} HINTS ${POCO_LIB_SEARCH_PATH} ${POCO_PKGC_LIBRARY_DIRS} PATH_SUFFIXES Linux/i686)
-make_library_set(POCO_XML_LIBRARY)
+make_library_set(POCO_XML)
 findpkg_finish(POCO_XML)
 
diff --git a/CMake/Packages/FindTBB.cmake b/CMake/Packages/FindTBB.cmake
index 4200aa0..35e4ea3 100644
--- a/CMake/Packages/FindTBB.cmake
+++ b/CMake/Packages/FindTBB.cmake
@@ -104,7 +104,7 @@ findpkg_framework(TBB)
 find_path(TBB_INCLUDE_DIR NAMES tbb/tbb.h HINTS ${TBB_INC_SEARCH_PATH} ${TBB_PKGC_INCLUDE_DIRS})
 find_library(TBB_LIBRARY_REL NAMES ${TBB_LIBRARY_NAMES} HINTS ${TBB_LIB_SEARCH_PATH} ${TBB_PKGC_LIBRARY_DIRS})
 find_library(TBB_LIBRARY_DBG NAMES ${TBB_LIBRARY_NAMES_DBG} HINTS ${TBB_LIB_SEARCH_PATH} ${TBB_PKGC_LIBRARY_DIRS})
-make_library_set(TBB_LIBRARY)
+make_library_set(TBB)
 
 findpkg_finish(TBB)
 
@@ -120,7 +120,7 @@ get_debug_names(TBB_MALLOC_LIBRARY_NAMES)
 find_path(TBB_MALLOC_INCLUDE_DIR NAMES tbb/tbb.h HINTS ${TBB_INCLUDE_DIR} ${TBB_INC_SEARCH_PATH} ${TBB_PKGC_INCLUDE_DIRS} )
 find_library(TBB_MALLOC_LIBRARY_REL NAMES ${TBB_MALLOC_LIBRARY_NAMES} HINTS ${TBB_LIB_SEARCH_PATH} ${TBB_PKGC_LIBRARY_DIRS} )
 find_library(TBB_MALLOC_LIBRARY_DBG NAMES ${TBB_MALLOC_LIBRARY_NAMES_DBG} HINTS ${TBB_LIB_SEARCH_PATH} ${TBB_PKGC_LIBRARY_DIRS} )
-make_library_set(TBB_MALLOC_LIBRARY)
+make_library_set(TBB_MALLOC)
 findpkg_finish(TBB_MALLOC)
 
 # Look for TBB's malloc proxy package
@@ -130,5 +130,5 @@ get_debug_names(TBB_MALLOC_PROXY_LIBRARY_NAMES)
 find_path(TBB_MALLOC_PROXY_INCLUDE_DIR NAMES tbb/tbbmalloc_proxy.h HINTS ${TBB_INCLUDE_DIR} ${TBB_INC_SEARCH_PATH} ${TBB_PKGC_INCLUDE_DIRS})
 find_library(TBB_MALLOC_PROXY_LIBRARY_REL NAMES ${TBB_MALLOC_PROXY_LIBRARY_NAMES} HINTS ${TBB_LIB_SEARCH_PATH} ${TBB_PKGC_LIBRARY_DIRS})
 find_library(TBB_MALLOC_PROXY_LIBRARY_DBG NAMES ${TBB_MALLOC_PROXY_LIBRARY_NAMES_DBG} HINTS ${TBB_LIB_SEARCH_PATH} ${TBB_PKGC_LIBRARY_DIRS})
-make_library_set(TBB_MALLOC_PROXY_LIBRARY)
+make_library_set(TBB_MALLOC_PROXY)
 findpkg_finish(TBB_MALLOC_PROXY)
diff --git a/CMake/Packages/FindZZip.cmake b/CMake/Packages/FindZZip.cmake
index c112071..214d9e5 100644
--- a/CMake/Packages/FindZZip.cmake
+++ b/CMake/Packages/FindZZip.cmake
@@ -39,12 +39,12 @@ use_pkgconfig(ZZip_PKGC zziplib)
 
 findpkg_framework(ZZip)
 
-find_path(ZZip_INCLUDE_DIR NAMES zzip/zzip.h HINTS ${ZZip_INC_SEARCH_PATH} ${ZZip_PKGC_INCLUDE_DIRS})
+find_path(ZZip_INCLUDE_DIRS NAMES zzip/zzip.h HINTS ${ZZip_INC_SEARCH_PATH} ${ZZip_PKGC_INCLUDE_DIRS})
 
 find_library(ZZip_LIBRARY_REL NAMES ${ZZip_LIBRARY_NAMES} HINTS ${ZZip_LIB_SEARCH_PATH} ${ZZip_PKGC_LIBRARY_DIRS} PATH_SUFFIXES "" Release RelWithDebInfo MinSizeRel)
 find_library(ZZip_LIBRARY_DBG NAMES ${ZZip_LIBRARY_NAMES_DBG} HINTS ${ZZip_LIB_SEARCH_PATH} ${ZZip_PKGC_LIBRARY_DIRS} PATH_SUFFIXES "" Debug)
 
-make_library_set(ZZip_LIBRARY)
+make_library_set(ZZip)
 
 findpkg_finish(ZZip)
 
diff --git a/CMake/Utils/FindPkgMacros.cmake b/CMake/Utils/FindPkgMacros.cmake
index 53111e0..8dffbbc 100644
--- a/CMake/Utils/FindPkgMacros.cmake
+++ b/CMake/Utils/FindPkgMacros.cmake
@@ -79,15 +79,21 @@ endmacro (use_pkgconfig)
 
 # Couple a set of release AND debug libraries (or frameworks)
 macro(make_library_set PREFIX)
-  if (${PREFIX}_FWK)
-    set(${PREFIX} ${${PREFIX}_FWK})
-  elseif (${PREFIX}_REL AND ${PREFIX}_DBG)
-    set(${PREFIX} optimized ${${PREFIX}_REL} debug ${${PREFIX}_DBG})
-  elseif (${PREFIX}_REL)
-    set(${PREFIX} ${${PREFIX}_REL})
-  elseif (${PREFIX}_DBG)
-    set(${PREFIX} ${${PREFIX}_DBG})
-  endif ()
+  include(${CMAKE_ROOT}/Modules/SelectLibraryConfigurations.cmake)
+  set(PREFIX_LIB "${PREFIX}_LIBRARY")
+  if (${PREFIX_LIB}_FWK)
+    set(${PREFIX_LIB} ${${PREFIX_LIB}_FWK})
+  elseif (${PREFIX_LIB}_REL AND ${PREFIX_LIB}_DBG)
+    set(${PREFIX_LIB}_RELEASE ${${PREFIX_LIB}_REL} CACHE STRING "")
+    set(${PREFIX_LIB}_DEBUG ${${PREFIX_LIB}_DBG} CACHE STRING "")
+    select_library_configurations(${PREFIX})
+  elseif (${PREFIX_LIB}_REL)
+    set(${PREFIX_LIB} ${${PREFIX_LIB}_REL})
+    set(${PREFIX_LIB}_RELEASE ${${PREFIX_LIB}_REL})
+  elseif (${PREFIX_LIB}_DBG)
+    set(${PREFIX_LIB} ${${PREFIX_LIB}_DBG})
+    set(${PREFIX_LIB}_DEBUG ${${PREFIX_LIB}_DBG})
+  endif()
 endmacro(make_library_set)
 
 # Generate debug names from given release names
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 48af55b..b18ac57 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -282,7 +282,7 @@ if (OGRE_BUILD_PLATFORM_APPLE_IOS)
 
   # Set build variables
   set(XCODE_ATTRIBUTE_SDKROOT iphoneos)
-  if(CMAKE_GENERATOR STREQUAL "Unix Makefiles")
+  if(1)
     execute_process(COMMAND xcodebuild -version -sdk "${XCODE_ATTRIBUTE_SDKROOT}" Path | head -n 1 OUTPUT_VARIABLE CMAKE_OSX_SYSROOT)
     string(REGEX REPLACE "(\r?\n)+$" "" CMAKE_OSX_SYSROOT "${CMAKE_OSX_SYSROOT}")
   else()
diff --git a/OgreMain/CMakeLists.txt b/OgreMain/CMakeLists.txt
index 0424ebb..b019269 100644
--- a/OgreMain/CMakeLists.txt
+++ b/OgreMain/CMakeLists.txt
@@ -434,8 +434,6 @@ if (APPLE)
     set_target_properties(OgreMain PROPERTIES
         LINK_FLAGS "-framework IOKit -framework Cocoa -framework Carbon -framework OpenGL -framework CoreVideo"
     )
-
-    set(OGRE_OSX_BUILD_CONFIGURATION "$(PLATFORM_NAME)/$(CONFIGURATION)")
   
   	add_custom_command(TARGET OgreMain POST_BUILD
 		COMMAND mkdir ARGS -p ${OGRE_BINARY_DIR}/lib/${OGRE_OSX_BUILD_CONFIGURATION}/Ogre.framework/Headers/Threading