[Insight-developers] -ftemplate-depth-50

Hans J. Johnson hans-johnson@uiowa.edu
03 Feb 2003 19:20:27 -0600


Hello,

I am trying to compile an application that links against the ITK
libraries.  I have specified that the toolkit is to use the following
compiler flags for both the ITK libraries and my application:
"-g -fstrict-aliasing -UNDEBUG  -Wall -Wcast-qual -Wstrict-prototypes". 
The problem occurs when I attempt to compile my application I get the
following cmake error:
"SEND_WARNINGThe selected ITK was built with C++ compiler flags " -g
-fstrict-aliasing -UNDEBUG  -Wall -Wcast-qual -Wstrict-prototypes
-ftemplate-depth-50", but the current flags are " -g -fstrict-aliasing
-UNDEBUG  -Wall -Wcast-qual -Wstrict-prototypes".  Please set
CMAKE_CXX_FLAGS to " -g -fstrict-aliasing -UNDEBUG  -Wall -Wcast-qual
-Wstrict-prototypes -ftemplate-depth-50"."

I have noticed that the confounding compiler option -ftemplate-depth-50
is defined in Insight/itkCMakeOptions.cmake.  

1) Is this flag really needed?  Do other compilers require similar
flags? 
 -ftemplate-depth-n
   Set the maximum instantiation depth for template classes to n.  A
   limit on the template instantiation depth is needed to detect end-
   less recursions during template class instantiation.  ANSI/ISO C++
   conforming programs must not rely on a maximum depth greater than
   17.

2)  Do all applications require a CmakeOptions.cmake file with
IF(CMAKE_COMPILER_IS_GNUCXX)
  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-depth-50")
  IF(APPLE)
    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-long-double")
  ENDIF(APPLE)
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
in it?



Thanks, 
Hans J. Johnson
hans-johnson@uiowa.edu