0

I'm using CMake to generate a VS2010 solution with both C/C++ projects: native console app, static libs and native DLL; and C# projects: managed console app and managed DLL.
I'm using CMake with the include_external_msproject + CONFIGURE_FILE technique as described e.g. here.

However, the resulting solution keeps skipping the build of the C# projects.
Following this, if I "Unload Project" and then "Reload Project" the projects now build properly.
I must do this every time I re-"Generate" the solution with CMake.

Why is this happening?
Is there a way to avoid this?

Community
  • 1
  • 1
Adi Shavit
  • 16,743
  • 5
  • 67
  • 137
  • Have the project and solution files been changed after the reload, and can you do a file compare to see what has been changed? – wimh Apr 07 '13 at 08:39
  • Yes, the reload alters the `.sln` file. Among other things adding `Mixed Platforms` lines to `GlobalSection(ProjectConfigurationPlatforms)` – Adi Shavit Apr 07 '13 at 12:45
  • Is it skipped when you do a rebuild all? Or just a normal build? – Alastair Maw Apr 08 '13 at 16:13
  • Any build. In fact, even before I build, if I set it as Startup Project, the "Start Debugging" and "Start without Debugging" buttons are greyed out. – Adi Shavit Apr 08 '13 at 20:42

1 Answers1

2

Had the same problem here.

Our cmake generated solution created configurations for Win32 and x64 platforms while the external C# project had x86 and x64 platforms. After cmake generated the solution, all projects (internal and external) are set to use platform Win32. (Check the solutions Configuration Manager.)

To force cmake to include the external projects as x86, specify the PLATFORM parameter when calling include_external_msproject.

include_external_msproject(TestApp "/TestApp/TestApp.csproj" PLATFORM x86)

(And of course ensure that you just do this for the x86 version...)