@@ -81,6 +81,7 @@ include(cmake/bundle_static.cmake)
81
81
# Also we would like users to link a native cmake target, instead of a custom target for better
82
82
# compatability.
83
83
option (BUILD_SHARED_LIBS "Build shared instead of static library" ${PROJECT_IS_TOP_LEVEL} )
84
+ option (UNICORN_LEGACY_STATIC_ARCHIVE "Enable Unicorn v1 style all-in-one objects archive for libunicorn.a" ${PROJECT_IS_TOP_LEVEL} )
84
85
option (UNICORN_FUZZ "Enable fuzzing" OFF )
85
86
option (UNICORN_LOGGING "Enable logging" OFF )
86
87
option (UNICORN_BUILD_TESTS "Build unicorn tests" ${PROJECT_IS_TOP_LEVEL} )
@@ -1442,16 +1443,18 @@ if (BUILD_SHARED_LIBS)
1442
1443
endif ()
1443
1444
1444
1445
# Black magic for generating static archives...
1445
- if (BUILD_SHARED_LIBS )
1446
- if (MSVC )
1447
- # Avoid the import lib built by MVSC clash with our archive.
1448
- set_target_properties (unicorn PROPERTIES ARCHIVE_OUTPUT_NAME "unicorn-import" )
1446
+ if (UNICORN_LEGACY_STATIC_ARCHIVE)
1447
+ if (BUILD_SHARED_LIBS )
1448
+ if (MSVC )
1449
+ # Avoid the import lib built by MVSC clash with our archive.
1450
+ set_target_properties (unicorn PROPERTIES ARCHIVE_OUTPUT_NAME "unicorn-import" )
1451
+ endif ()
1452
+ bundle_static_library(unicorn_static unicorn_archive unicorn)
1453
+ else ()
1454
+ # Rename the "static" lib to avoid filename clash.
1455
+ set_target_properties (unicorn PROPERTIES OUTPUT_NAME "unicorn-static" )
1456
+ bundle_static_library(unicorn unicorn_archive unicorn)
1449
1457
endif ()
1450
- bundle_static_library(unicorn_static unicorn_archive unicorn)
1451
- else ()
1452
- # Rename the "static" lib to avoid filename clash.
1453
- set_target_properties (unicorn PROPERTIES OUTPUT_NAME "unicorn-static" )
1454
- bundle_static_library(unicorn unicorn_archive unicorn)
1455
1458
endif ()
1456
1459
1457
1460
if (UNICORN_FUZZ)
@@ -1514,8 +1517,10 @@ if(UNICORN_INSTALL AND NOT MSVC)
1514
1517
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
1515
1518
)
1516
1519
endif ()
1517
- install (FILES $<TARGET_FILE:unicorn_archive> DESTINATION ${CMAKE_INSTALL_LIBDIR} )
1518
- install (FILES $<TARGET_FILE_DIR:unicorn_archive>/$<TARGET_PROPERTY:unicorn_archive,SYMLINK_NAME> DESTINATION ${CMAKE_INSTALL_LIBDIR} )
1520
+ if (UNICORN_LEGACY_STATIC_ARCHIVE)
1521
+ install (FILES $<TARGET_FILE:unicorn_archive> DESTINATION ${CMAKE_INSTALL_LIBDIR} )
1522
+ install (FILES $<TARGET_FILE_DIR:unicorn_archive>/$<TARGET_PROPERTY:unicorn_archive,SYMLINK_NAME> DESTINATION ${CMAKE_INSTALL_LIBDIR} )
1523
+ endif ()
1519
1524
install (FILES ${UNICORN_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} /unicorn)
1520
1525
if (ATOMIC_LINKAGE_FIX)
1521
1526
set (ATOMIC_LINK_PKG_CONFIG " -latomic" )
0 commit comments