I lifted my C++ backtrace utility from another project. There was even a note in the source code about requiring
-rdynamic to use. Originally, we were using CMake 3.3. When I upgraded to 3.17, I was silently bitten by CMP0065. I now see that I need to set the ENABLE_EXPORTS target property, in order to get the appropriate linker flag.
I’ve looked at How to share common cmake properties between exes?. @marc.chevrier had a response that hints at the solution I want, but I don’t want to set compile/link options directly; I want to use the abstraction of the
ENABLE_EXPORTS property. Unfortunately, setting it on my utility library doesn’t translate into an inherited link flag for targets that use it.
I’d like to think that I could set a global-scope property that would apply to all targets, but it doesn’t appear that global-scope properties work that way.
I think it’s too much to ask of users of a library to know that if you call function
backtrace in library
util that you need to set the
ENABLE_EXPORTS property on your executable. It’s even worse if some intervening library makes the call, the the executable writer has no idea.
Am I totally off base, or is there a better way?