mirror of
https://github.com/reactos/CMake.git
synced 2025-01-05 18:38:46 +00:00
4db31095e5
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>
55 lines
1.3 KiB
CMake
55 lines
1.3 KiB
CMake
cmake_minimum_required (VERSION 2.6)
|
|
project( Dependency )
|
|
|
|
# to test directories with only one character One was changed to 1
|
|
# There is one executable that depends on eight libraries. The
|
|
# system has the following dependency graph:
|
|
#
|
|
# NoDepA:
|
|
# NoDepB: NoDepA
|
|
# NoDepC: NoDepA
|
|
# 1:
|
|
# Two: Three
|
|
# Three: 1 Four
|
|
# Four: 1 Two NoDepA
|
|
# 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,...,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.
|
|
|
|
add_subdirectory(NoDepA)
|
|
add_subdirectory(NoDepB)
|
|
add_subdirectory(NoDepC)
|
|
add_subdirectory(1)
|
|
add_subdirectory(Two)
|
|
add_subdirectory(Three)
|
|
add_subdirectory(Four)
|
|
add_subdirectory(Five)
|
|
add_subdirectory(Six)
|
|
add_subdirectory(Seven)
|
|
add_subdirectory(Eight)
|
|
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)
|
|
add_subdirectory(Case3)
|
|
add_subdirectory(Case4)
|
|
add_subdirectory(Case5)
|