Cmake template-depth problem

Issue #98 resolved
Frank Dellaert created an issue

@richardroberts, @cbeall3

@jdong37 and I found the following in gtsam cmake stuff:

# Clang on Mac uses a template depth that is less than standard and is too small
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
    if(NOT "${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "5.0")
        add_definitions(-ftemplate-depth=1024)
    endif()
endif()

But, this seems wrong: add_definitions is for defines, not compiler flags. The issue is that this adds a C flag also to a fortran compiler (so we’re stuck).

What is the right way to do this?

Major as means we can't compile ransac w 5-point on mac now...

Comments (4)

  1. Chris Beall

    Try replacing the add_definitions line with this:

    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-depth=1024")
    
  2. Jing Dong

    I have tested it works on my side, and push the commit. But @cbeall3 do you think we need to test it on Clang since it for Clang? I have just tested it on GCC.

  3. Log in to comment