-1

I'm (co-) working on a library having to target many different compilers and compiler versions. For example we need to support Visual Studio 2005 through 2015 along with some others (ICC, Clang, GCC, ...).

Now most new compilers add new features and some of them are really useful potentially. In-fact they're so useful that we want to turn them on by default. But we still want to keep compability with older compilers.

For example:
Visual Studio 2015 introduces the control flow guard which helps preventing some attacks on the library. However this is obviously an unknown option for earlier compiler versions.

So how can we set up our .vc(x)proj files to default-enable new features (such as the control flow guard) while at the same time being warning-free on older compilers (not knowing the new feature)? Or is it impossible?

SEJPM
  • 262
  • 4
  • 12

1 Answers1

0

Use a make file system, instead of a vcproj. The vcproj just calls make.

Within the make files, test your target compiler for version information, and set flags appropriately.

Yakk - Adam Nevraumont
  • 262,606
  • 27
  • 330
  • 524