summaryrefslogtreecommitdiff
path: root/Tests/RuntimePath
diff options
context:
space:
mode:
authorAnas Nashif <anas.nashif@intel.com>2012-10-30 15:39:57 -0700
committerAnas Nashif <anas.nashif@intel.com>2012-10-30 15:39:57 -0700
commit035c7fabc3b82cbc9a346c11abe2e9462b4c0379 (patch)
tree7e40f5a790eae329a8c5d3e59f046451767956ff /Tests/RuntimePath
downloadcmake-035c7fabc3b82cbc9a346c11abe2e9462b4c0379.tar.gz
cmake-035c7fabc3b82cbc9a346c11abe2e9462b4c0379.tar.bz2
cmake-035c7fabc3b82cbc9a346c11abe2e9462b4c0379.zip
Imported Upstream version 2.8.9upstream/2.8.9
Diffstat (limited to 'Tests/RuntimePath')
-rw-r--r--Tests/RuntimePath/CMakeLists.txt33
-rw-r--r--Tests/RuntimePath/bar1.c2
-rw-r--r--Tests/RuntimePath/bar2.c2
-rw-r--r--Tests/RuntimePath/foo1.c1
-rw-r--r--Tests/RuntimePath/foo2.c1
-rw-r--r--Tests/RuntimePath/main.c5
6 files changed, 44 insertions, 0 deletions
diff --git a/Tests/RuntimePath/CMakeLists.txt b/Tests/RuntimePath/CMakeLists.txt
new file mode 100644
index 000000000..2164cdb8d
--- /dev/null
+++ b/Tests/RuntimePath/CMakeLists.txt
@@ -0,0 +1,33 @@
+cmake_minimum_required (VERSION 2.6)
+project(RuntimePath C)
+
+# Add a simple chain of shared libraries that must be found.
+add_library(foo1 SHARED foo1.c)
+set_property(TARGET foo1 PROPERTY OUTPUT_NAME foo)
+set_property(TARGET foo1 PROPERTY LIBRARY_OUTPUT_DIRECTORY A)
+
+add_library(bar1 SHARED bar1.c)
+set_property(TARGET bar1 PROPERTY OUTPUT_NAME bar)
+set_property(TARGET bar1 PROPERTY VERSION 1)
+set_property(TARGET bar1 PROPERTY LIBRARY_OUTPUT_DIRECTORY B)
+target_link_libraries(bar1 foo1)
+
+add_executable(RuntimePath main.c)
+target_link_libraries(RuntimePath bar1)
+
+# Add a library that provides a conflicting location to make sure
+# rpath ordering works.
+add_library(foo2 SHARED foo2.c)
+set_property(TARGET foo2 PROPERTY OUTPUT_NAME foo)
+set_property(TARGET foo2 PROPERTY LIBRARY_OUTPUT_DIRECTORY B)
+
+# Add a library that would provide a conflicting location if not for
+# soname analysis in rpath ordering. This will also break the old
+# link directory ordering to make sure files are linked with full
+# paths.
+if(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG)
+ add_library(bar2 SHARED bar2.c)
+ set_property(TARGET bar2 PROPERTY OUTPUT_NAME bar)
+ set_property(TARGET bar2 PROPERTY LIBRARY_OUTPUT_DIRECTORY A)
+ target_link_libraries(bar2 foo2)
+endif(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG)
diff --git a/Tests/RuntimePath/bar1.c b/Tests/RuntimePath/bar1.c
new file mode 100644
index 000000000..ebad8d20c
--- /dev/null
+++ b/Tests/RuntimePath/bar1.c
@@ -0,0 +1,2 @@
+extern int foo1();
+int bar1() { return foo1(); }
diff --git a/Tests/RuntimePath/bar2.c b/Tests/RuntimePath/bar2.c
new file mode 100644
index 000000000..60d5e686a
--- /dev/null
+++ b/Tests/RuntimePath/bar2.c
@@ -0,0 +1,2 @@
+extern int foo2();
+int bar2() { return foo2(); }
diff --git a/Tests/RuntimePath/foo1.c b/Tests/RuntimePath/foo1.c
new file mode 100644
index 000000000..27cd9125b
--- /dev/null
+++ b/Tests/RuntimePath/foo1.c
@@ -0,0 +1 @@
+int foo1() { return 0; }
diff --git a/Tests/RuntimePath/foo2.c b/Tests/RuntimePath/foo2.c
new file mode 100644
index 000000000..40b4f56a9
--- /dev/null
+++ b/Tests/RuntimePath/foo2.c
@@ -0,0 +1 @@
+int foo2() { return 0; }
diff --git a/Tests/RuntimePath/main.c b/Tests/RuntimePath/main.c
new file mode 100644
index 000000000..c71ee0639
--- /dev/null
+++ b/Tests/RuntimePath/main.c
@@ -0,0 +1,5 @@
+extern int bar1();
+int main()
+{
+ return bar1();
+}