Imagine that I am compiling a (static) library libfoo.athat provides a header file foo.h. I will link my application APPwith libfoo.aand #include <foo.h>in my source code. libfoouses CMakeas a build system with user-defined variables, such as those BUILD_WITH_OPTION_BARthat are passed as definitions to the compiler:
ADD_DEFINITIONS(BUILD_WITH_OPTION_BAR)
Inside foo.hwe will find ads #ifdefusing this option:
#ifdef BUILD_WITH_OPTION_BAR
typedef long long int fooInt;
#else
typedef int fooInt;
#endif
My question is: How should I know, inside my own APP, what libfoo.awas created with or without BUILD_WITH_OPTION_BAR?
In other words: where and when do I need to identify BUILD_WITH_OPTION_BARinside mine APP?
My basic understanding is that the library libfooshould provide some kind of file config.hthat is included internally foo.h, but how do you get optional #define BUILD_WITH_OPTION_BAR where there is compilation time ( libfoo)?
I found this related question: add_definitions vs. configure_file , but it does not discuss how . It really does.
source
share