summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Tests/CMakeLists.txt57
-rw-r--r--Tests/Dependency/CMakeLists.txt5
-rw-r--r--Tests/Dependency/Case1/CMakeLists.txt19
-rw-r--r--Tests/Dependency/Case1/a.c5
-rw-r--r--Tests/Dependency/Case1/b.c6
-rw-r--r--Tests/Dependency/Case1/b2.c4
-rw-r--r--Tests/Dependency/Case1/c.c6
-rw-r--r--Tests/Dependency/Case1/c2.c6
-rw-r--r--Tests/Dependency/Case1/d.c7
-rw-r--r--Tests/Dependency/Case1/main.c10
-rw-r--r--Tests/Dependency/Case2/CMakeLists.txt20
-rw-r--r--Tests/Dependency/Case2/bar1.c4
-rw-r--r--Tests/Dependency/Case2/bar2.c2
-rw-r--r--Tests/Dependency/Case2/bar3.c2
-rw-r--r--Tests/Dependency/Case2/foo1.c3
-rw-r--r--Tests/Dependency/Case2/foo2.c2
-rw-r--r--Tests/Dependency/Case2/foo3.c2
-rw-r--r--Tests/Dependency/Case2/zot.c5
18 files changed, 111 insertions, 54 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 8fc850f..895579c 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -418,68 +418,17 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=CVS -P ${CMake_SOURCE_DIR}/Utilities/Rel
--test-command TestDriverTest subdir/test3
)
- ADD_TEST(dependency_w_libout ${CMAKE_CTEST_COMMAND}
+ ADD_TEST(Dependency ${CMAKE_CTEST_COMMAND}
--build-and-test
"${CMake_SOURCE_DIR}/Tests/Dependency"
- "${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut"
- --build-exe-dir "${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut/Exec"
- --build-project Dependency
- --build-generator ${CMAKE_TEST_GENERATOR}
- --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
- --build-options
- -DLIBRARY_OUTPUT_PATH:PATH=${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut/Lib
- --test-command exec
- )
-
- ADD_TEST(dependency_wo_lib_out ${CMAKE_CTEST_COMMAND}
- --build-and-test
- "${CMake_SOURCE_DIR}/Tests/Dependency"
- "${CMake_BINARY_DIR}/Tests/Dependency/WOLibOut"
- --build-exe-dir "${CMake_BINARY_DIR}/Tests/Dependency/WOLibOut/Exec"
+ "${CMake_BINARY_DIR}/Tests/Dependency"
+ --build-exe-dir "${CMake_BINARY_DIR}/Tests/Dependency/Exec"
--build-generator ${CMAKE_TEST_GENERATOR}
--build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
--build-project Dependency
--test-command exec
)
- ADD_TEST(dependency2 ${CMAKE_CTEST_COMMAND}
- --build-and-test
- "${CMake_SOURCE_DIR}/Tests/Dependency"
- "${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut"
- --build-exe-dir "${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut/Exec2"
- --build-generator ${CMAKE_TEST_GENERATOR}
- --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
- --build-project Dependency
- --build-options
- -DLIBRARY_OUTPUT_PATH:PATH=${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut/Lib
- --test-command exec2
- )
-
- ADD_TEST(dependency3 ${CMAKE_CTEST_COMMAND}
- --build-and-test
- "${CMake_SOURCE_DIR}/Tests/Dependency"
- "${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut"
- --build-exe-dir "${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut/Exec3"
- --build-generator ${CMAKE_TEST_GENERATOR}
- --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
- --build-project Dependency
- --build-options
- -DLIBRARY_OUTPUT_PATH:PATH=${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut/Lib
- --test-command exec3)
-
- ADD_TEST(dependency4 ${CMAKE_CTEST_COMMAND}
- --build-and-test
- "${CMake_SOURCE_DIR}/Tests/Dependency"
- "${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut"
- --build-exe-dir "${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut/Exec4"
- --build-generator ${CMAKE_TEST_GENERATOR}
- --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
- --build-project Dependency
- --build-options
- -DLIBRARY_OUTPUT_PATH:PATH=${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut/Lib
- --test-command exec4
- )
-
IF("${CMAKE_SYSTEM_NAME}" MATCHES syllable)
# RPATH isn't supported under Syllable, so the tests don't
diff --git a/Tests/Dependency/CMakeLists.txt b/Tests/Dependency/CMakeLists.txt
index 49bf88c..ddb9112 100644
--- a/Tests/Dependency/CMakeLists.txt
+++ b/Tests/Dependency/CMakeLists.txt
@@ -43,3 +43,8 @@ ADD_SUBDIRECTORY(Exec)
ADD_SUBDIRECTORY(Exec2)
ADD_SUBDIRECTORY(Exec3)
ADD_SUBDIRECTORY(Exec4)
+
+# Specific cases added to test fixes to problems found in real
+# projects.
+ADD_SUBDIRECTORY(Case1)
+ADD_SUBDIRECTORY(Case2)
diff --git a/Tests/Dependency/Case1/CMakeLists.txt b/Tests/Dependency/Case1/CMakeLists.txt
new file mode 100644
index 0000000..4c5fc20
--- /dev/null
+++ b/Tests/Dependency/Case1/CMakeLists.txt
@@ -0,0 +1,19 @@
+project(CASE1)
+
+# The old anaylize lib depends stuff in cmTarget gets this case wrong.
+# The cmComputeLinkDepends implementation gets it right.
+
+add_library(case1a STATIC a.c)
+
+add_library(case1b STATIC b.c b2.c)
+target_link_libraries(case1b case1a)
+
+add_library(case1c STATIC c.c c2.c)
+target_link_libraries(case1c case1b)
+
+add_library(case1d STATIC d.c)
+target_link_libraries(case1d case1c)
+
+add_executable(hello main.c)
+target_link_libraries(hello case1c case1b case1d case1c)
+
diff --git a/Tests/Dependency/Case1/a.c b/Tests/Dependency/Case1/a.c
new file mode 100644
index 0000000..d702db1
--- /dev/null
+++ b/Tests/Dependency/Case1/a.c
@@ -0,0 +1,5 @@
+int a()
+{
+ return 5;
+}
+
diff --git a/Tests/Dependency/Case1/b.c b/Tests/Dependency/Case1/b.c
new file mode 100644
index 0000000..6bdfafa
--- /dev/null
+++ b/Tests/Dependency/Case1/b.c
@@ -0,0 +1,6 @@
+extern int a();
+
+int b()
+{
+ return a()+17;
+}
diff --git a/Tests/Dependency/Case1/b2.c b/Tests/Dependency/Case1/b2.c
new file mode 100644
index 0000000..f37e1bb
--- /dev/null
+++ b/Tests/Dependency/Case1/b2.c
@@ -0,0 +1,4 @@
+int b2()
+{
+ return 3;
+}
diff --git a/Tests/Dependency/Case1/c.c b/Tests/Dependency/Case1/c.c
new file mode 100644
index 0000000..c180a59
--- /dev/null
+++ b/Tests/Dependency/Case1/c.c
@@ -0,0 +1,6 @@
+extern int b();
+
+int c()
+{
+ return b()+42;
+}
diff --git a/Tests/Dependency/Case1/c2.c b/Tests/Dependency/Case1/c2.c
new file mode 100644
index 0000000..4cf4426
--- /dev/null
+++ b/Tests/Dependency/Case1/c2.c
@@ -0,0 +1,6 @@
+extern int b2();
+
+int c2()
+{
+ return b2()+1;
+}
diff --git a/Tests/Dependency/Case1/d.c b/Tests/Dependency/Case1/d.c
new file mode 100644
index 0000000..ea5457d
--- /dev/null
+++ b/Tests/Dependency/Case1/d.c
@@ -0,0 +1,7 @@
+extern int c2();
+
+int d()
+{
+ return c2()+2;
+}
+
diff --git a/Tests/Dependency/Case1/main.c b/Tests/Dependency/Case1/main.c
new file mode 100644
index 0000000..1e5f6d4
--- /dev/null
+++ b/Tests/Dependency/Case1/main.c
@@ -0,0 +1,10 @@
+extern int b();
+extern int c();
+extern int d();
+
+int main()
+{
+ c();
+ b();
+ d();
+}
diff --git a/Tests/Dependency/Case2/CMakeLists.txt b/Tests/Dependency/Case2/CMakeLists.txt
new file mode 100644
index 0000000..764338e
--- /dev/null
+++ b/Tests/Dependency/Case2/CMakeLists.txt
@@ -0,0 +1,20 @@
+project(CASE2 C)
+
+add_library(case2Foo1 STATIC foo1.c)
+add_library(case2Foo2 STATIC foo2.c)
+add_library(case2Foo3 STATIC foo3.c)
+target_link_libraries(case2Foo1 case2Foo2)
+target_link_libraries(case2Foo2 case2Foo3)
+target_link_libraries(case2Foo3 case2Foo1)
+
+add_library(case2Bar1 STATIC bar1.c)
+add_library(case2Bar2 STATIC bar2.c)
+add_library(case2Bar3 STATIC bar3.c)
+target_link_libraries(case2Bar1 case2Bar2 case2Foo1)
+target_link_libraries(case2Bar2 case2Bar3)
+target_link_libraries(case2Bar3 case2Bar1)
+
+add_executable(case2Zot zot.c)
+target_link_libraries(case2Zot case2Bar1)
+
+#set_property(GLOBAL PROPERTY GLOBAL_DEPENDS_DEBUG_MODE 1)
diff --git a/Tests/Dependency/Case2/bar1.c b/Tests/Dependency/Case2/bar1.c
new file mode 100644
index 0000000..6108fba
--- /dev/null
+++ b/Tests/Dependency/Case2/bar1.c
@@ -0,0 +1,4 @@
+extern int foo1();
+extern int bar2(void);
+int bar1(void) { return bar2(); }
+int bar1_from_bar3(void) { return foo1(); }
diff --git a/Tests/Dependency/Case2/bar2.c b/Tests/Dependency/Case2/bar2.c
new file mode 100644
index 0000000..b9a2360
--- /dev/null
+++ b/Tests/Dependency/Case2/bar2.c
@@ -0,0 +1,2 @@
+extern int bar3(void);
+int bar2(void) { return bar3(); }
diff --git a/Tests/Dependency/Case2/bar3.c b/Tests/Dependency/Case2/bar3.c
new file mode 100644
index 0000000..73e8556
--- /dev/null
+++ b/Tests/Dependency/Case2/bar3.c
@@ -0,0 +1,2 @@
+extern int bar1_from_bar3(void);
+int bar3(void) { return bar1_from_bar3(); }
diff --git a/Tests/Dependency/Case2/foo1.c b/Tests/Dependency/Case2/foo1.c
new file mode 100644
index 0000000..0dbf426
--- /dev/null
+++ b/Tests/Dependency/Case2/foo1.c
@@ -0,0 +1,3 @@
+extern int foo2(void);
+int foo1(void) { return foo2(); }
+int foo1_from_foo3(void) { return 0; }
diff --git a/Tests/Dependency/Case2/foo2.c b/Tests/Dependency/Case2/foo2.c
new file mode 100644
index 0000000..6019236
--- /dev/null
+++ b/Tests/Dependency/Case2/foo2.c
@@ -0,0 +1,2 @@
+extern int foo3(void);
+int foo2(void) { return foo3(); }
diff --git a/Tests/Dependency/Case2/foo3.c b/Tests/Dependency/Case2/foo3.c
new file mode 100644
index 0000000..eb5bd0f
--- /dev/null
+++ b/Tests/Dependency/Case2/foo3.c
@@ -0,0 +1,2 @@
+extern int foo1_from_foo3(void);
+int foo3(void) { return foo1_from_foo3(); }
diff --git a/Tests/Dependency/Case2/zot.c b/Tests/Dependency/Case2/zot.c
new file mode 100644
index 0000000..f25b493
--- /dev/null
+++ b/Tests/Dependency/Case2/zot.c
@@ -0,0 +1,5 @@
+extern int bar1(void);
+int main(void)
+{
+ return bar1();
+}