CMake/Tests/Dependency
Daniele E. Domenichelli 4db31095e5 Fix link line order when shared libraries are de-duplicated
Since commit v3.1.0-rc1~227^2~1 (De-duplicate shared library targets in
generated link lines, 2014-07-30) we de-duplicate shared library targets
on the link line.  However, some toolchains will fail linking if an
executable is linking to a shared library that is not used directly and
a static library that depends on the shared one.  The linker may not
keep the reference to the shared library the first time and then the
symbols needed by the static library may not be found.

Fix this by reversing the direction of the for loop that removes the
duplicate shared libraries, in order to ensure that the last occurrence
of the library is left instead of the first one.

Extend Tests/Dependency with a case covering this behavior.  Create an
executable that links to a shared library and a static library but only
needs the shared library as a dependency of the static library.

Co-Author: Brad King <brad.king@kitware.com>
2014-11-10 14:46:22 -05:00
..
1 Convert CMake-language commands to lower case 2012-08-13 14:19:16 -04:00
Case1 ENH: Combine all dependency* tests into one Dependency test. Add more difficult test cases. 2008-02-06 14:52:12 -05:00
Case2 Test link multiplicity 2009-09-01 10:38:03 -04:00
Case3 ENH: Add test of preservation of static libraries on original link lines. 2008-04-23 00:40:32 -04:00
Case4 ENH: Remove CMAKE_ANSI_CFLAGS from tests 2009-07-08 11:41:48 -04:00
Case5 Fix link line order when shared libraries are de-duplicated 2014-11-10 14:46:22 -05:00
Eight Convert CMake-language commands to lower case 2012-08-13 14:19:16 -04:00
Exec Convert CMake-language commands to lower case 2012-08-13 14:19:16 -04:00
Exec2 Convert CMake-language commands to lower case 2012-08-13 14:19:16 -04:00
Exec3 Convert CMake-language commands to lower case 2012-08-13 14:19:16 -04:00
Exec4 Convert CMake-language commands to lower case 2012-08-13 14:19:16 -04:00
Five Convert CMake-language commands to lower case 2012-08-13 14:19:16 -04:00
Four Convert CMake-language commands to lower case 2012-08-13 14:19:16 -04:00
NoDepA Convert CMake-language commands to lower case 2012-08-13 14:19:16 -04:00
NoDepB Convert CMake-language commands to lower case 2012-08-13 14:19:16 -04:00
NoDepC Convert CMake-language commands to lower case 2012-08-13 14:19:16 -04:00
Seven Convert CMake-language commands to lower case 2012-08-13 14:19:16 -04:00
Six Convert CMake-language commands to lower case 2012-08-13 14:19:16 -04:00
Three Convert CMake-language commands to lower case 2012-08-13 14:19:16 -04:00
Two Convert CMake-language commands to lower case 2012-08-13 14:19:16 -04:00
CMakeLists.txt Fix link line order when shared libraries are de-duplicated 2014-11-10 14:46:22 -05:00