summaryrefslogtreecommitdiffstats
path: root/Tests/Dependency
diff options
context:
space:
mode:
authorAmitha Perera <perera@cs.rpi.edu>2002-05-10 17:35:42 (GMT)
committerAmitha Perera <perera@cs.rpi.edu>2002-05-10 17:35:42 (GMT)
commit0e6b39e52f561228e3e17bafe4bc7a44da88bf00 (patch)
tree565638d08eebd83d40cc7ff387b0bbc0994729f8 /Tests/Dependency
parent6b08b83d892672f0a5849af71441cb06dc2b45e8 (diff)
downloadCMake-0e6b39e52f561228e3e17bafe4bc7a44da88bf00.zip
CMake-0e6b39e52f561228e3e17bafe4bc7a44da88bf00.tar.gz
CMake-0e6b39e52f561228e3e17bafe4bc7a44da88bf00.tar.bz2
BUG: Correct some of the dependency analysis code.
- Make sure the original link line is untouched - Avoid duplicating the link line when supporting version < 1.4 - Make sure the cyclic dependencies and such are output correctly in complicated cases. - Avoid outputing dependencies that are already satisfied on the original link line when possible.
Diffstat (limited to 'Tests/Dependency')
-rw-r--r--Tests/Dependency/CMakeLists.txt29
-rw-r--r--Tests/Dependency/Eight/CMakeLists.txt3
-rw-r--r--Tests/Dependency/Eight/EightSrc.c6
-rw-r--r--Tests/Dependency/Exec2/CMakeLists.txt12
-rw-r--r--Tests/Dependency/Exec2/ExecMain.c14
-rw-r--r--Tests/Dependency/Exec3/CMakeLists.txt6
-rw-r--r--Tests/Dependency/Exec3/ExecMain.c14
-rw-r--r--Tests/Dependency/Exec4/CMakeLists.txt6
-rw-r--r--Tests/Dependency/Exec4/ExecMain.c14
-rw-r--r--Tests/Dependency/Seven/CMakeLists.txt3
-rw-r--r--Tests/Dependency/Seven/SevenSrc.c6
11 files changed, 93 insertions, 20 deletions
diff --git a/Tests/Dependency/CMakeLists.txt b/Tests/Dependency/CMakeLists.txt
index b7debc6..724f109 100644
--- a/Tests/Dependency/CMakeLists.txt
+++ b/Tests/Dependency/CMakeLists.txt
@@ -3,23 +3,6 @@ PROJECT( Dependency )
# There is one executable that depends on eight libraries. The
# system has the following dependency graph:
#
-# +----------- NoDepC <---- EXECUTABLE ---+
-# | | | |
-# V | | |
-# | | |
-# NoDepA <----- NoDepB <-------+ | |
-# | |
-# ^ | V
-# | |
-# One <------ Four -----> Two <----- Five <---|----- SixB
-# | | |
-# ^ ^ ^ | ^ ^ | |
-# | | +-----+ | \ | | |
-# | | | | \ | | |
-# +--------- Three <------+ --- SixA <----+ |
-# | |
-# | |
-# +---------------------------------+
# NoDepA:
# NoDepB: NoDepA
# NoDepC: NoDepA
@@ -30,14 +13,20 @@ PROJECT( Dependency )
# Five: Two
# SixA: Two Five
# SixB: Four Five
+# Seven: Two
+# Eight: Seven
+#
# Exec: NoDepB NoDepC SixA SixB
+# Exec2: Eight Five
+# Exec3: Eight Five
+# Exec4: Five Two
#
-# The libraries One,...,Five have their dependencies explicitly
+# The libraries One,...,Eight have their dependencies explicitly
# encoded. The libraries NoDepA,...,NoDepC do not.
#
# Although SixB does not depend on Two, there is a dependency listed
# in the corresponding CMakeLists.txt just because of commands used.
SUBDIRS( NoDepA NoDepB NoDepC )
-SUBDIRS( One Two Three Four Five Six )
-SUBDIRS( Exec )
+SUBDIRS( One Two Three Four Five Six Seven Eight )
+SUBDIRS( Exec Exec2 Exec3 Exec4 )
diff --git a/Tests/Dependency/Eight/CMakeLists.txt b/Tests/Dependency/Eight/CMakeLists.txt
new file mode 100644
index 0000000..5d8e756
--- /dev/null
+++ b/Tests/Dependency/Eight/CMakeLists.txt
@@ -0,0 +1,3 @@
+ADD_LIBRARY( Eight EightSrc.c )
+TARGET_LINK_LIBRARIES( Eight Seven )
+
diff --git a/Tests/Dependency/Eight/EightSrc.c b/Tests/Dependency/Eight/EightSrc.c
new file mode 100644
index 0000000..7bfa481
--- /dev/null
+++ b/Tests/Dependency/Eight/EightSrc.c
@@ -0,0 +1,6 @@
+void SevenFunction();
+
+void EightFunction()
+{
+ SevenFunction();
+}
diff --git a/Tests/Dependency/Exec2/CMakeLists.txt b/Tests/Dependency/Exec2/CMakeLists.txt
new file mode 100644
index 0000000..ee0c74d
--- /dev/null
+++ b/Tests/Dependency/Exec2/CMakeLists.txt
@@ -0,0 +1,12 @@
+# Here, Eight depends on Seven, which has the same dependencies as Five.
+# If the dependencies of Five are emitted, and then we attempt to emit the
+# dependencies of Seven, then we find that they have already been done. So:
+# Original line: Eight Five
+# Add deps of Five: Eight Five Two ... NoDepA
+# Now, we must make sure that Seven gets inserted between Five and Two, and
+# not at the end. Unfortunately, if we get it wrong, the test will only
+# fail on a platform where the link order makes a difference.
+LINK_LIBRARIES( Eight Five )
+
+ADD_EXECUTABLE( exec2 ExecMain.c )
+
diff --git a/Tests/Dependency/Exec2/ExecMain.c b/Tests/Dependency/Exec2/ExecMain.c
new file mode 100644
index 0000000..d08a796
--- /dev/null
+++ b/Tests/Dependency/Exec2/ExecMain.c
@@ -0,0 +1,14 @@
+#include <stdio.h>
+
+void FiveFunction();
+void EightFunction();
+
+int main( )
+{
+ FiveFunction();
+ EightFunction();
+
+ printf("Dependency test executable ran successfully.\n");
+
+ return 0;
+}
diff --git a/Tests/Dependency/Exec3/CMakeLists.txt b/Tests/Dependency/Exec3/CMakeLists.txt
new file mode 100644
index 0000000..b33e732
--- /dev/null
+++ b/Tests/Dependency/Exec3/CMakeLists.txt
@@ -0,0 +1,6 @@
+# Here, Five already has it's immediate dependency, Two satisfied. We must
+# make sure Two gets output anyway, because Eight indirectly depends on it.
+LINK_LIBRARIES( Five Two Eight Five )
+
+ADD_EXECUTABLE( exec3 ExecMain.c )
+
diff --git a/Tests/Dependency/Exec3/ExecMain.c b/Tests/Dependency/Exec3/ExecMain.c
new file mode 100644
index 0000000..d08a796
--- /dev/null
+++ b/Tests/Dependency/Exec3/ExecMain.c
@@ -0,0 +1,14 @@
+#include <stdio.h>
+
+void FiveFunction();
+void EightFunction();
+
+int main( )
+{
+ FiveFunction();
+ EightFunction();
+
+ printf("Dependency test executable ran successfully.\n");
+
+ return 0;
+}
diff --git a/Tests/Dependency/Exec4/CMakeLists.txt b/Tests/Dependency/Exec4/CMakeLists.txt
new file mode 100644
index 0000000..6fcb153
--- /dev/null
+++ b/Tests/Dependency/Exec4/CMakeLists.txt
@@ -0,0 +1,6 @@
+# Even though Five's dependency on Two is explicitly satisfied, Two
+# must be emitted again in order to satisfy a cyclic dependency on Three.
+LINK_LIBRARIES( Five Two Five )
+
+ADD_EXECUTABLE( exec4 ExecMain.c )
+
diff --git a/Tests/Dependency/Exec4/ExecMain.c b/Tests/Dependency/Exec4/ExecMain.c
new file mode 100644
index 0000000..3f53573
--- /dev/null
+++ b/Tests/Dependency/Exec4/ExecMain.c
@@ -0,0 +1,14 @@
+#include <stdio.h>
+
+void FiveFunction();
+void TwoFunction();
+
+int main( )
+{
+ FiveFunction();
+ TwoFunction();
+
+ printf("Dependency test executable ran successfully.\n");
+
+ return 0;
+}
diff --git a/Tests/Dependency/Seven/CMakeLists.txt b/Tests/Dependency/Seven/CMakeLists.txt
new file mode 100644
index 0000000..51a38d8
--- /dev/null
+++ b/Tests/Dependency/Seven/CMakeLists.txt
@@ -0,0 +1,3 @@
+ADD_LIBRARY( Seven SevenSrc.c )
+TARGET_LINK_LIBRARIES( Seven Two )
+
diff --git a/Tests/Dependency/Seven/SevenSrc.c b/Tests/Dependency/Seven/SevenSrc.c
new file mode 100644
index 0000000..e1f3329
--- /dev/null
+++ b/Tests/Dependency/Seven/SevenSrc.c
@@ -0,0 +1,6 @@
+void TwoFunction();
+
+void SevenFunction()
+{
+ TwoFunction();
+}