Browse Source

Replace with a more proper derived CMake variable for easier maint.
Add short comment on the intent of setting up RPATH.

Yao Wei Tjong 姚伟忠 11 years ago
parent
commit
f7329aa83f
1 changed files with 6 additions and 1 deletions
  1. 6 1
      Source/CMakeLists.txt

+ 6 - 1
Source/CMakeLists.txt

@@ -129,13 +129,18 @@ include (CPack)
 if (NOT WIN32)
     if (APPLE AND (CMAKE_VERSION VERSION_GREATER 2.8.12 OR CMAKE_VERSION VERSION_EQUAL 2.8.12))
         set (CMAKE_MACOSX_RPATH TRUE)
+        # Note for older version CMake users, you may need to use DYLD_LIBRARY_PATH environment variable to specify the path where Urho3D shared library is being installed
+        # when attempting to execute the samples or tools installed by Urho3D SDK with SHARED lib type
     endif ()
     set (CMAKE_SKIP_BUILD_RPATH FALSE)
     set (CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
     set (CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
     list (FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX} isSystemDir)
     if (isSystemDir STREQUAL -1)
-        set (CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}${PATH_SUFFIX})
+        # If SDK installation location is not in the system default search paths then add the library installation location to target's RPATH
+        set (CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/${DEST_LIBRARY_DIR})
+        # Note for Linux users, you should not need to use LD_LIBRARY_PATH environment variable pointing to Urho3D shared library path anymore when executing installed targets
+        # even when the shared library is installed on a non-default installation location
     endif ()
 endif ()