[CMake] Visual Studio and Windows Mobile SDKs

Alexander Neundorf a.neundorf-work at gmx.net
Sun Jul 6 05:48:32 EDT 2008


On Monday 30 June 2008, Andreas Pokorny wrote:
> Hi,
>
> Why is there a Windows-cl.cmake and no Window-msvc.cmake?

In cmake < 2.6 this filename was composed from CMAKE_SYSTEM_NAME and the 
basename of the compiler (cl.exe, also with Visual Studio).
In cmake 2.6 this was extended and now compilers can be identified more 
reliable by building a very simple test program which gives the "compiler 
id". This has the advantage that it is e.g. possible to differentiate between 
different "cc"s and also to detect the same compiler family even if the 
executable has a different name (e.g. arm-elf-gcc and gcc).
For the MS compiler this compiler id is "MSVC".
The file with the compiler id in the name is preferred over the one using the 
basename.

> Shall I include things like Platform/cl inside a WinCE-msvc file?

Yes. If the file doesn't work for WinCE, it should be modified to become more 
flexible.

> Will I need both
> WinCE-MSVC-C-YourHardware.cmake
> and
> WinCE-MSVC-CXX-YourHardware.cmake?

If you need the hardware-specific files, yes.
(but are also not-recommended ways how to do this (like using 
WinCE-cl-YourHardware.cmake or by putting everything in the C file and then 
relying on the unspecified behaviour that the C stuff is loaded by cmake 
before the CXX files).

> I have attached the current status, it would be nice if you could
> review the changes.

WinCE-cl.cmake:

You should split this into 
WinCE-MSVC-C.cmake and WinCE-MSVC-CXX.cmake so it follows the new style of 
naming.
Are the tests for the different compiler versions and the default flags used 
for them correct also for the cross compilers ?
If yes, it would be nice if you could split this out into a file which is then 
used both by Win-cl.cmake and WinCE-cl.cmake.

WinCE-MSVC-C-ARMV4I.cmake
WinCE-MSVC-CXX-ARMV4I.cmake

Hmm, they look quite general. Are the settings in these files required for 
everybody who will use that architecture ?
Then it would be better to do handle this in the WinCE-MSVC-C[XX].cmake files.
Is it possible to determine the architecture detailled enough from the 
compiler ? E.g. from the name (clarm.exe ?) or by building a small test 
program and checking for something in it, as it is done for the compiler id ?
(see Modules/CMakeCCompilerId.c.in)

Also a variable like WINCE_PROCESSOR could be introduced, which would hae to 
be set in the toolchain file and which could be evaluate in the 
platform-compiler file. Have a look at 
Modules/Platform/Generic-ADSP-Common.cmake file to see how this is done 
there.

Alex


More information about the CMake mailing list