In a Visual Studio 2010 C++ project file, is it possible to use conditionals to determine the presence of a library, and alter preprocessor flags, etc appropriately?
To be more concrete, say we have a directory C:\libraries\MKL, i would like to #define MKL and add mkl_dll.lib as an additional dependency if that directory exists.
Previously we have used multiple solution configurations to achieve this, but that is quite hard to maintain.
The following, when pasted into the bottom of an F# project, has the suggested effect (if
c:\temp\foo.txtexists, then a#defineforTHE_FILE_EXISTSis added). I expect that only minor modifications would be needed for a C++ project, since they both use MSBuild. This is a little hacky maybe, it is the first thing I got working.It just occurred to me that
is probably sufficient, but not nearly as sexy.