[Qt-creator] CMake Generator

Andreas Pakulat apaku at gmx.de
Thu Mar 12 17:36:44 CET 2015


Hi,

On Thu, Mar 12, 2015 at 1:48 PM, Spandan Sharma <ustulation at gmail.com>
wrote:

> Using Qt Creator 3.3.1.
> I have Visual Studio 2013 Community edition and thus the msvc compiler
> that comes with it. When using from the visual studio command prompt:
> C:\Windows\system32\cmd.exe /k
> ""C:\virtualization-c\softwares\active\visual-studio\2013-community\VC\vcvarsall.bat""
> x86_amd64
>

You don't need that with the VS generators, cmake ignores your environment
if you generate VS solutions.


> I mention the cmake generator for my project as:
> cmake ..\Project -G "Visual Studio 12 Win64"
> and then
> cmake --build . --target some_target --config Debug
>
> and everything works fine.
>
> However if i open the CMakeLists.txt in Qt Creator then the Generator
> available is the NMake Generator and no other in the Drop Down.
>

Thats because Qt Creator needs to know certain things about your project,
like include directories and parsing that out of Makefile/Ninja is too much
work. So in order to get this information it'll actually run cmake with a
generator like "NMake - CodeBlocks" or "Ninja - CodeBlocks", which not only
generates makefiles or ninja.build but also an xml file describing the
project in a way that Qt Creator understands (.cbp files in the build dir).
There's no such variant for the VS solution files that'll generate the
solutions and a codeblocks file. Another reason may be that Qt Creator
integrates the output from the buildtool in its problems view etc. which
may have to be adapted if it should start running cmake --build or devenv
with the VS solutions directly.


> > Due to this there are several compile errors (submodules unable to find
> preconfigured headers/libraries etc). The entire project has been tested to
> work with "Visual Studio 12 Win64" generator and i need this to get the
> project to build successfully from Qt Creator.
>

Thats because you wrote your cmake files such that they only work with VS
solution files.

How do I achieve this?
>

Fix your CMake buildsystem to work with NMake or Ninja, i.e. drop the parts
that only work with VS solutions. Alternatively consider dropping Qt
Creator and using VS as your IDE.

No idea wether the QtCreator developers would be open to integrate code
that knows how to get the information I mentioned above out of a VS
solution, but the format is essentially undocumented and you need to
reverse-engineer it so there's quite some work involved with that.

Andreas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qt-creator/attachments/20150312/66d44414/attachment.html>


More information about the Qt-creator mailing list