Limit target_link_libraries to one use.
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Deukhoofd 2019-12-31 20:01:53 +01:00
parent 2af125dc03
commit 94c03cfaed
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
1 changed files with 14 additions and 9 deletions

View File

@ -43,26 +43,31 @@ foreach (_variableName ${CONAN_LIBS})
message(STATUS "Lib: ${_variableName}")
endforeach()
target_link_libraries(pkmnLib PUBLIC ${CONAN_LIBS})
SET(_LINKS ${CONAN_LIBS})
SET(_TESTLINKS pkmnLib ${CONAN_LIBS})
if (WINDOWS)
message(STATUS "Using Windows build.")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -Wa,-mbig-obj -Wl,-allow-multiple-definition")
# Statically link libraries we need in Windows.
SET(_LINKS -static -static-libgcc -static-libstdc++ ${_LINKS})
SET(_TESTLINKS -static -static-libgcc -static-libstdc++ ${_TESTLINKS})
endif (WINDOWS)
target_link_libraries(pkmnLib PUBLIC ${_LINKS})
if (NOT DEFINED CONAN_EXPORTED)
# Create Test executable
file(GLOB_RECURSE TEST_FILES "tests/*.cpp" "tests/*.hpp")
add_executable(pkmnLibTests ${TEST_FILES} extern/catch.hpp)
target_link_libraries(pkmnLibTests PUBLIC ${CONAN_LIBS} pkmnLib)
target_link_libraries(pkmnLibTests PUBLIC ${_TESTLINKS})
# Add a definition for the test library
target_compile_definitions(pkmnLibTests PRIVATE TESTS_BUILD)
endif ()
if (WINDOWS)
message(STATUS "Using Windows build.")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -Wa,-mbig-obj -Wl,-allow-multiple-definition")
# Statically link libraries we need in Windows.
target_link_libraries(pkmnLib -static -static-libgcc -static-libstdc++)
target_link_libraries(pkmnLibTests -static -static-libgcc -static-libstdc++)
endif (WINDOWS)