Closed Erick555 closed 1 year ago
Started test build 15051
Build 15051 successful To test this build, install it from the testing repository:
flatpak install --user https://dl.flathub.org/build-repo/127473/org.qbittorrent.qBittorrent.flatpakref
Some notes for myself.
it overwrites all default cflags/ldflags that come from flatpak runtime (mostly binary hardening stuff).
https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_FLAGS.html
Using CMAKE_INTERPROCEDURAL_OPTIMIZATION variable is canonical approach for using LTO with cmake and it results with -flto=auto being appended to the default build flag set instead of replacing them.
@Erick555
A follow up question, what if I really need to add flags to CMAKE_CXX_FLAGS
? Will this work -DCMAKE_CXX_FLAGS="$CXXFLAGS -flto=auto"
?
@Chocobo1 there is dedicated manifest option for adding build flags to the default set:
build-options:
cflags: -flto=auto
cxxflags: -flto=auto
ldflags: -flto=auto
Example use in manifest: https://github.com/flathub/org.radare.iaito/blob/6b72b2e51b9871460d10595e9a87896a143ee50e/org.radare.iaito.yaml#L41-L42
Those will be added to CFLAGS
/CXXGLAGS
/LDFLAGS
env variables which are honored by cmake when CMAKE_<XXX>_FLAGS
aren't set.
I think variables like -DCMAKE_CXX_FLAGS="$CXXFLAGS -flto=auto
aren't expanded outside buildsystem: simple
so $CXXFLAGS
would be literal $CXXFLAGS
garbage string in your example.
The https://github.com/flathub/org.qbittorrent.qBittorrent/pull/96 (Build with LTO) change has unwanted side-effect - it overwrites all default cflags/ldflags that come from flatpak runtime (mostly binary hardening stuff).
Using
CMAKE_INTERPROCEDURAL_OPTIMIZATION
variable is canonical approach for using LTO with cmake and it results with-flto=auto
being appended to the default build flag set instead of replacing them.cc: @Chocobo1