cmake: fix static linking due to cyclic deps (#1278)

linking of samples like sample_arm do fail due to cyclic references in
the archives
This commit is contained in:
John Zimmermann 2020-06-04 00:38:40 -07:00 committed by GitHub
parent 5508d3aa32
commit 605cfe8e02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -23,7 +23,7 @@ set(UNICORN_VERSION_PATCH 2)
option(UNICORN_BUILD_SHARED "Build shared instead of static library" ON) option(UNICORN_BUILD_SHARED "Build shared instead of static library" ON)
if(NOT UNICORN_ARCH) if (NOT UNICORN_ARCH)
# build all architectures # build all architectures
set(UNICORN_ARCH "x86 arm aarch64 m68k mips sparc") set(UNICORN_ARCH "x86 arm aarch64 m68k mips sparc")
endif() endif()
@ -293,6 +293,9 @@ add_library(x86_64-softmmu
qemu/tcg/tcg.c qemu/tcg/tcg.c
qemu/translate-all.c qemu/translate-all.c
) )
if (NOT UNICORN_BUILD_SHARED)
target_link_libraries(x86_64-softmmu unicorn)
endif()
if(MSVC) if(MSVC)
target_compile_options(x86_64-softmmu PRIVATE target_compile_options(x86_64-softmmu PRIVATE
@ -336,6 +339,9 @@ add_library(arm-softmmu
qemu/tcg/tcg.c qemu/tcg/tcg.c
qemu/translate-all.c qemu/translate-all.c
) )
if (NOT UNICORN_BUILD_SHARED)
target_link_libraries(arm-softmmu unicorn)
endif()
if(MSVC) if(MSVC)
target_compile_options(arm-softmmu PRIVATE target_compile_options(arm-softmmu PRIVATE
@ -377,6 +383,9 @@ add_library(armeb-softmmu
qemu/tcg/tcg.c qemu/tcg/tcg.c
qemu/translate-all.c qemu/translate-all.c
) )
if (NOT UNICORN_BUILD_SHARED)
target_link_libraries(armeb-softmmu unicorn)
endif()
if(MSVC) if(MSVC)
target_compile_options(armeb-softmmu PRIVATE target_compile_options(armeb-softmmu PRIVATE
@ -423,6 +432,9 @@ add_library(aarch64-softmmu
qemu/tcg/tcg.c qemu/tcg/tcg.c
qemu/translate-all.c qemu/translate-all.c
) )
if (NOT UNICORN_BUILD_SHARED)
target_link_libraries(aarch64-softmmu unicorn)
endif()
if(MSVC) if(MSVC)
target_compile_options(aarch64-softmmu PRIVATE target_compile_options(aarch64-softmmu PRIVATE
@ -467,6 +479,9 @@ add_library(aarch64eb-softmmu
qemu/tcg/tcg.c qemu/tcg/tcg.c
qemu/translate-all.c qemu/translate-all.c
) )
if (NOT UNICORN_BUILD_SHARED)
target_link_libraries(aarch64eb-softmmu unicorn)
endif()
if(MSVC) if(MSVC)
target_compile_options(aarch64eb-softmmu PRIVATE target_compile_options(aarch64eb-softmmu PRIVATE
@ -505,6 +520,9 @@ add_library(m68k-softmmu
qemu/tcg/tcg.c qemu/tcg/tcg.c
qemu/translate-all.c qemu/translate-all.c
) )
if (NOT UNICORN_BUILD_SHARED)
target_link_libraries(m68k-softmmu unicorn)
endif()
if(MSVC) if(MSVC)
target_compile_options(m68k-softmmu PRIVATE target_compile_options(m68k-softmmu PRIVATE
@ -548,6 +566,9 @@ add_library(mips-softmmu
qemu/tcg/tcg.c qemu/tcg/tcg.c
qemu/translate-all.c qemu/translate-all.c
) )
if (NOT UNICORN_BUILD_SHARED)
target_link_libraries(mips-softmmu unicorn)
endif()
if(MSVC) if(MSVC)
target_compile_options(mips-softmmu PRIVATE target_compile_options(mips-softmmu PRIVATE
@ -589,6 +610,9 @@ add_library(mipsel-softmmu
qemu/tcg/tcg.c qemu/tcg/tcg.c
qemu/translate-all.c qemu/translate-all.c
) )
if (NOT UNICORN_BUILD_SHARED)
target_link_libraries(mipsel-softmmu unicorn)
endif()
if(MSVC) if(MSVC)
target_compile_options(mipsel-softmmu PRIVATE target_compile_options(mipsel-softmmu PRIVATE
@ -630,6 +654,9 @@ add_library(mips64-softmmu
qemu/tcg/tcg.c qemu/tcg/tcg.c
qemu/translate-all.c qemu/translate-all.c
) )
if (NOT UNICORN_BUILD_SHARED)
target_link_libraries(mips64-softmmu unicorn)
endif()
if(MSVC) if(MSVC)
target_compile_options(mips64-softmmu PRIVATE target_compile_options(mips64-softmmu PRIVATE
@ -671,6 +698,9 @@ add_library(mips64el-softmmu
qemu/tcg/tcg.c qemu/tcg/tcg.c
qemu/translate-all.c qemu/translate-all.c
) )
if (NOT UNICORN_BUILD_SHARED)
target_link_libraries(mips64el-softmmu unicorn)
endif()
if(MSVC) if(MSVC)
target_compile_options(mips64el-softmmu PRIVATE target_compile_options(mips64el-softmmu PRIVATE
@ -714,6 +744,9 @@ add_library(sparc-softmmu
qemu/tcg/tcg.c qemu/tcg/tcg.c
qemu/translate-all.c qemu/translate-all.c
) )
if (NOT UNICORN_BUILD_SHARED)
target_link_libraries(sparc-softmmu unicorn)
endif()
if(MSVC) if(MSVC)
target_compile_options(sparc-softmmu PRIVATE target_compile_options(sparc-softmmu PRIVATE
@ -756,6 +789,9 @@ add_library(sparc64-softmmu
qemu/tcg/tcg.c qemu/tcg/tcg.c
qemu/translate-all.c qemu/translate-all.c
) )
if (NOT UNICORN_BUILD_SHARED)
target_link_libraries(sparc64-softmmu unicorn)
endif()
if(MSVC) if(MSVC)
target_compile_options(sparc64-softmmu PRIVATE target_compile_options(sparc64-softmmu PRIVATE