0

We're using CMake for our C++ project. On Windows we generate a Visual Studio project from our CMakeLists.txt. This works nicely, however we need to set an Intel Compiler specific option called BasePlatformToolset.

The option can be set in Visual Studio's GUI, after which an entry is added to the .vcxproj file. However every time we generate the project again from CMakeLists.txt the option is of course reset to the default value.

Is there a way to specify this option from the CMakeLists.txt file?

To clarify: this is not the same as setting the platform toolset. Since we're using the Intel compiler and not the default compiler, the platform toolset is specified as "Intel C++ Compiler 17.0". "Base Platform Toolset" is then an Intel compiler specific setting.

Mathijs
  • 347
  • 1
  • 4
  • 13

1 Answers1

0

You should be able to use a generator expression that drops in for your compiler id:

target_compile_options(yourTarget
    PRIVATE
    $<$<CXX_COMPILER_ID:Intel>:/p:BasePlatformToolset=v120>)
lubgr
  • 37,368
  • 3
  • 66
  • 117