https://bugs.kde.org/show_bug.cgi?id=360249

--- Comment #6 from Jan Kundrát <j...@kde.org> ---
(In reply to Hohyeis from comment #4)
> Surprise: CXXFLAGS does not override all compiler parameters, including the
> optimization.
> 
> cmake -DCMAKE_CXX_FLAGS=-O0 ../trojita
> make -j1 CXXFLAGS=-O0 VERBOSE=1

I am not sure what is the best way, cmake-wise, but I suspect it is this:

1) start from scratch
2) pass the CXXFLAGS as an env var to cmake, like this:
`CXXFLAGS="-march=native -Og" cmake /path/to/source`
3) just run `make` with no additional parameters

The end result which you'll get is something like compiler being executed with
options such as `g++ -O2 -I/something -isystem /path/to/qt -Og -c foo.cpp -o
CMakeFiles/foo.o`. Note that in this compiler's invocation, flags which come
later on take precedence, so even though -O2 appears here, it will be built
with -Og.

> There is a second '-O2' which overrides the '-O0'.

Please show us a full, unredacted compiler invocation if you think that there's
a bug. It would be interesting to know if you start by `cmake
-DCMAKE_CXX_FLAGS=...` or by `CXXFLAGS=... cmake ...`.

> Build time for a single process 'make' build was 27 minutes, not including
> 'make install', which compiled and linked things for more than 1 minute.

Just out of curiosity, what platform and what sort of hardware are you on? If
you have multiple CPU cores, there's also the option of using the -j parameter
for make.

Also, the build can be sped up quite a bit by passing -GNinja to cmake and
running `ninja` instead of `make` if it's available on your platform.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to