Details
-
Suggestion
-
Resolution: Fixed
-
Not Evaluated
-
None
-
None
-
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
- Create the subdirectory "MySubProject" and the file "MySubProject/CMakeLists.txt" outside of Qt Creator (e.g. using the console, or Windows explorer)
- 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
- Right-click the target and select "Add New..." > "General" > "Empty File"
- Add the directory name and file name to the "Empty File" dialog
- Remove "MySubProject/CMakeLists.txt" as a source/resource from the target
- Add add_subdirectory(MySubProject) to the original CMakeLists.txt
Suggestion
Provide an easy way to create this subproject within the Qt Creator IDE:
- Right-click an existing project or CMakeLists.txt file
- Select "New Subproject..."
- 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
- relates to
-
QTCREATORBUG-30471 "New Subproject..." menu item is disabled for CMake projects
- Closed