<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
I am trying to build ITK-4.8.0 on OSX using Xcode 6.2 and CMake
3.3.0-rc4. What I need to do is build it with CMAKE_CXX_FLAGS =
-stdlib=libstdc++ so as to use the GNU C++ library. The problem is
that during the initial CMake configuration it is assumed that
libc++ will be used and this leads to the following bit of output:<br>
<blockquote>Looking for C++ include tr1/type_traits<br>
Looking for C++ include tr1/type_traits - not found<br>
Looking for C++ include type_traits<br>
Looking for C++ include type_traits - found<br>
</blockquote>
This shows up in itkConfigure.h like this:<br>
<blockquote><tt>// defined if the system has <tr1/type_traits>
header</tt><tt><br>
</tt><tt>/* #undef ITK_HAS_STLTR1_TR1_TYPE_TRAITS */</tt><tt><br>
</tt><tt>// defined if the system has <type_traits> header</tt><tt><br>
</tt><tt>#define ITK_HAS_STLTR1_TYPE_TRAITS</tt><tt><br>
</tt><tt>// defined if std type traits are with C++11 ( no tr1
namespace )</tt><tt><br>
</tt><tt>#define ITK_HAS_CPP11_TYPETRAITS</tt><tt><br>
</tt></blockquote>
If I set CMAKE_CXX_FLAGS = -stdlib=libstdc++ the compiler seems to
understand what I want and uses the GNU headers. The problem is that
the <tt>#define</tt> derails the compilation in
itkImageAlgorithm.h on the second line below because it is looking
for the wrong file.<br>
<blockquote><tt>#ifdef ITK_HAS_STLTR1_TYPE_TRAITS</tt><tt><br>
</tt><tt># include <type_traits></tt><tt><br>
</tt><tt>#elif defined ITK_HAS_STLTR1_TR1_TYPE_TRAITS</tt><tt><br>
</tt><tt># include <tr1/type_traits></tt><tt><br>
</tt><tt>#else</tt><tt><br>
</tt><tt># include "itkIsSame.h"</tt><tt><br>
</tt><tt>#endif</tt><tt><br>
<br>
</tt></blockquote>
Leading to the error:<br>
<br>
<blockquote><tt>/Users/tim/devel/InsightToolkit-4.8.0/Modules/Core/Common/include/itkImageAlgorithm.h:24:12:
fatal error: 'type_traits' file not found</tt><br>
<tt># include <type_traits></tt><br>
</blockquote>
<br>
Is there any way of telling CMake that it's first guess of which C++
library I want to use is wrong?<br>
<br>
Thanks.<br>
<br>
<pre class="moz-signature" cols="72">--
Tim Allman, Ph.D.
35 Margaret Street,
Guelph Ontario N1E 5R6
Canada
</pre>
</body>
</html>