libspatialaudio
libspatialaudio copied to clipboard
Library is built twice
When using this library as a dependency called from a higher CMakeLists, when compiling with ninja an error is raised because the library is built both as a shared and a static library:
https://github.com/videolabs/libspatialaudio/blob/master/CMakeLists.txt#L15
Is there a way to avoid this and have it only built as shared for example?
Ah it seems I can overcome it by defining
set(BUILD_SHARED_LIBS OFF)
on the parent CMakeLists
Well, I notice that I need BUILD_SHARED_LIBS ON for the parent CMakeLists
I am having the same issue here. As we are integrating libspatialaudio through git submodule, any usage of global cmake flag (specifically, BUILD_SHARED_LIBS
and BUILD_STATIC_LIBS
) could lead to destructive conflicts to our project.
There seems to be a logical flaw as your team keep both default values to ON here https://github.com/videolabs/libspatialaudio/blob/6e158835a96df9d89aacea54b4792a8d092e34e4/CMakeLists.txt#L15-L16 The ninja compiler of Visual Studio 2019 will error out saying there are multiple build rules for libspatialaudio
If setting these Cmake options both ON are your intention, did you consider using a private option like BUILD_SPATIALAUDIO_AS_SHARED_LIBS
and BUILD_SPATIALAUDIO_AS_STATIC_LIBS
?