I am struggling to figure out how to tie a package I can grab with find_package()
into my multi-configuration build (using Ninja Multi-Config). The package in question is a binary-only first-party library built by GraalVM’s native image, and cajoled into working with find_package()
.
Currently, building a debug or release version of the package I want to include (let’s call it Core) results in a set of files under either a Debug
or Release
folder in the package’s build tree. In the consuming package (let’s call it Wrapper), I am currently setting the path to Core’s Release folder as a cached variable at Wrapper’s generation time. That stops me simply relying on the multi-config support to pick the right version.
My options for allowing a debug-enabled Core to be linked against a debug-enabled Wrapper seem to boil down to:
-
Get the debug libraries to be generated with
CMAKE_DEBUG_POSTFIX
and put them in the same dir as the release libraries, and the generated package config files i.e.*-release.cmake
and*-debug.cmake
in the same place. The main problem with that is that the debug and release targets are identically named, and if both debug and release package files are present then the Wrapper’s release config tries to link to Core’s debug files. -
Generate the Core Debug package with ‘Debug’ in its name, and then pick that different package variant using a generator expression. This one I’m not sure about at all. That doesn’t seem to be a place I can use generator expressions, and it also doesn’t feel like a build-time thing…
Any advice gratefully received…
Thanks,
Matt