Re: cmake in Flathub kdevelop
Jonathan Verner <[email protected]> Wed, 24 May 2023 23:00:27 +0200
| Newsgroups | gmane.comp.kde.devel.kdevelop |
|---|---|
| Message-ID | <11788930.7P7fVgmZQa@cirdan> |
Hi,
Since kdevelop allows configuring the cmake binary in the CMake plugin sett=
ings=20
as well as per-project (in the "Advanced" CMake configuration), I think thi=
s is=20
a bug.
I just cursorily looked over the code and I think the problem might be the=
=20
following. Didn't have time to check, though...
in the `checkForNeedingConfigure` (in cmakeutils.cpp) when the `addBuildDir=
`=20
lambda is called in the case that the current build path is non-empty. It=20
passes `{}` as the `cmakeExecutable` argument, and the lambda then overwrit=
es=20
the `cmake executable` setting. When=20
`CMakeBuildDirChooser::setCMakeExecutable` is called a few lines later, it =
is=20
passed the result of `currentCMakeExecutable` which correctly reads the=20
"global" setting, but then finds out that the "per-project setting", which =
is=20
set to {}, now returns the "default", e.g. the result of a path-based sear=
ch=20
for `cmake` (in the current runtime). If these differ (and they do, in Ryan=
's=20
case) the project setting will be chosen, which is the default cmake.
Perhaps removing the call to `CMake::setCurrentCmakeExecutable` would be
a fix?=20
Or replace the last `{}` in the lambda call with=20
`CMakeBuilderSettings::self()->cmakeExecutable().toLocalFile()` ?
The `usebuilder.cpp` call should also be fixed, but that, I think, is less=
=20
urgent, as it affects language support for CMakeList.txt files only...
Cheers,
Jonathan
On st=C5=99eda 24. kv=C4=9Btna 2023 19:38:57 CEST Igor Kushnir wrote:
> On 2023-05-10 04:03, roundup976-q7wo9g+UVklWk0Htik3J/[email protected] wrote:
> > Hello,
> >=20
> > 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 la=
st
> > 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.
> >=20
> > When I try to use the latest Flatpak version 5.11 it will not use my cm=
ake
> > 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 n=
ot
> > keep the executable I point to. It always defaults back to
> > /app/bin/cmake.
> >=20
> > 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.
> >=20
> > 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.
> >=20
> > My OS is oracle linux 8 on the 5.4 linux kernel using the gnome desktop.
> >=20
> > Thank You,
> >=20
> > Ryan
>=20
> Hi Ryan,
>=20
> Searching for "cmake" (with quotes) in KDevelop source code turned up two
> relevant results:
> 1. In cmakeutils.cpp:
> auto cmake =3D QStandardPaths::findExecutable(QStringLiteral("cmake"=
));
> 2. In usebuilder.cpp:
> QStringList ids =3D CMake::executeProcess(QStringLiteral("cmake"),
> QStringList(QStringLiteral("--help-command-list"))).split(QLatin1Char('\n=
'))
> ;
>=20
> From (2) the "cmake" program is passed to QProcess::start(const QString
> &program, const QStringList &arguments, QIODevice::OpenMode mode =3D
> ReadWrite)
>=20
> 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.
>=20
> Cheers,
> Igor