cmake in Flathub kdevelop
Jonathan Verner
jonathan.verner at matfyz.cz
Wed May 24 22:00:27 BST 2023
Hi,
Since kdevelop allows configuring the cmake binary in the CMake plugin settings
as well as per-project (in the "Advanced" CMake configuration), I think this is
a bug.
I just cursorily looked over the code and I think the problem might be the
following. Didn't have time to check, though...
in the `checkForNeedingConfigure` (in cmakeutils.cpp) when the `addBuildDir`
lambda is called in the case that the current build path is non-empty. It
passes `{}` as the `cmakeExecutable` argument, and the lambda then overwrites
the `cmake executable` setting. When
`CMakeBuildDirChooser::setCMakeExecutable` is called a few lines later, it is
passed the result of `currentCMakeExecutable` which correctly reads the
"global" setting, but then finds out that the "per-project setting", which is
set to {}, now returns the "default", e.g. the result of a path-based search
for `cmake` (in the current runtime). If these differ (and they do, in Ryan's
case) the project setting will be chosen, which is the default cmake.
Perhaps removing the call to `CMake::setCurrentCmakeExecutable` would be
a fix?
Or replace the last `{}` in the lambda call with
`CMakeBuilderSettings::self()->cmakeExecutable().toLocalFile()` ?
The `usebuilder.cpp` call should also be fixed, but that, I think, is less
urgent, as it affects language support for CMakeList.txt files only...
Cheers,
Jonathan
On středa 24. května 2023 19:38:57 CEST Igor Kushnir wrote:
> On 2023-05-10 04:03, roundup976 at tutanota.com wrote:
> > Hello,
> >
> > I work in a large CMake project with 900+ executables, 6 million + lines
> > of code and a bunch of other misc. stuff. I have been using for the last
> > 18 months the KDevelop appimage of version 5.6.1 successfully. I use a
> > specific cmake version located at /usr/local/bin/cmake. No issues with
> > the appimage.
> >
> > When I try to use the latest Flatpak version 5.11 it will not use my cmake
> > version. I changed it in both the global location under settings ->
> > configure kdevelop -> cmake as well as project -> configure project ->
> > cmake -> show advanced -> cmake executable. The project setting will not
> > keep the executable I point to. It always defaults back to
> > /app/bin/cmake.
> >
> > I do not use kdevelop to build, but when the build configuration fails due
> > to cmake errors the project is not parsed and there fore kdevelops code
> > understanding is broken. This essentially defeats the purpose of an IDE
> > as I am sure you are aware.
> >
> > Is there anything I can do to make this work? Anything I can do to help
> > if it is an issue? I use neovim when not in kdevelop, and do not want to
> > use vscode.
> >
> > My OS is oracle linux 8 on the 5.4 linux kernel using the gnome desktop.
> >
> > Thank You,
> >
> > Ryan
>
> Hi Ryan,
>
> Searching for "cmake" (with quotes) in KDevelop source code turned up two
> relevant results:
> 1. In cmakeutils.cpp:
> auto cmake = QStandardPaths::findExecutable(QStringLiteral("cmake"));
> 2. In usebuilder.cpp:
> QStringList ids = CMake::executeProcess(QStringLiteral("cmake"),
> QStringList(QStringLiteral("--help-command-list"))).split(QLatin1Char('\n'))
> ;
>
> From (2) the "cmake" program is passed to QProcess::start(const QString
> &program, const QStringList &arguments, QIODevice::OpenMode mode =
> ReadWrite)
>
> In both cases the order of paths in the PATH environment variable should
> determine which executable is picked. So check the value of, then override
> PATH somehow. How to do that is a Flatpak, not KDevelop question.
>
> Cheers,
> Igor
More information about the KDevelop-devel
mailing list