CMakeLists.txt does not allow creation of static library and link applications accordingly. Creation of SHARED and STATIC should be allowed using -DBUILD_SHARED_LIBS Ex: cmake -D__LIB=lib -DBUILD_SHARED_LIBS=OFF .. cmake -D__LIB=lib -DBUILD_SHARED_LIBS=ON .. Signed-off-by: Deepak Kumar Mishra <deepakkumar.mishra@xxxxxxx> --- CMakeLists.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5aada20..bc9be63 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -91,7 +91,7 @@ target_include_directories(bpf PRIVATE set(dwarves_LIB_SRCS dwarves.c dwarves_fprintf.c gobuffer.c strings.c ctf_encoder.c ctf_loader.c libctf.c btf_encoder.c btf_loader.c libbtf.c dwarf_loader.c dutil.c elf_symtab.c rbtree.c) -add_library(dwarves SHARED ${dwarves_LIB_SRCS} $<TARGET_OBJECTS:bpf>) +add_library(dwarves ${dwarves_LIB_SRCS} $<TARGET_OBJECTS:bpf>) set_target_properties(dwarves PROPERTIES VERSION 1.0.0 SOVERSION 1) set_target_properties(dwarves PROPERTIES INTERFACE_LINK_LIBRARIES "") target_include_directories(dwarves PRIVATE @@ -99,12 +99,12 @@ target_include_directories(dwarves PRIVATE target_link_libraries(dwarves ${DWARF_LIBRARIES} ${ZLIB_LIBRARIES}) set(dwarves_emit_LIB_SRCS dwarves_emit.c) -add_library(dwarves_emit SHARED ${dwarves_emit_LIB_SRCS}) +add_library(dwarves_emit ${dwarves_emit_LIB_SRCS}) set_target_properties(dwarves_emit PROPERTIES VERSION 1.0.0 SOVERSION 1) target_link_libraries(dwarves_emit dwarves) set(dwarves_reorganize_LIB_SRCS dwarves_reorganize.c) -add_library(dwarves_reorganize SHARED ${dwarves_reorganize_LIB_SRCS}) +add_library(dwarves_reorganize ${dwarves_reorganize_LIB_SRCS}) set_target_properties(dwarves_reorganize PROPERTIES VERSION 1.0.0 SOVERSION 1) target_link_libraries(dwarves_reorganize dwarves) @@ -151,8 +151,8 @@ target_link_libraries(syscse dwarves) install(TARGETS codiff ctracer dtagnames pahole pdwtags pfunct pglobal prefcnt scncopy syscse RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) -install(TARGETS dwarves LIBRARY DESTINATION ${LIB_INSTALL_DIR}) -install(TARGETS dwarves dwarves_emit dwarves_reorganize LIBRARY DESTINATION ${LIB_INSTALL_DIR}) +install(TARGETS dwarves LIBRARY DESTINATION ${LIB_INSTALL_DIR} ARCHIVE DESTINATION ${LIB_INSTALL_DIR}) +install(TARGETS dwarves dwarves_emit dwarves_reorganize LIBRARY DESTINATION ${LIB_INSTALL_DIR} ARCHIVE DESTINATION ${LIB_INSTALL_DIR}) install(FILES dwarves.h dwarves_emit.h dwarves_reorganize.h dutil.h gobuffer.h list.h rbtree.h pahole_strings.h btf_encoder.h config.h ctf_encoder.h ctf.h -- 2.17.1