Linux/ARM: Adding rpath for shared library of exception_handling.pal_sxs.test1 (...
authorGeunsik Lim <leemgs@users.noreply.github.com>
Sat, 4 Jun 2016 15:07:05 +0000 (00:07 +0900)
committerJan Kotas <jkotas@microsoft.com>
Sat, 4 Jun 2016 15:07:05 +0000 (08:07 -0700)
Let's add the 'rpath' in order to fix error happened while
'paltest_pal_sxs_test1' (ELF) of PAL test is loading a shared library.
This 'rpath' statement is derived from the existing files such as
./ToolBox/SOS/Strike/CMakeLists.txt and dlls/mscordbi/CMakeLists.txt.

Ver2:
Apply 'rpath' in case of the Linux platform only

Ver1:
Let's add 'rpath' statement to the Linux platform environment
that we have experienced issue.

Signed-off-by: Geunsik Lim <geunsik.lim@samsung.com>
CC: Mike McLaughlin <mikem@microsoft.com>
src/pal/tests/palsuite/exception_handling/pal_sxs/test1/CMakeLists.txt

index 06d4616abaab19ef3a523765acd16a9dd51e7f9d..b0458db998354312b1f65328b166ff187b79a8b2 100644 (file)
@@ -7,6 +7,15 @@ if(CLR_CMAKE_PLATFORM_UNIX)
     add_definitions(-DFEATURE_ENABLE_HARDWARE_EXCEPTIONS)
 endif(CLR_CMAKE_PLATFORM_UNIX)
 
+# Set the RPATH of paltest_pal_sxs_test1 so that it can find dependencies without needing to set LD_LIBRARY
+# For more information: http://www.cmake.org/Wiki/CMake_RPATH_handling.
+if(CORECLR_SET_RPATH)
+  if(CLR_CMAKE_PLATFORM_LINUX)
+    set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
+    set(CMAKE_INSTALL_RPATH "\$ORIGIN")
+  endif(CLR_CMAKE_PLATFORM_LINUX)
+endif(CORECLR_SET_RPATH)
+
 # Test DLL1
 
 set(DEF_SOURCES1 dlltest1.src)