Skip to content

Commit

Permalink
Disable -flto compiler option on clang compiler. openMVG#102
Browse files Browse the repository at this point in the history
  • Loading branch information
pmoulon committed Jul 4, 2014
1 parent b6362a4 commit daad6ab
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/third_party/ceres-solver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -547,19 +547,19 @@ IF (CMAKE_BUILD_TYPE STREQUAL "Release")
ENDIF (GCC_VERSION VERSION_LESS 4.3)
ENDIF (CMAKE_SYSTEM_NAME MATCHES "Darwin")
ENDIF (CMAKE_COMPILER_IS_GNUCXX)
IF (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
# 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
INCLUDE(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-flto" HAVE_LTO_SUPPORT)
IF (HAVE_LTO_SUPPORT)
MESSAGE(STATUS "Enabling link-time optimization (-flto)")
SET(CERES_CXX_FLAGS "${CERES_CXX_FLAGS} -flto")
ELSE ()
MESSAGE(STATUS "Compiler/linker does not support link-time optimization (-flto), disabling.")
ENDIF (HAVE_LTO_SUPPORT)
ENDIF ()
# IF (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
# # 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
# INCLUDE(CheckCXXCompilerFlag)
# CHECK_CXX_COMPILER_FLAG("-flto" HAVE_LTO_SUPPORT)
# IF (HAVE_LTO_SUPPORT)
# MESSAGE(STATUS "Enabling link-time optimization (-flto)")
# SET(CERES_CXX_FLAGS "${CERES_CXX_FLAGS} -flto")
# ELSE ()
# MESSAGE(STATUS "Compiler/linker does not support link-time optimization (-flto), disabling.")
# ENDIF (HAVE_LTO_SUPPORT)
# ENDIF ()
ENDIF (CMAKE_BUILD_TYPE STREQUAL "Release")

SET (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${CERES_CXX_FLAGS}")
Expand Down

0 comments on commit daad6ab

Please sign in to comment.