CMake: use unittests_stubhost object library

This commit is contained in:
Michael Maltese 2017-05-21 23:56:35 -07:00
parent a78ca46d9e
commit 9d130b52f7

View File

@ -6,12 +6,16 @@ if(ANDROID)
set(LIBS ${LIBS} android log) set(LIBS ${LIBS} android log)
endif() endif()
file(MAKE_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Tests) file(MAKE_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Tests)
# Since this is a Core dependency, it can't be linked as a normal library.
# Otherwise CMake inserts the library after core, but before other core
# dependencies like videocommon which also use Host_ functions, which makes the
# GNU linker complain.
add_library(unittests_stubhost OBJECT TestUtils/StubHost.cpp)
macro(add_dolphin_test target srcs) macro(add_dolphin_test target srcs)
# Since this is a Core dependency, it can't be linked as a library and has
# to be linked as an object file. Otherwise CMake inserts the library after set(srcs2 ${srcs} $<TARGET_OBJECTS:unittests_stubhost> ${ARGN})
# core, but before other core dependencies like videocommon which also use
# Host_ functions.
set(srcs2 ${srcs} ${CMAKE_SOURCE_DIR}/Source/UnitTests/TestUtils/StubHost.cpp ${ARGN})
add_executable(${target} EXCLUDE_FROM_ALL ${srcs2}) add_executable(${target} EXCLUDE_FROM_ALL ${srcs2})
set_target_properties(${target} PROPERTIES set_target_properties(${target} PROPERTIES
OUTPUT_NAME Tests/${target} OUTPUT_NAME Tests/${target}