I have a CMake project where I'm using some options to control what the final library actually implements. Something like this (in pseudo-code):
// CMakeLists.txt
option(ADD_BAR "Include the bar methods" ON)
configure_file(...)
add_library(foo SHARED foo.cpp)
// foo.cpp
void doFoo(){
...
}
#ifdef ADD_BAR
void bar(){
...
}
#endif
Then, I have other targets that link against this library. Is there a way in CMake I can detect whether bar() exists in the final libfoo.so or that this target was compiled with this option disabled? Basically, I'd like to propagate the information about how the library was compiled (e.g. with what enabled options) so I can skip downstream targets that consume it but need unsupported features.