diff --git a/CMakeLists.txt b/CMakeLists.txt index 3d27bb76..851cf522 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -83,8 +83,9 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) # can use the internal interface of the libraries (linking # with syscall_intercept_base instead of the actual lib ), without # the library trying to hotpatch libc every time. -add_library(syscall_intercept_base_c STATIC ${SOURCES_C}) -add_library(syscall_intercept_base_asm STATIC ${SOURCES_ASM}) +add_library(syscall_intercept_base_c OBJECT ${SOURCES_C}) +add_library(syscall_intercept_base_asm OBJECT ${SOURCES_ASM}) +add_library(syscall_intercept_base_entry OBJECT src/entry.c) if(HAS_NOUNUSEDARG) target_compile_options(syscall_intercept_base_asm BEFORE @@ -94,15 +95,21 @@ endif() set_property(TARGET syscall_intercept_base_c APPEND PROPERTY COMPILE_FLAGS ${capstone_CFLAGS}) -target_link_libraries(syscall_intercept_base_c - ${CMAKE_DL_LIBS} ${capstone_LIBRARIES}) -add_library(syscall_intercept_shared SHARED src/entry.c) +add_library(syscall_intercept_shared SHARED + $ + $ + $) +add_library(syscall_intercept_static STATIC + $ + $ + $) + target_link_libraries(syscall_intercept_shared - syscall_intercept_base_c syscall_intercept_base_asm) -add_library(syscall_intercept_static STATIC src/entry.c) + PRIVATE ${CMAKE_DL_LIBS} ${capstone_LIBRARIES}) + target_link_libraries(syscall_intercept_static - syscall_intercept_base_c syscall_intercept_base_asm) + INTERFACE ${CMAKE_DL_LIBS} ${capstone_LIBRARIES}) set_target_properties(syscall_intercept_shared PROPERTIES VERSION ${SYSCALL_INTERCEPT_VERSION} diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index d3d543d0..96fecb78 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -41,10 +41,12 @@ include_directories(${PROJECT_SOURCE_DIR}/src ${PROJECT_SOURCE_DIR}/test) set(CMAKE_ASM_CREATE_SHARED_LIBRARY ${CMAKE_C_CREATE_SHARED_LIBRARY}) -add_executable(asm_pattern asm_pattern.c) +add_executable(asm_pattern asm_pattern.c + $ + $) + target_link_libraries(asm_pattern - PRIVATE ${CMAKE_DL_LIBS} ${capstone_LDFLAGS} - syscall_intercept_base_c syscall_intercept_base_asm) + PRIVATE ${CMAKE_DL_LIBS} ${capstone_LDFLAGS}) set(asm_patterns nosyscall