BUILD_SHARED_LIBS is a standard CMake option [1] that specifies whether shared libraries should be built or not. This commit adjusts src/CMakeLists.txt to observe this variable to decide whether the shared library variant should be built or not. This allows check to only build a static library in environments where only a static library can be compiled.
This needs a bit of refactoring to avoid duplication:
Additional source files from libcompat are directly added to the ${SOURCES} variable as needed
Additional libraries are collected into ${ADDITIONAL_LIBS} before being associated to the static library and shared library (if enabled)
BUILD_SHARED_LIBS is a standard CMake option [1] that specifies whether shared libraries should be built or not. This commit adjusts src/CMakeLists.txt to observe this variable to decide whether the shared library variant should be built or not. This allows check to only build a static library in environments where only a static library can be compiled.
This needs a bit of refactoring to avoid duplication:
Additional source files from libcompat are directly added to the ${SOURCES} variable as needed
Additional libraries are collected into ${ADDITIONAL_LIBS} before being associated to the static library and shared library (if enabled)
[1] https://cmake.org/cmake/help/latest/variable/BUILD_SHARED_LIBS.html
Fixes:
uClibc_main.c:(.text+0x12c): undefined reference to
__fini_array_end' /home/autobuild/autobuild/instance-20/output-1/host/lib/gcc/sparc-buildroot-linux-uclibc/13.3.0/../../../../sparc-buildroot-linux-uclibc/bin/ld: __uClibc_main.c:(.text+0x130): undefined reference to
fini_array_start' /home/autobuild/autobuild/instance-20/output-1/host/lib/gcc/sparc-buildroot-linux-uclibc/13.3.0/../../../../sparc-buildroot-linux-uclibc/bin/ld: __uClibc_main.c:(.text+0x134): undefined reference to `__fini_array_end'