Updated by Alexander Shishkov about 13 years ago
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 [[RelWithDebInfo]] and MinSizeRel [[MinSizeRel]] build types. The end result is that building with CMAKE_BUILD_TYPE set to RelWithDebInfo [[RelWithDebInfo]] produces binaries with no optimizations at all which is utterly unexpected; the CMake documentation states that this build type produces optimized code.
RelWithDebInfo [[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 [[OpenCV]] 2.3.1a tarball.
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 [[RelWithDebInfo]] and MinSizeRel [[MinSizeRel]] build types. The end result is that building with CMAKE_BUILD_TYPE set to RelWithDebInfo [[RelWithDebInfo]] produces binaries with no optimizations at all which is utterly unexpected; the CMake documentation states that this build type produces optimized code.
RelWithDebInfo [[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 [[OpenCV]] 2.3.1a tarball.