incppect icon indicating copy to clipboard operation
incppect copied to clipboard

Option to build library as STATIC

Open pawcam opened this issue 1 year ago • 1 comments

Hello there. I'm actually experimenting with using your https://github.com/ggerganov/imgui-ws library.

While I was able to bring in the code using FetchContent_Declare:

FetchContent_Declare(imgui-ws
    GIT_REPOSITORY    https://github.com/ggerganov/imgui-ws.git
    GIT_TAG           eab5d6b169ed3e5f8d26c4a6cd9a3271dd6e2dda
    GIT_SUBMODULES_RECURSE YES
    )

The resulting binary in my app becomes dependent on the incppect lib at runtime:

 ldd oel-dashboard
	linux-vdso.so.1 (0x00007ffde5943000)
	libincppect.so => /home/user/dev4/order-execution/cmake-build-debug-ubuntu/_deps/imgui-ws-build/third-party/incppect/src/libincppect.so (0x00007f98f8a9c000)
	libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f98f8824000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f98f86d5000)
	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f98f86b0000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f98f868d000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f98f8499000)
	libuWS.so => /home/user/dev4/order-execution/cmake-build-debug-ubuntu/_deps/imgui-ws-build/third-party/incppect/third_party/libuWS.so (0x00007f98f8133000)
	libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f98f8117000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f98f8e30000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f98f8111000)

Would it be possible to add a flag to src/CMakeLists.txt to toggle this to STATIC? Something llike

set(BUILD_SHARED_LIBS OFF)
if(BUILD_SHARED_LIBS)
  add_library(incppect STATIC incppect.cpp)
else()
  add_library(incppect SHARED incppect.cpp)
endif()

pawcam avatar Jun 21 '24 21:06 pawcam

static build will be very useful also for me, actually ...

ozlb avatar Jan 06 '25 14:01 ozlb