Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-30445

Better Add Class behavior for cmake projects that use GLOB/GLOB_RECURSE

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • Qt Creator 12.0.2
    • None

    Description

      When using Qt Creator with a cmake project that uses file(GLOB_RECURSE VAR *.cpp) and adding a new class, Qt Creator still switches to CMakeLists.txt and modifies the add_executable directive.

      Example CMakeLists.txt:

      cmake_minimum_required(VERSION 3.5)
      project(qt-cmake-test LANGUAGES CXX)
      
      file(GLOB_RECURSE FOO_SRC Foo/*.cpp Foo/*.h)
      add_executable(qt-cmake-test ${FOO_SRC})
      

      When adding a class Something, the last line is changed to:

      add_executable(qt-cmake-test ${FOO_SRC}
          Foo/Something.h Foo/Something.cpp)
      

      (One can select "Add to project: <None>" in the wizard, but this choice is not remembered for next time and Qt Creator still opens and switches to CMakeLists.txt)

      To reduce friction, I propose the following:

      • Add option to disable automatic modifications to CMakeLists.txt

      Alternatively:

      • make Qt Creator remember the choice "Add to project: <None>" in the Add Class Wizard

      Additionally:

      • disable opening of (and switching to) CMakeLists.txt, (especially) if no modifications were made
      • Add option to trigger an automatic re-run of CMake after adding a new class

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            cadam Cristian Adam
            hs_bx Hans Spath
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes