Generating QtCreator project for CMakeLists.txt from command line
-
Hi,
I was woundering if it is at all possible to generate a QtCreator project for a given
CMakeLists.txt
from command line? I.e. generation of theCMakeLists.txt.user
from command line while giving some parameters, such as the desired configurations and according build directories.My use case is the following.
Background:
I am developing software within the ROS framework. One of the many aspects of ROS is thecatkin
build system, which makes it easy for you to manage many different ROS packages and their depedencies. For example, the latest ROS distribution "Jade" has almost 1000 packages released.catkin
is CMake-based, and as such in a typical ROS workspace you might have 10s or even >100 CMake projects.Now while you can use
catkin
with the standard CMake workflow ofmkidr build && cd build && cmake ../src && make
, there also exists a command line tool suitecatkin_tools
, which aids you in building all catkin/CMake projects in your workspace independently, while still respecting the interdependencies. As such, it manages thecmake
invocations and build-locations for each package. It also has support for profiles, such that you could handle different configurations at the same time (debug, relase, ...).My current workflow using this together with QtCreator is the following: I use
catkin build
to compile all my packages, which also entails calling cmake in a specific build directory for each package. Then, whenever I want to work on a specific package, I open theCMakeLists.txt
as a project in QtCreator, but need to manually select the correct build directory. If I have different profiles, I need to select each of the build directories for the different configurations.Desired workflow:
It would be nice if for a catkin workspace such as described above, I could generate QtCreator projects for all packages with the appropriate build directories set up. For example, to do the same for Eclipse, I can call something likecatkin build --force-cmake -G"Eclipse CDT4 - Unix Makefiles"
, and then import the generated projects into Eclipse, which is extremely convenient. But since IMHO QtCreator is the superiour C++ IDE (at least for my needs) and I also like the CMake integration much better, it would be great to be able to generate these project files without user intervention.I think we really only would need to generate the
CMakeLists.txt.user
file. The.cbp
files generated by cmake itself could be created when the user first opens the project in QtCreator and invokes cmake through QtCreator (note that at this point all the build directories with cmake-cache etc already exist from the originalcatkin build
call). The only parameters I currently would want to pass are the configurations and according build-directories.Does anyone have any input on what would the best way to achieve this? Should this be a standalone script/application, or somehow built into qtcreator with a specific command line invocation? Would it be easier to utilise the cmakeproject-related classes implemented in QtCreator, or generate the xml independently? Is there some kind of spec describing the contents of
CMakeLists.txt.user
?Any comments or insights are welcome.
Cheers,
NikoP.S.: A bit of praise: I'm loving the CMake improvements in QtCreator 4.0. It just keeps getting better and better! Thanks for all.
-
Hi and welcome to devnet,
I'd recommend bringing this to the Qt Creator mailing list You'll find there Qt Creator's developers/maintainers. This forum is more user oriented.
-
@SGaist Thanks for your response. I posted to the mailing list.
For future reference: http://lists.qt-project.org/pipermail/qt-creator/2016-March/005621.html