18

To create WINRT project we need to have CMake >= 2.8.10 and:

  1. Set project type to be Windows Store App(CMAKE: SET_TARGET_PROPERTIES(target PROPERTIES VS_WINRT_EXTENSIONS TRUE)
  2. Add compiler flag /ZW for WinRT compilation(CMAKE: ADD_DEFINITIONS(-ZW))
  3. Add App.xaml.h, App.xaml.cpp
  4. Add App.xaml so VS will generate some additional files from it(CMAKE: HOW?)
  5. Add Package.appxmanifest with description so VS will use it(CMAKE: HOW?)

Thank you.

UPDATE: CMake bug report referring to this question is here 0013749: Cannot target Windows 8 RT from CMake without workarounds.

1

2 Answers 2

2

CMake guys are working on it: Bug report at cmake.org

Sign up to request clarification or add additional context in comments.

Comments

1

This is perfectly doable. Things have considerably changed since this question was initially asked. The most significant changes are:

  • Visual Studio natively supports CMake since Visual Studio 2017 (see CMake support in Visual Studio). It's not longer required to separately download CMake, and have it generate .sln and .vcxproj files. CMake is part of the Visual Studio installation, and can be parsed by Visual Studio's project management infrastructure and build system.
  • C++/CX is no longer the only way to produce and consume Windows Runtime components. C++/WinRT provides a standard C++ language projection of the Windows Runtime API surface, with the ability to consume and produce Windows Runtime components.

With these changes you can use CMake to create a C++ project that builds a Windows Runtime application. C++/WinRT is standard C++, and Visual Studio 2017 provides built-in CMake support.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.