Commit Graph

15 Commits

Author SHA1 Message Date
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
Kitware Robot 77543bde41 Convert CMake-language commands to lower case
Ancient CMake versions required upper-case commands.  Later command
names became case-insensitive.  Now the preferred style is lower-case.

Run the following shell code:

cmake --help-command-list |
grep -v "cmake version" |
while read c; do
    echo 's/\b'"$(echo $c | tr '[:lower:]' '[:upper:]')"'\(\s*\)(/'"$c"'\1(/g'
done >convert.sed &&
git ls-files -z -- bootstrap '*.cmake' '*.cmake.in' '*CMakeLists.txt' |
egrep -z -v '^(Utilities/cm|Source/kwsys/)' |
xargs -0 sed -i -f convert.sed &&
rm convert.sed
2012-08-13 14:19:16 -04:00
Brad King d1aa17a7b0 ENH: Remove CMAKE_ANSI_CFLAGS from tests
As of CMake 2.6 this variable is not defined, and the ANSI flags for the
HP compiler are simply hard-coded in the default C flags.
2009-07-08 11:41:48 -04:00
Brad King c76f3ae5b5 ENH: Test fake circular dependency case
A recent change fixed a case in which CMake incorrectly diagnosed a
circular dependency involving a non-linkable executable target.  This
adds a test for that case.
2008-08-07 10:13:15 -04:00
Brad King 464a6cbf34 ENH: Add test of preservation of static libraries on original link lines. 2008-04-23 00:40:32 -04:00
Ken Martin ce8810c4e7 ENH: preclean some warnings 2008-03-25 11:27:18 -04:00
Brad King a71d56096c BUG: Need ANSI C. 2008-02-08 09:24:29 -05:00
Brad King 1cba430d1b ENH: Combine all dependency* tests into one Dependency test. Add more difficult test cases. 2008-02-06 14:52:12 -05:00
Ken Martin 2e4258efc1 ENH: shift to using ADD_SUBDIRECTORY 2005-06-08 12:26:32 -04:00
Bill Hoffman 160c32e529 BUG: add a test for a single char dir, and fix bug introduced in 1.53, but we still can not handle a space as the start of a directory name 2004-11-01 16:57:05 -05:00
Amitha Perera 0e6b39e52f 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.
2002-05-10 13:35:42 -04:00
Amitha Perera 4bff970413 - bug fix where paths weren't being output when LIB_OUT_PATH *isn't* used
- test case for above mentioned bug
- more comments. Comments are good.
2002-05-03 00:27:34 -04:00
Amitha Perera 099436db26 ENH: Make the LinkLibraries command contribute dependencies towards AddLibraries. 2002-05-01 16:33:27 -04:00
Amitha Perera 36f80fe6c8 ENH: Make the LinkLibraries command contribute dependencies towards AddLibraries. 2002-05-01 16:24:47 -04:00
Amitha Perera 1f8df8585e ENH: Add library dependency analysis. 2002-05-01 14:00:21 -04:00