Using libc++ with clang from now on

This also applies a patch to gtest that resolves an issue with building gtest
with libc++. The patch was taken from here:

https://groups.google.com/d/topic/googletestframework/F1B9LArL9_U/discussion
This commit is contained in:
Strahinja Val Markovic 2012-07-19 21:15:25 -07:00
parent f76ee24316
commit e56080ea56
2 changed files with 22 additions and 1 deletions

View File

@ -28,6 +28,7 @@ set( CMAKE_OSX_ARCHITECTURES "i386;x86_64" )
if ( CMAKE_CXX_COMPILER_ID STREQUAL "Clang" ) if ( CMAKE_CXX_COMPILER_ID STREQUAL "Clang" )
set( COMPILER_IS_CLANG true ) set( COMPILER_IS_CLANG true )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++" )
endif() endif()
# Force release build by default, speed is of the essence # Force release build by default, speed is of the essence

View File

@ -250,6 +250,11 @@
# define GTEST_OS_QNX 1 # define GTEST_OS_QNX 1
#endif // __CYGWIN__ #endif // __CYGWIN__
#if __GXX_EXPERIMENTAL_CXX0X__ || __cplusplus >= 201103L
// Compiling in at least C++11 mode.
# define GTEST_LANG_CXX11 1
#endif
// Brings in definitions for functions used in the testing::internal::posix // Brings in definitions for functions used in the testing::internal::posix
// namespace (read, write, close, chdir, isatty, stat). We do not currently // namespace (read, write, close, chdir, isatty, stat). We do not currently
// use them on Windows Mobile. // use them on Windows Mobile.
@ -458,7 +463,8 @@
// Feature Pack download, which we cannot assume the user has. // Feature Pack download, which we cannot assume the user has.
// QNX's QCC compiler is a modified GCC but it doesn't support TR1 tuple. // QNX's QCC compiler is a modified GCC but it doesn't support TR1 tuple.
# if (defined(__GNUC__) && !defined(__CUDACC__) && (GTEST_GCC_VER_ >= 40000) \ # if (defined(__GNUC__) && !defined(__CUDACC__) && (GTEST_GCC_VER_ >= 40000) \
&& !GTEST_OS_QNX) || _MSC_VER >= 1600 && !GTEST_OS_QNX && (GTEST_LANG_CXX11 || !defined(_LIBCPP_VERSION))) \
|| _MSC_VER >= 1600
# define GTEST_USE_OWN_TR1_TUPLE 0 # define GTEST_USE_OWN_TR1_TUPLE 0
# else # else
# define GTEST_USE_OWN_TR1_TUPLE 1 # define GTEST_USE_OWN_TR1_TUPLE 1
@ -473,6 +479,20 @@
# if GTEST_USE_OWN_TR1_TUPLE # if GTEST_USE_OWN_TR1_TUPLE
# include "gtest/internal/gtest-tuple.h" # include "gtest/internal/gtest-tuple.h"
# elif GTEST_LANG_CXX11
# include <tuple>
// C++11 puts its tuple into the ::std namespace rather than
// ::std::tr1. gtest expects tuple to live in ::std::tr1, so put it there.
namespace std {
namespace tr1 {
using ::std::get;
using ::std::make_tuple;
using ::std::tuple;
using ::std::tuple_element;
using ::std::tuple_size;
}
}
# elif GTEST_OS_SYMBIAN # elif GTEST_OS_SYMBIAN
// On Symbian, BOOST_HAS_TR1_TUPLE causes Boost's TR1 tuple library to // On Symbian, BOOST_HAS_TR1_TUPLE causes Boost's TR1 tuple library to