Question

Long story short, we have a Qt project that I'm thinking of migrating to CMake. However, some of our customers use the existing library as a subproject in a Qt subdirs project. Does that mean we are stuck with Qt for the build system?

Was it helpful?

Solution

This is possible, but ugly. You could for instance use the system() function in a qmake file:

system(command[, mode])

You can use this variant of the system function to obtain stdout from the command and assign it to a variable.

For example:

UNAME = $$system(uname -s) contains( UNAME, [lL]inux ):message( This looks like Linux ($$UNAME) to me )

As discussed in the comment, your fallback option would be to maintain both for your project, and give your customer a reasonable amount of notice period for qmake so that they have enough time for the migration if they are willing to.

Otherwise, running the desired cmake and build commands with the system() function looks, at least one, way to go.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top