mixxx
mixxx copied to clipboard
FindRubberband: Make sure sleefdft is present before linking it
I have encountered configuration errors when Sleef was built without SleefDFT (FindSleef.cmake
seems to handle this correctly). To avoid this, this PR makes sure to only link Sleef if the DFT library is present.
In my case this happened because Homebrew Sleef (which apparently is not built with DFT) slipped into the build. While this is not ideal, we should at least make sure that we build against a working version of Sleef.
IIUC we cannot use find_package
for that since we locate SleefDFT together with Sleef in FindSleef.cmake
(we would need a separate FindSleefDFT.cmake
or similar). Maybe adding a warning to FindSleef.cmake
if Sleef was found without DFT would be appropriate?
I have added a warning, which should hopefully highlight the problem if someone is wondering why we don't link their Sleef:
CMake Warning at cmake/modules/FindSleef.cmake:145 (message):
Sleef found at /opt/homebrew/lib/libsleef.a does not have sleefdft, this
means static builds will not link it with Rubberband! Perhaps you meant to
use some other version of Sleef?
I think the best way would be to make
find_package(Sleef COMPONENTS sleefdft)
This can be done by adding the following fo FindSleef.cmake
foreach (_component ${SLEEF_FIND_COMPONENTS})
if (${_component} STREQUAL "sleefdft")
find_library(SleefDFT_LIBRARY
NAMES sleefdft
PATHS ${PC_Sleef_LIBRARY_DIRS})
mark_as_advanced(SleefDFT_LIBRARY)
set(ADDITIONAL_REQUIRED_VARS ${ADDITIONAL_REQUIRED_VARS} SleefDFT_LIBRARY)
endif()
endforeach ()
....
find_package_handle_standard_args(
Sleef
REQUIRED_VARS Sleef_INCLUDE_DIR Sleef_LIBRARY ${ADDITIONAL_REQUIRED_VARS}
VERSION_VAR Sleef_VERSION)
Great suggestion, thanks! I have made the search for Sleef components a bit more generic even and dropped the 'sleef' prefix (since at least according to the project's CMakeLists they all follow the same naming scheme), so Sleef::sleefdft
becomes Sleef::dft
(and find_package(Sleef COMPONENTS dft)
, Sleef_dft_FOUND
etc.)
This PR is marked as stale because it has been open 90 days with no activity.