Using MSVC2015 and Cmake in QtCreator

  • I want to use Cmake for a better compatibility, so I generated a new project and tried to compile and run it. Everything is fine, but when I try to run it I just get the following error: MSBUILD:-1: error: MSB1009: The project file does not exist.

    I use the following software:

    Qt Creator 4.6.2
    Qt 5.10.1
    MSVC 2015, 64 bit
    Cmake 3.11.1

    Any help is welcome!
    Thank you!

  • Lifetime Qt Champion

    Did you follow

    note; the integration is not great. Like adding files etc is clumsy.

  • Yes, I did follow these instructions :/
    I'll check the settings again...
    EDIT: if I use the MinGW 32Bit Compiler, everything is fine.

  • What do you have under "CMake Generator" in the kits tab?

  • I set 'Visual Studio 15 2017' as the Cmake generator. No platform and toolset.

  • @patman said in Using MSVC2015 and Cmake in QtCreator:

    I set 'Visual Studio 2017'

    @patman said in Using MSVC2015 and Cmake in QtCreator:

    I use the following software: MSVC 2015

    See where the problem is?

    Change it to NMake Makefiles

  • Sorry for the late response!

    If I use NMake Makefiles, I get the following Error:

    -1: error: Failed to activate protocol version: "CMAKE_GENERATOR" is set but incompatible with configured generator value.

    I changed to the MSVC 2017 toolchain and configured it the following way:


    and I'm getting the same error as above.

  • I know this is an old topic. But I stumbled upon this topic multiple times, but now I got CMake in QtCreator with Visual Studio 15 2017 working. But had to change a few things.

    In the Qt kit, I choose:
    CMake Generator
    Generator: Visual Studio 15 2017 Win 64.
    Extra generator: None
    Platform: empty
    Toolset: empty

    CMake Configuration: only CMAKE_PREFIX_PATH:STRING=%{QT:QT_INSTALL_PREFIX}, removed the others

    When generating a cmake project, I have to change the resulting Build Settings (for each build configuration).


    Build steps: choose "ALL_BUILD" instead of "all"

    For us this resulted in a working build using msbuild, which allows us to build Wix installers etc. as well, something that cannot be done with NMake Makefiles.

  • 在Qt Creator中,项目->Build,Build的步骤修改Target为Current executable。