[CMake] Support for Visual Studio Linux cross-compiling extension

Floh floooh at gmail.com
Mon Oct 17 06:44:14 EDT 2016


Hi,

Microsoft has added support for remote-compiling and -debugging on
Linux from within Visual Studio through an official VS extension:
https://blogs.msdn.microsoft.com/vcblog/2016/03/30/visual-c-for-linux-development/

My question: is it already possible to generate a Visual Studio
solution for this scenario? If not, is support for this planned,
similar to the Android cross-compile scenario?

It would be nice if I could generate such a solution with (for instance):

cmake -G "Visual Studio 14" -DCMAKE_SYSTEM_NAME=VSLinux

I've been looking at the generated solution files, and the only
'interesting' part in the vxproj file seems to be this section:

---
  <PropertyGroup Label="Globals">
    <ProjectGuid>{2e73db3c-a17c-4694-996c-2cca151ed9f2}</ProjectGuid>
    <Keyword>Linux</Keyword>
    <RootNamespace>ConsoleApplication1</RootNamespace>
    <MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
    <ApplicationType>Linux</ApplicationType>
    <ApplicationTypeRevision>1.0</ApplicationTypeRevision>
    <TargetLinuxPlatform>Generic</TargetLinuxPlatform>
    <LinuxProjectType>{D51BCBC9-82E9-4017-911E-C93873C4EA2B}</LinuxProjectType>
  </PropertyGroup>
---

There seems to be a hardwired mapping between Visual Studio compiler
options and gcc/clang options, for instance setting optimization to
-O3 in the VS property dialog adds these lines to the vxproj file:

---
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <ClCompile>
      <Optimization>Full</Optimization>
    </ClCompile>
  </ItemDefinitionGroup>
---

Cheers & thanks,
-Floh.


More information about the CMake mailing list