[CMake] Visual Studio: force use of folders

Alexander Hans alex at ahans.de
Tue Jan 31 05:17:07 EST 2017


Hi all,

we have the following setup: Visual Studio 2013 Professional is installed,
but for compatibility reasons we need to use the Visual Studio 2010
(vc100) compilers. To that end we have Visual Studio 2010 Express
installed (to complicate things, we also need the Windows SDK 7.1 to get
access to compilers that can produce 64-bit code). What we want is to use
Visual Studio 2013 as IDE with the vc100 compilers. It is possible to
create a Visual Studio 2010 solution with CMake and open and compile that
with Visual Studio 2013. However, as CMake detects an Express Edition of
the target platform, it disables generation of folders in the solution.
However, folder support is one of the main reasons to use Visual Studio
2013 Professional instead of the 2010 Express Edition. Is there a way to
force folder generation in that case? Looking at the source code of the
corresponding generator, I don't see a way. By removing the check for
IsExpressEdition() in cmGlobalVisualStudio8Generator::UseFolderProperty()
and simply always returning cmGlobalGenerator::UseFolderProperty(),
folders are generated also if an Express edition is detected. Obviously,
that's not a nice solution, since now when actually using an Express
Edition, many warnings need to be clicked away ...

If this cannot be solved with some already existing option, I would like
to implement the option to force folder generation. What would be the
preferred way to do this? What comes to mind is implementing a new
generator that inherits everything from the existing one and only
overrides UseFolderProperty() method, or implementing an option for the
existing one. How would one implement such an option? As additional
space-separated parameter like the platform (e.g., Visual Studio 2010
Win64 force_folders)?


Thanks!

Alex



More information about the CMake mailing list