Skip to content
This repository has been archived by the owner on Jan 6, 2025. It is now read-only.

Commit

Permalink
Merge pull request #125 from pmem/static-capstone
Browse files Browse the repository at this point in the history
Add option to statically link capstone
  • Loading branch information
en4bz authored Dec 1, 2022
2 parents 4404983 + 2ce2bc5 commit ca4b135
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ option(TREAT_WARNINGS_AS_ERRORS
"make the build fail on any warnings during compilation, or linking" ON)
option(EXPECT_SPURIOUS_SYSCALLS
"account for some unexpected syscalls in tests - enable while using sanitizers, gcov" OFF)
option(STATIC_CAPSTONE "statically link libcapstone into the shared library" OFF)

find_program(CTAGS ctags)
if(CTAGS)
option(AUTO_RUN_CTAGS "create tags file every on every rebuild" ON)
Expand Down Expand Up @@ -138,8 +140,14 @@ add_dependencies(syscall_intercept_static generate_syscall_intercept_scoped)
set_target_properties(syscall_intercept_base_c
PROPERTIES C_VISIBILITY_PRESET hidden)

set(CAPSTONE_LINK_MODE "-Bdynamic")
if (STATIC_CAPSTONE)
set(CAPSTONE_LINK_MODE "-Bstatic")
endif()

target_link_libraries(syscall_intercept_shared
PRIVATE ${CMAKE_DL_LIBS} ${capstone_LIBRARIES}
PRIVATE ${CMAKE_DL_LIBS}
"-Wl,--push-state,${CAPSTONE_LINK_MODE} -lcapstone -Wl,--pop-state"
"-Wl,--version-script=${CMAKE_SOURCE_DIR}/version.map")

target_link_libraries(syscall_intercept_static
Expand Down

0 comments on commit ca4b135

Please sign in to comment.