diff --git a/docs/source/version_history.rst b/docs/source/version_history.rst index d1a19901d..ee082c453 100644 --- a/docs/source/version_history.rst +++ b/docs/source/version_history.rst @@ -27,6 +27,9 @@ New Features Bug Fixes & Minor Changes ------------------------- +#. Remove use of link-time optimisation (LTO) for all compilers due to + portability issues with gtest / type_info::operator== & Eigen with + Clang on OS X vs GCC 4.9+ on Linux requiring contradictory 'fixes'. #. Use link-time optimisation (LTO) only when compiling Ceres itself, not tests or examples, to bypass gtest / type_info::operator== issue. #. Use old minimum iOS version flags on Xcode < 7.0. diff --git a/internal/ceres/CMakeLists.txt b/internal/ceres/CMakeLists.txt index cc2cb8970..3a51309d9 100644 --- a/internal/ceres/CMakeLists.txt +++ b/internal/ceres/CMakeLists.txt @@ -201,23 +201,6 @@ if (NOT WIN32 AND NOT BUILD_SHARED_LIBS) endif() endif() -# Use of -flto requires use of gold linker & LLVM-gold plugin, which might -# well not be present / in use and without which files will compile, but -# not link ('file not recognized') so explicitly check for support. -# -# Only use link-time optimisation (LTO) flags when building Ceres itself, as it -# causes an issue with type_info::operator==() in gtest's -# CheckedDowncastToActualType() in levenberg_marquardt_strategy_test & -# gradient_checking_cost_function_test if enabled for the tests as well. -include(CheckCXXCompilerFlag) -check_cxx_compiler_flag("-flto" HAVE_LTO_SUPPORT) -if (HAVE_LTO_SUPPORT) - message(STATUS "Enabling link-time optimization (-flto)") - append_target_property(ceres COMPILE_FLAGS "-flto") -else () - message(STATUS "Compiler/linker does not support link-time optimization (-flto).") -endif (HAVE_LTO_SUPPORT) - if (CMAKE_VERSION VERSION_LESS "2.8.12") # CMake version < 2.8.12 does not support target_compile_options(), warn # user that they will have to add compile flags to their own projects