Compile with -O0 (optimization off) handicap

Aleksey Midenkov midenok at gmail.com
Thu Jun 19 11:47:05 BST 2014


When I compile kdevplatform, it inserts -g -O2:

cd /home/midenok/src/kde/kdevelop/4.6/kdevplatform/build/sublime &&
/usr/bin/c++   -DKDE4_CMAKE_TOPLEVEL_DIR_LENGTH=34
-DKDE_DEFAULT_DEBUG_AREA=9504 -DKDE_DEPRECATED_WARNINGS
-DMAKE_SUBLIME_LIB -DQT_NO_CAST_TO_ASCII -DQT_NO_STL
-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS
-DQURL_NO_CAST_FROM_QSTRING -D_BSD_SOURCE -D_REENTRANT
-D_XOPEN_SOURCE=500 -g -O0 -DDEBUG -Wnon-virtual-dtor -Wno-long-long
-Wundef -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith
-Wformat-security -fno-exceptions -DQT_NO_EXCEPTIONS -fno-check-new
-fno-common -Woverloaded-virtual -fno-threadsafe-statics
-fvisibility=hidden -Werror=return-type -fvisibility-inlines-hidden -g
-O2 -fno-reorder-blocks -fno-schedule-insns -fno-inline -fPIC ...

Attempt to overwrite via CMAKE_CXX_FLAGS or CMAKE_CXX_FLAGS_DEBUG do
not have effect because CMAKE_CXX_FLAGS goes before -g -O2 and
CMAKE_CXX_FLAGS_DEBUG doesn't work at all even with
CMAKE_BUILD_TYPE:STRING=Debug. :(

>From where these -g -O2 go? I can't find them in CMakeCache.txt. There
are all -O2 in CMakeCache.txt and they are different strings:

CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG -DQT_NO_DEBUG
CMAKE_C_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG

So, it's not from CMakeCache.txt.



More information about the KDevelop mailing list