# HG changeset patch
# User koda
# Date 1388264457 -3600
# Node ID d419ff107e15ce6a25083c001457489502a9472a
# Parent  343d121720708f10f5281721a6a9994103be66d6
include paths before platform, move config code around

diff -r 343d12172070 -r d419ff107e15 CMakeLists.txt
--- a/CMakeLists.txt	Sat Dec 28 21:53:17 2013 +0100
+++ b/CMakeLists.txt	Sat Dec 28 22:00:57 2013 +0100
@@ -51,9 +51,10 @@
 
 #general utilities
 include(${CMAKE_MODULE_PATH}/utils.cmake)
+#paths initialization
+include(${CMAKE_MODULE_PATH}/paths.cmake)
 #platform specific init code
 include(${CMAKE_MODULE_PATH}/platform.cmake)
-include(${CMAKE_MODULE_PATH}/paths.cmake)
 
 
 #when build type is not specified, assume Debug/Release according to build version information
diff -r 343d12172070 -r d419ff107e15 cmake_modules/paths.cmake
--- a/cmake_modules/paths.cmake	Sat Dec 28 21:53:17 2013 +0100
+++ b/cmake_modules/paths.cmake	Sat Dec 28 22:00:57 2013 +0100
@@ -56,13 +56,10 @@
 set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
 
 if(APPLE)
+    #@rpath mangling
     set(CMAKE_INSTALL_RPATH "@executable_path/../Frameworks")
-    #workaround older cmake versions
-    if(${CMAKE_VERSION} VERSION_LESS "2.8.12")
-        add_flag_append(CMAKE_C_LINK_FLAGS "-Wl,-rpath -Wl,${CMAKE_INSTALL_RPATH}")
-        add_flag_append(CMAKE_CXX_LINK_FLAGS "-Wl,-rpath -Wl,${CMAKE_INSTALL_RPATH}")
-        add_flag_append(CMAKE_Pascal_LINK_FLAGS "-k-rpath -k${CMAKE_INSTALL_RPATH}")
-    endif()
+    #install_name_tool for libraries
+    set(CMAKE_INSTALL_NAME_DIR "@executable_path/../Frameworks")
 else(APPLE)
     #paths where to find libraries (final slash not optional):
     # - the first is relative to the executable
@@ -71,7 +68,3 @@
     #source http://www.cmake.org/pipermail/cmake/2008-January/019290.html
     set(CMAKE_INSTALL_RPATH "$ORIGIN/../${target_library_install_dir}/:$ORIGIN/:${CMAKE_INSTALL_PREFIX}/${target_library_install_dir}/")
 endif(APPLE)
-
-#install_name_tool magic for OS X
-set(CMAKE_INSTALL_NAME_DIR "@executable_path/../Frameworks")
-
diff -r 343d12172070 -r d419ff107e15 cmake_modules/platform.cmake
--- a/cmake_modules/platform.cmake	Sat Dec 28 21:53:17 2013 +0100
+++ b/cmake_modules/platform.cmake	Sat Dec 28 22:00:57 2013 +0100
@@ -82,6 +82,13 @@
 
     #add user framework directory
     add_flag_append(CMAKE_Pascal_FLAGS "-Ff~/Library/Frameworks")
+
+    #workaround older cmake versions
+    if(${CMAKE_VERSION} VERSION_LESS "2.8.12")
+        add_flag_append(CMAKE_C_LINK_FLAGS "-Wl,-rpath -Wl,${CMAKE_INSTALL_RPATH}")
+        add_flag_append(CMAKE_CXX_LINK_FLAGS "-Wl,-rpath -Wl,${CMAKE_INSTALL_RPATH}")
+        add_flag_append(CMAKE_Pascal_LINK_FLAGS "-k-rpath -k${CMAKE_INSTALL_RPATH}")
+    endif()
 endif(APPLE)
 
 if(MINGW)