[cmake-developers] Alternative Config.cmake format
Brad King
brad.king at kitware.com
Tue Nov 1 13:33:02 EDT 2011
On 11/1/2011 1:20 PM, Alexander Neundorf wrote:
> Would you prefer XML, JSON or something else ?
I have no preference. If the format is simple enough to parse in CMake code
then it can't be too hard to parse with a C++ implementation later ;)
However, note that you're trying to set a precedent for a cross-platform
replacement of pkg-config .pc files. That may have implications on the
format choice.
> When you write "Qt5Config.cmake that comes with Qt5 and *parses* the
> Qt5Config.xml file itself" do you mean to file(READ ...) then xml file in the
> Config.cmake file and then do a lot of regexp matching on the xml, or do you
> have a better idea ?
Yes, I meant that the Qt5Config.cmake file should do the parsing. You
can use file(STRINGS) to load the input file as a list of lines suitable
for use with foreach()'s "IN LISTS" mode. Note that CMake's list
processing doesn't like "[]" in the values due to backward compatibility
with registry value syntax, so JSON may be tricky if you use this approach.
-Brad
More information about the cmake-developers
mailing list