Fix CMake::readCacheValues to actually read values from the cache
Fixes include path and define resolution for cmake projects using
make-file generator instead of ninja.
In my CMakeCache.txt files, the lines have the following format:
...
//Name of generator.
CMAKE_GENERATOR:INTERNAL=Unix Makefiles
...
So far, only the comment would be tried to be parsed since it does
not start with a letter or number. But then the parser would detect
it's invalid. This patch fixes this situation by only trying to
parse lines that start with a letter, considering that cmake
variables cannot start with a number to my knowledge.
This fixes KDevelop's cmake support detection of include paths and
defines for anyone using a CMake with server support and make file
generators. Because KDevelop defaults to Ninja as the generator,
and the existing generator value could not be read from the cache,
we tried to configure the cmake server with the ninja generator for
a project already configured with the unix makefile generator.
CMake does not like this at all:
warning: kdevelop/CMakeServerImportJob::processResponse: error!!
QJsonObject({"cookie":"","errorMessage":"Failed to activate protocol version:
\"CMAKE_GENERATOR\" is set but incompatible with configured generator value.",
"inReplyTo":"handshake","type":"error"})
[/home/milian/projects/kf5/src/extragear/kdevelop/kdevelop/projectmanagers/cmake/cmakeserverimportjob.cpp:164/pid=648]
warning: kdevelop/kdevelop.projectmanagers.cmake/CMakeManager::createImportJob(KDevelop::ProjectFolderItem*)::<lambda:
couldn't load json successfully "my-project"
[/home/milian/projects/kf5/src/extragear/kdevelop/kdevelop/projectmanagers/cmake/cmakemanager.cpp:205/pid=648]
This patch fixes this situation, and I can load my projects properly
again. It is to be noted that no unit test exists for this part
of the cmake manager. I think we should revive some of the old
unit tests that tested this functionality it seems.
CCMAIL: apol@kde.org