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

A GUI for adding a new CMake sub-project

    XMLWordPrintable

Details

    • dcc023917 (master)

    Description

      Suppose I want to add a CMake sub-project called "MySubProject". There are a few ways I could do this (none of them are particularly elegant):

       

      Method A: Add the new CMakeLists.txt file outside the IDE

      1. Create the subdirectory "MySubProject" and the file "MySubProject/CMakeLists.txt" outside of Qt Creator (e.g. using the console, or Windows explorer)
      2. Add add_subdirectory(MySubProject) to the original CMakeLists.txt

       

      Method B: Add the new CMakeLists.txt file as a general empty file inside the IDE

      1. Right-click the target and select "Add New..." > "General" > "Empty File"
      2. Add the directory name and file name to the "Empty File" dialog
      3. Remove "MySubProject/CMakeLists.txt" as a source/resource from the target
      4. Add add_subdirectory(MySubProject) to the original CMakeLists.txt

       

      Suggestion

      Provide an easy way to create this subproject within the Qt Creator IDE:

      1. Right-click an existing project or CMakeLists.txt file
      2. Select "New Subproject..."
      3. Enter the name of the subproject

      (The screenshot below shows the equivalent of steps (1) and (2) in a qmake SUBDIRS project)

       

      Then, Qt Creator would:

      • Create the "MySubProject" folder
      • Create the "MySubProject/CMakeLists.txt" file (optionally with a single line at the top: "project(MySubProject)")
      • Add add_subdirectory(MySubProject) to the original CMakeLists.txt

      Attachments

        Issue Links

          For Gerrit Dashboard: QTCREATORBUG-30818
          # Subject Branch Project Status CR V

          Activity

            People

              cadam Cristian Adam
              skoh-qt Sze Howe Koh
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes