Link stacktrace to library instead of test executable.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2020-08-15 14:58:44 +02:00
parent 34362a2cd7
commit 0a2acc1eea
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
1 changed files with 7 additions and 6 deletions

View File

@ -26,12 +26,8 @@ if (TESTS)
file(GLOB_RECURSE TEST_FILES "tests/*.cpp" "tests/*.hpp") file(GLOB_RECURSE TEST_FILES "tests/*.cpp" "tests/*.hpp")
# And create an executable from it. Also include catch.hpp. # And create an executable from it. Also include catch.hpp.
add_executable(ArbutilsTests ${TEST_FILES} extern/catch.hpp) add_executable(ArbutilsTests ${TEST_FILES} extern/catch.hpp)
set(LINKS Arbutils)
if (NOT WINDOWS)
set(LINKS ${LINKS} -lbfd -ldl)
endif()
# And finally link the library to the executable. # And finally link the library to the executable.
target_link_libraries(ArbutilsTests ${LINKS}) target_link_libraries(ArbutilsTests Arbutils)
# Add a compilation definition to the code that we are building a test build. # Add a compilation definition to the code that we are building a test build.
target_compile_definitions(ArbutilsTests PRIVATE TESTS_BUILD) target_compile_definitions(ArbutilsTests PRIVATE TESTS_BUILD)
endif () endif ()
@ -45,10 +41,15 @@ if (WINDOWS)
add_compile_options(-m64) add_compile_options(-m64)
endif (WINDOWS) endif (WINDOWS)
set(LINKS)
if (NOT WINDOWS)
set(LINKS ${LINKS} -lbfd -ldl)
endif()
# If we want to link the C and C++ library statically, link those as well. # If we want to link the C and C++ library statically, link those as well.
if (STATICC) if (STATICC)
target_link_libraries(Arbutils -static-libgcc -static-libstdc++) set(LINKS ${LINKS} -static-libgcc -static-libstdc++)
endif(STATICC) endif(STATICC)
target_link_libraries(Arbutils ${LINKS})
# If we aren't building for Windows, also include an option for installing on unix. # If we aren't building for Windows, also include an option for installing on unix.
if (NOT WINDOWS) if (NOT WINDOWS)