[Qt5-feedback] Declarative CMake input as the Qt build system.
Bill Hoffman
bill.hoffman at kitware.com
Mon Jun 20 21:13:25 CEST 2011
Hi all,
Sorry we were unable to attend the Qt Contributor's summit. However, we
have given some serious thought as to how a json declarative input file
could work with CMake. This would allow for an IDE like QtCreator to
use/edit/modify the declarative parts of a build system. It would also
allow for the full power of CMake's system introspection and existing
user/code base to be leveraged.
Kitware is ready to commit some resources to making this happen. There
is in fact a Kitware business case to be made for this work to happen.
We have many customers, clients, and collaborators that use Qt/CMake.
They would be very happy to see Qt use CMake as a build system. In the
same way that we supported and support the KDE community we would be
able to support Qt. In the early days of the KDE adoption we made many
major changes to CMake in order to make it work for KDE.
Before that happens, we would have to all agree on an approach to be
taken. In order to more clearly state the approach we are interested
in, we have created a simple json input file to demonstrates a few of
the basic ideas in the new specification format. This is intended for a
CMakeLists.txt file to load with a "load_build_expression" command
or something like that. The "in" objects refer to inputs to the
expression intended for substitution by whatever evaluates it.
The CMake evaluator will know how to substitute these values based
on the current CMake language status:
cmake_minimum_required(VERSION 2.X)
project(FOO C)
find_package(PNG REQUIRED)
load_build_expression("foo.json")
Evaluation of the expression is lazy and free of side effects.
Therefore an IDE may generate, present, and edit it with no
knowledge of the evaluation context and need only consider the
inputs as unknowns.
Conditional tests are supported with the form
{"if": ...,
"then": ...,
"else": ...}
using "in" objects and conditional expressions of the forms
{"and": [...]}
{"or": [...]}
{"not": ...}
For example:
{
"targets": [
{
"target": "foo",
"type": "library",
"src": [
"all.c",
{"if": {"in": "windows"}, "then": ["win1.c", "win2.c"]},
{"if": {"or": [{"in": "apple"}, {"in": "unix"}]}, "then": "posix.c"},
{"if": {"in": "BUILD_OPTIONAL"}, "then": "optional.c"}
],
"include": [
{"in": "PNG_INCLUDE_DIRS"}
],
"lib": [
{"in": "PNG_LIBRARIES"}
]
},
{
"target": "bar",
"type": "executable",
"src": ["exe.c"],
"lib": ["foo"]
}
]
}
More information about the Qt5-feedback
mailing list