mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-06 18:58:05 +00:00
Fix linking of C++ unit tests with CMake
The problem with them is that the "libraries" into which Wesnoth is split have circular dependencies, and linking of the game succeeds only by chance (everything just happens to be used by the time the linker encounters it). Fixed by allowing the linker to use multiple passes over the libraries until all references are resolved. (cherry-picked from commit e7ed3cbbb9ad474f2f89137fceece946eaa95e81)
This commit is contained in:
parent
e81512ba83
commit
92f8e24796
@ -282,6 +282,7 @@ if(ENABLE_GAME)
|
||||
add_executable(wesnoth WIN32 wesnoth.cpp)
|
||||
|
||||
target_link_libraries(wesnoth
|
||||
-Wl,--start-group
|
||||
wesnoth-client
|
||||
lua
|
||||
wesnoth-core
|
||||
@ -289,6 +290,7 @@ if(ENABLE_GAME)
|
||||
wesnoth-sdl
|
||||
${WIDGETS_LIB}
|
||||
wesnoth-client
|
||||
-Wl,--end-group
|
||||
${game-external-libs}
|
||||
)
|
||||
set_target_properties(wesnoth
|
||||
@ -362,6 +364,7 @@ if(ENABLE_TESTS)
|
||||
add_executable(boost_unit_tests ${test_SRC})
|
||||
|
||||
target_link_libraries(boost_unit_tests
|
||||
-Wl,--start-group
|
||||
wesnoth-client
|
||||
lua
|
||||
wesnoth-core
|
||||
@ -369,6 +372,7 @@ if(ENABLE_TESTS)
|
||||
wesnoth-sdl
|
||||
${WIDGETS_LIB}
|
||||
wesnoth-client
|
||||
-Wl,--end-group
|
||||
${game-external-libs}
|
||||
boost_unit_test_framework
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user