Using `-flto` on clang without using the gold linker produces the error: ```main.o: file not recognized: File format not recognized``` https://github.com/android/ndk/issues/242 `gold` seems to be faster than `ld`, and decently tested even in 2010: https://stackoverflow.com/questions/3476093/replacing-ld-with-gold-any-experience Qmake will still append `-Wl,-O1` even though higher optimization levels are used. Removing this in order to keep the compile command as short as possible, and to reduce weird issues down the line. Ref topic: https://stackoverflow.com/questions/53384988/why-qmake-passes-wl-o1-to-gcc-when-linking-and-will-it-harm-lto
17 lines
383 B
Plaintext
17 lines
383 B
Plaintext
QMAKE_CXXFLAGS += -Wextra
|
|
|
|
QMAKE_CXXFLAGS += -Wshadow
|
|
|
|
QMAKE_CXXFLAGS += -Wold-style-cast
|
|
|
|
QMAKE_CXXFLAGS += -Wnon-virtual-dtor
|
|
|
|
QMAKE_CXXFLAGS += -Wcast-align -Wunused -Woverloaded-virtual -Wformat=2
|
|
|
|
QMAKE_CXXFLAGS += -Wdouble-promotion
|
|
|
|
# Enable Link Time Optimization
|
|
QMAKE_CXXFLAGS += -flto
|
|
# Clang LTO requires the gold linker instead of ld
|
|
QMAKE_LFLAGS += -flto -fuse-ld=gold
|