Reputation: 877
If I wanted to add, let's say, a new .lib to the build only if a particular #define
was set, how would I do that?
In the MSVC++ 2008 "Property Pages", you would simply add: Config Properties -> Linker -> Input -> Additional Dependencies
, but I would like it if something like #define COMPILE_WITH_DETOURS
was set, then the particular library would be added to the dependencies, otherwise it would be removed.
Upvotes: 2
Views: 794
Reputation: 355049
You can set some linker options by using #pragma comment
in one of your source files.
For example, to link against a 'detours.lib' library only if COMPILE_WITH_DETOURS
is defined, you can use:
#ifdef COMPILE_WITH_DETOURS
# pragma comment(lib, "detours.lib")
#endif
(this is specific to Microsoft Visual C++ and is not portable)
Upvotes: 2