CMakeLists.txt turns off optimizations for RelWithDebInfo builds (Bug #1537)


Added by beldenfox - about 13 years ago. Updated almost 13 years ago.


Status:Done Start date:
Priority:Low Due date:
Assignee:Andrey Kamaev % Done:

0%

Category:build/install
Target version:2.4.0
Affected version: Operating System:
Difficulty: HW Platform:
Pull request:

Description

The top-level CMakeLists.txt file contains these lines:

set(CMAKE_C_FLAGS_MINSIZEREL "" CACHE INTERNAL "" FORCE)
set(CMAKE_C_FLAGS_RELWITHDEBINFO "" CACHE INTERNAL "" FORCE)
set(CMAKE_CXX_FLAGS_MINSIZEREL "" CACHE INTERNAL "" FORCE)
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "" CACHE INTERNAL "" FORCE)

These remove the default CMake compiler flags for the RelWithDebInfo and MinSizeRel build types. The end result is that building with CMAKE_BUILD_TYPE set to RelWithDebInfo produces binaries with no optimizations at all which is utterly unexpected; the CMake documentation states that this build type produces optimized code.

RelWithDebInfo is useful for doing profiling runs using the Linux 'perf' tool. This build type should either work as advertised or be prevented from building altogether. Silently producing unoptimized binaries is just confusing.

Using CMake 2.8.3 on an Ubuntu 11.04 x86 system against the OpenCV 2.3.1a tarball.


Associated revisions

Revision 63c6e9d6
Added by Andrey Kamaev almost 13 years ago

#1537 removed suspicious lines clearing optimization flags

History

Updated by Alexander Shishkov about 13 years ago

  • Description changed from The top-level CMakeLists.txt file contains these lines: set(CMAKE_C_FLAGS_MI... to The top-level CMakeLists.txt file contains these lines: set(CMAKE_C_FLAGS_MI... More

Updated by Alexander Shishkov almost 13 years ago

  • Priority changed from High to Normal
  • Target version deleted ()

Updated by Alexander Shishkov almost 13 years ago

  • Priority changed from Normal to Low

Updated by Alexander Shishkov almost 13 years ago

  • Assignee deleted (Vadim Pisarevsky)

Updated by Andrey Kamaev almost 13 years ago

Thanks for reporting!

The lines are removed. But OpenCV provides full support only for "Release" and "Debug" configurations. So "RelWithDebInfo" and "MinRelSize" might loose some compiler options important for the correct build of the library.

  • Status changed from Open to Done
  • Assignee set to Andrey Kamaev

Updated by Alexander Shishkov almost 13 years ago

  • Target version set to 2.4.0

Also available in: Atom PDF