Important: Please read the Qt Code of Conduct -

Qt Creator, CMake project and MSVC compiler

  • Hi,
    I'm working on Windows.
    Project configuration is created with help of CMake (with one executable and multiple custom targets to run bat files).
    I've created MSVC 2010 build kit. When CMake generator is set to Visual Studio 2010 - build kit reports warning - like : alt text and CMake test build attempt fail.
    Then I change CMake generator to "NMake Makefiles". Then CMake regenerates successfully. However no source/header files are visible in project. Moreover - Warning is the same - "CMake generator does not generate a CodeBlocks file".

    How to setup this project so I could see and be able to work with files?

    PS: Windows 10, MSVC 2010, CMake 3.7, Qt Creator 4.2.1

  • Moderators

    @SebastianM This sounds like a cmake problem... Can I see your CMakeLists.txt file?

    Although I admit I don't think I've used Qt Creator with MSVC generator before. Usually it's mingw/qt creator when I play with it in windows. So it may not be a cmake thing.

  • I didn't set Extra generator field. Now files are visible.

  • Qt Creator 4.2 needs a cmake generator with "CodeBlocks" in its name: Most of the data is extracted from a file ending with the ".cbp" extension (the CodeBlocks project file). So AFAIR the Visual Studio generators are not supported.

    The upcoming Qt Creator 4.3 no longer needs the "CodeBlocks" Extragenerator -- provided you use cmake version 3.7. That version supports "server-mode" -- provided you did not exclude it when building cmake). You are free to choose whatever generator you like with such a setup. You also get a better project tree that way. The "CodeBlocks" requirement unfortunately stays for older cmake versions though.

Log in to reply