diff options
author | John Levon <john.levon@nutanix.com> | 2020-12-08 10:34:29 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-08 10:34:29 +0000 |
commit | 620b62b4b30bf02e6cadee5c8586b06e3c96506e (patch) | |
tree | d83a4db8bf9b2ac6fd043680c424708796e67dbc /lib | |
parent | 5ebfe0be226014b70a4ccf1f5d46dacbb013c91a (diff) | |
download | libvfio-user-620b62b4b30bf02e6cadee5c8586b06e3c96506e.zip libvfio-user-620b62b4b30bf02e6cadee5c8586b06e3c96506e.tar.gz libvfio-user-620b62b4b30bf02e6cadee5c8586b06e3c96506e.tar.bz2 |
build a static libvfio-user (#173)
Note that we intentionally don't install it: this is really for use when
building as a sub-module.
Signed-off-by: John Levon <john.levon@nutanix.com>
Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CMakeLists.txt | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index efc0a68..b306ece 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -30,22 +30,26 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") -add_library(vfio-user SHARED +set(LIBOBJS $<TARGET_OBJECTS:cap> $<TARGET_OBJECTS:dma> $<TARGET_OBJECTS:irq> $<TARGET_OBJECTS:libvfio-user> $<TARGET_OBJECTS:migration> $<TARGET_OBJECTS:pci> - $<TARGET_OBJECTS:tran_sock> - common.h - irq.h - private.h - tran_sock.h) + $<TARGET_OBJECTS:tran_sock>) -set_target_properties(vfio-user PROPERTIES LINKER_LANGUAGE C) +add_library(vfio-user-shared SHARED ${LIBOBJS}) +target_link_libraries(vfio-user-shared json-c pthread) +set_target_properties(vfio-user-shared PROPERTIES LINKER_LANGUAGE C) +set_target_properties(vfio-user-shared PROPERTIES OUTPUT_NAME vfio-user + CLEAN_DIRECT_OUTPUT 1) -target_link_libraries(vfio-user json-c pthread) +add_library(vfio-user-static STATIC ${LIBOBJS}) +target_link_libraries(vfio-user-static json-c pthread) +set_target_properties(vfio-user-static PROPERTIES LINKER_LANGUAGE C) +set_target_properties(vfio-user-static PROPERTIES OUTPUT_NAME vfio-user + CLEAN_DIRECT_OUTPUT 1) set(UT_CFLAGS "-O0 -ggdb --coverage") set(UT_LFLAGS "--coverage") @@ -66,7 +70,7 @@ add_library_ut(migration migration.c) add_library_ut(pci pci.c) add_library_ut(tran_sock tran_sock.c) -install(TARGETS vfio-user +install(TARGETS vfio-user-shared LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) if (DEFINED ENV{PYTHON_BINDINGS}) |