Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cmake | UWP :: Using Cmake to build Universal Windows App

How to use CMake for building a Universal Windows Application. I have already searched a lot and I came across the following:

CMake -G "Visual Studio 14 2015" -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10

This is how I am supposed to invoke CMake.

(How can i use CMake to generate Windows 10 universal project)

How should the corresponding CMakeLists.txt files look like. I know about the command for executables and library like add_executable etc. But I do not know about the command to be used for building a UWP app. Can anyone please provide a sample CMakeLists.txt file along with some sample code?

Also how to use CMake for a WinRT component?

like image 429
abhi Avatar asked Nov 25 '16 10:11

abhi


1 Answers

CMake is a cross-platform build tool, Microsoft has an fork branch from the official cmake repository, to bring in support for UWP and WinRT. So the offical cmake has support for UWP since some 3.4.0 version.

The CMakeLists.txt file differs from no general cmake file, you need to specify the cmake version, source file etc...

When targeting UWP project, you need to specify the build command as you pointed out,

CMake -G "Visual Studio 14 2015" -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10

You can also use the CMake GUI tool, just declar the MAKE_SYSTEM_NAME and CMAKE_SYSTEM_VERSION macros.

Worth mentioning here is there's a open source fips project, which is a wrapper module around cmake. You can see how easy it is to generate UWP project, following the tutorial here,

fips build uwp-vstudio-debug
like image 99
Jackie Avatar answered Nov 15 '22 07:11

Jackie