videolabs / libspatialaudio

Ambisonic encoding / decoding and binauralization library in C++
Other
192 stars 37 forks source link

Library is built twice #34

Open sergiogf93 opened 2 years ago

sergiogf93 commented 2 years ago

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?

sergiogf93 commented 2 years ago

Ah it seems I can overcome it by defining

set(BUILD_SHARED_LIBS OFF)

on the parent CMakeLists

sergiogf93 commented 2 years ago

Well, I notice that I need BUILD_SHARED_LIBS ON for the parent CMakeLists

Stan230211 commented 2 years ago

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?