← Back to issue list

feat(gnome): add cmake prefix path

View original Github issue

Metadata

Project
snapcraft
Number
#5461
Type
pull request
State
merged
Author
mr-cal
Labels
Created
Updated
Closed

Current evaluation

Merged to resolve #5272. Injects CMAKE_PREFIX_PATH into the GNOME extension environment to prevent conflicts with part-level cmake parameters, fixing build failures for affected snaps like Remmina.

Suggested action:

No scores available.

Issue body

- [x] Have you followed the [guidelines for contributing](https://github.com/canonical/snapcraft/blob/main/CONTRIBUTING.md)? - [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)? - [x] Have you successfully run `make lint`? - [x] Have you successfully run `make test`? --- Testing on a few snaps in the wild that use the gnome extension and have a part that uses `cmake`: | snap | builds? | | - | - | | [Parabolic](https://github.com/NickvisionApps/Parabolic/blob/main/snap/snapcraft.yaml) | ✅ | | [gnome-clocks](https://github.com/ubuntu/gnome-clocks/blob/stable/snapcraft.yaml) | ✅ | | [gnome-chess](https://github.com/ubuntu/gnome-chess/blob/stable/snapcraft.yaml) | ✅ | | [telegram-desktop](https://github.com/telegramdesktop/tdesktop/blob/dev/snap/snapcraft.yaml) | ✅ | | [remmina](https://github.com/FreeRDP/Remmina/blob/master/snap/snapcraft.yaml) |❌ | | [handbrake](https://github.com/robxnano/handbrake-snap/blob/main/snapcraft.yaml) | ✅ | | [multipass](https://github.com/marceloneppel/multipass/blob/main/snap/snapcraft.yaml) |✅ | | [warzone 2100](https://github.com/Warzone2100/warzone2100/blob/master/snapcraft.yaml) |✅ | This breaks snaps that: * use the gnome extension * build a part with the cmake plugin and define `cmake-parameters: [-DCMAKE_PREFIX_PATH=...]` What happens is that the gnome extension adds a `build-environment: [CMAKE_PREFIX_PATH: ...]`. CMake appears to merge both values rather than one overriding the other ([source](https://cmake.org/cmake/help/latest/variable/CMAKE_PREFIX_PATH.html)). I was able to fix [Remmina](https://github.com/FreeRDP/Remmina/blob/master/snap/snapcraft.yaml) with this change: ```diff parts: remmina: plugin: cmake ... cmake-parameters: - -DCMAKE_BUILD_TYPE=Release - -DWITH_FREERDP3=ON - -DWITH_KF5WALLET=ON - -DWITH_GVNC=ON - -DWITH_X2GO=ON - -DWITH_PYTHON=ON - - -DCMAKE_PREFIX_PATH=$CRAFT_STAGE/usr - -DSNAP_BUILD=on # XXX: This is an hack to have a kind of bind-mount with absolute prefix. - -DCMAKE_INSTALL_PREFIX=/snap/$CRAFT_PROJECT_NAME/current/usr + build-environment: + - CMAKE_PREFIX_PATH: $CRAFT_STAGE/usr ``` Fixes #5272 (SNAPCRAFT-1024)

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.6-35b-a3b Merged to resolve #5272. Injects CMAKE_PREFIX_PATH into the GNOME extension environment to prevent conflicts with part-level cmake parameters, fixing build failures for affected snaps like Remmina.
qwen3.6-35b-a3b-mtp-q6 Merged. Moves CMAKE_PREFIX_PATH to the GNOME extension's build-environment to prevent CMake from merging conflicting values. Fixes snap builds failing when using custom cmake-parameters with the GNOME extension. Resolves #5272.
qwen3.6-35b-a3b-mtp-q6 Merged. Adds CMAKE_PREFIX_PATH to the GNOME extension build-environment to override conflicting cmake-parameters. Resolves build failures for affected snaps, fixing #5272. Maintainers will be notified via release notes.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#5589 fix(gnome): update cmake prefix path snapcraft merged Merged fix updating the cmake prefix path to usr for GNOME. Follows up on #5272 and complements the KDE fix in #5585. Approved by three reviewers, passed CI checks, and integrated into the main branch.
79%
#5272 CMAKE_PREFIX_PATH is not set with gnome extenstion snapcraft closed Fixed in Snapcraft by correctly setting CMAKE_PREFIX_PATH to $CRAFT_STAGE/usr and the SDK path. An initial patch used incorrect paths, but a corrected fix merged via PR 5589 resolved the cmake build failure and was verified by the reporter.
73%
#5515 feat(gnome): Add SNAPCRAFT_GNOME_SDK env snapcraft merged Merged addition of the SNAPCRAFT_GNOME_SDK environment variable to expose the GNOME SDK snap path, eliminating hardcoded values. Approved by three reviewers and passing CI, the change modifies three files with six lines added.
70%