diff options
author | Amitha Perera <perera@cs.rpi.edu> | 2002-05-10 17:35:42 (GMT) |
---|---|---|
committer | Amitha Perera <perera@cs.rpi.edu> | 2002-05-10 17:35:42 (GMT) |
commit | 0e6b39e52f561228e3e17bafe4bc7a44da88bf00 (patch) | |
tree | 565638d08eebd83d40cc7ff387b0bbc0994729f8 /Tests | |
parent | 6b08b83d892672f0a5849af71441cb06dc2b45e8 (diff) | |
download | CMake-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')
-rw-r--r-- | Tests/Dependency/CMakeLists.txt | 29 | ||||
-rw-r--r-- | Tests/Dependency/Eight/CMakeLists.txt | 3 | ||||
-rw-r--r-- | Tests/Dependency/Eight/EightSrc.c | 6 | ||||
-rw-r--r-- | Tests/Dependency/Exec2/CMakeLists.txt | 12 | ||||
-rw-r--r-- | Tests/Dependency/Exec2/ExecMain.c | 14 | ||||
-rw-r--r-- | Tests/Dependency/Exec3/CMakeLists.txt | 6 | ||||
-rw-r--r-- | Tests/Dependency/Exec3/ExecMain.c | 14 | ||||
-rw-r--r-- | Tests/Dependency/Exec4/CMakeLists.txt | 6 | ||||
-rw-r--r-- | Tests/Dependency/Exec4/ExecMain.c | 14 | ||||
-rw-r--r-- | Tests/Dependency/Seven/CMakeLists.txt | 3 | ||||
-rw-r--r-- | Tests/Dependency/Seven/SevenSrc.c | 6 | ||||
-rw-r--r-- | Tests/LinkLine/CMakeLists.txt | 12 | ||||
-rw-r--r-- | Tests/LinkLine/Exec.c | 9 | ||||
-rw-r--r-- | Tests/LinkLine/One.c | 10 | ||||
-rw-r--r-- | Tests/LinkLine/Two.c | 10 |
15 files changed, 134 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(); +} diff --git a/Tests/LinkLine/CMakeLists.txt b/Tests/LinkLine/CMakeLists.txt new file mode 100644 index 0000000..a7d138d --- /dev/null +++ b/Tests/LinkLine/CMakeLists.txt @@ -0,0 +1,12 @@ +PROJECT( LinkLine ) + +# Makes sure that the library order as specified by the user are +# unchanged by dependency analysis, etc. libOne and libTwo are +# dependent on each other. The link line should be -lOne -lTwo -lOne. + +ADD_LIBRARY( One One.c ) +ADD_LIBRARY( Two Two.c ) + +LINK_LIBRARIES( One Two ) +ADD_EXECUTABLE( Exec Exec.c ) +LINK_LIBRARIES( One ) diff --git a/Tests/LinkLine/Exec.c b/Tests/LinkLine/Exec.c new file mode 100644 index 0000000..807a7a8 --- /dev/null +++ b/Tests/LinkLine/Exec.c @@ -0,0 +1,9 @@ +void OneFunc(); +void TwoFunc(); + +int main() +{ + OneFunc(); + TwoFunc(); + return 0; +} diff --git a/Tests/LinkLine/One.c b/Tests/LinkLine/One.c new file mode 100644 index 0000000..167f07d --- /dev/null +++ b/Tests/LinkLine/One.c @@ -0,0 +1,10 @@ +void TwoFunc(); + +void OneFunc() +{ + static int i = 0; + ++i; + if( i==1 ) { + TwoFunc(); + } +} diff --git a/Tests/LinkLine/Two.c b/Tests/LinkLine/Two.c new file mode 100644 index 0000000..0db73a8 --- /dev/null +++ b/Tests/LinkLine/Two.c @@ -0,0 +1,10 @@ +void OneFunc(); + +void TwoFunc() +{ + static int i = 0; + ++i; + if( i==1 ) { + OneFunc(); + } +} |