How to prevent change to CMakeLists.txt when adding a new class?
-
I'm using Qt Creator to work on a non-QT cmake project that uses
file(GLOB_RECURSE VAR *.cpp)instead of listing source files explicitly.When I add a new class with Qt Creator it opens my CMakeLists.txt and inserts the newly created files into the
add_executabledirective.Example, existing 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 I use the Wizard to add a new class
Somethingin folderFoo/, Qt Creator opens CMakeLists.txt and changes the last line to:add_executable(qt-cmake-test ${FOO_SRC} Foo/Something.h Foo/Something.cpp)Now I have to delete those changes again. I could select "Add to project: <None>" on the last page of the Add Class Wizard but it does not remember that choice for next time and also still opens CMakeLists.txt (without modifying it).
Is it possible to achieve some or all of the following?
- disable automatic modifications to CMakeLists.txt
- make Qt Creator remember the choice "Add to project: <None>" in the Add Class Wizard
- disable opening of (and switching to) CMakeLists.txt, especially if no modifications were made
- trigger an automatic re-run of CMake after adding a new class
-
I'm using Qt Creator to work on a non-QT cmake project that uses
file(GLOB_RECURSE VAR *.cpp)instead of listing source files explicitly.When I add a new class with Qt Creator it opens my CMakeLists.txt and inserts the newly created files into the
add_executabledirective.Example, existing 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 I use the Wizard to add a new class
Somethingin folderFoo/, Qt Creator opens CMakeLists.txt and changes the last line to:add_executable(qt-cmake-test ${FOO_SRC} Foo/Something.h Foo/Something.cpp)Now I have to delete those changes again. I could select "Add to project: <None>" on the last page of the Add Class Wizard but it does not remember that choice for next time and also still opens CMakeLists.txt (without modifying it).
Is it possible to achieve some or all of the following?
- disable automatic modifications to CMakeLists.txt
- make Qt Creator remember the choice "Add to project: <None>" in the Add Class Wizard
- disable opening of (and switching to) CMakeLists.txt, especially if no modifications were made
- trigger an automatic re-run of CMake after adding a new class
@hs_bx Only if you create a bugreport / suggestion 😬
-
@hs_bx Only if you create a bugreport / suggestion 😬