Dan HorĂ¡k wrote:
another option is to build the internal libs as static, then they
won't
have to be installed. Try appending
-DBUILD_SHARED_LIBS:BOOL=OFF
to the cmake flags
I guess this is also why the OP ran into the error with the non-PIC code in
the static library in the RPM build and not elsewhere. Shared libraries need
to contain all-PIC code, so both the shared libraries themselves and any
static libraries linked into them need to be PIC. This is not the case if
the static libraries are linked only into executables. So if the build has
only ever been tested with BUILD_SHARED_LIBS off (the upstream CMake
default), this will not have been caught.
Generally, for an upstream project, it is a better idea to explicitly mark
the library as STATIC in the CMakeLists.txt files if upstream does not
support building it as a shared library.
By the way, if upstream is not going to install the static library, they can
also declare the library as OBJECT instead of STATIC (a CMake-specific
feature). That creates a kind of virtual static library, where CMake will
link the object files directly into the target and skip the generation of
the unnecessary .a file.
Kevin Kofler