Closed robbert-vdh closed 1 year ago
If you disable subproject downloads (yabridge normally fetches its own copy of the CLAP headers, this is only needed for distro packaging), yabridge 5.0.0 will build as is after installing the CMake library with these changes.
We need to make sure version.h
is in sync with CMakeLists.txt
.
Can CMake parse the header to extract the version?
Oh good idea, I'll make sure to generate clap/version.h
from the CMake project version.
Can CMake parse the header to extract the version?
It needs to be done the other way around. If you don't want to require going through a build system (either by including this using CMake, or going through make install
once), then I think the best solution is to just keep them in sync manually.
Generation is problematic, imagine someone uses the submodule but with a different build system.
We can parse the version from include/clap/version.h
with a regexp, but it's going to be a bit messy and it may break future builds. What's your preference, try to parse the header or keep the versions in sync manually?
Either we parse the header, or we fail the build if the versions are out of sync.
The stack overflow code should work for us I think.
With Meson you can directly get the value from one or more #define
s. Do you happen to know if CMake has something similar? That's much more resilient to errors than trying to parse the header by hand.
I can take a look.
This makes it easier to consume CLAP using build systems that rely on either CMake's
find_package()
mechanism or on pkg-config to find package dependencies. For this to work smoothly, the main library target has been renamed toclap
so it matches the project name. Aclap-core
alias has been provided so projects can still refer to it by that name and no existing code will break. The CMake project now also contains the CLAP version number so that applications that include the CLAP library package can check whether that version matches their supported versions.This has been verified to work with CMake's
find_package()
, with Meson'sdependency()
(both when using the.pc
file and the CMake config+config-version files). I've also built Surge XT against these headers to make sure nothing changes for existing projects (there shouldn't be any reason to think it would, but you never know).This resolves #198.