Collections port fix for MSVC 2008 Apparently, TR1 symbols are defined in different namespace comparing to MSVC 2010, which lead to compilation error when using MSVC 2008. Change-Id: I4fa3ceae4b4e2c6e7a46b1fb5b498640e7b18b74
diff --git a/CMakeLists.txt b/CMakeLists.txt index 7518676..df8d1a7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt
@@ -530,9 +530,23 @@ # Use the std namespace for the hash<> and related templates. This may vary by # system. IF (MSVC) - # This is known to work with Visual Studio 2010 Express. - ADD_DEFINITIONS("\"-DCERES_HASH_NAMESPACE_START=namespace std {\"") - ADD_DEFINITIONS("\"-DCERES_HASH_NAMESPACE_END=}\"") + IF (MSVC90) + # Special case for Visual Studio 2008. + # Newer versions have got tr1 symbols in another namespace, + # and this is being handled in Else branch of this condition. + # Probably Visual studio 2003 and 2005 also shall be handled here, + # but don't have by hand to verify and most likely they're not + # used by Ceres users anyway. + ADD_DEFINITIONS("\"-DCERES_HASH_NAMESPACE_START=namespace std { namespace tr1 {\"") + ADD_DEFINITIONS("\"-DCERES_HASH_NAMESPACE_END=}}\"") + ELSE (MSVC90) + # This is known to work with Visual Studio 2010 Express. + # Further, for as long Visual Studio 2012 didn't move tr1 to + # just another namespace, the same define will work for it as well. + # Hopefully all further versions will also keep working with this define. + ADD_DEFINITIONS("\"-DCERES_HASH_NAMESPACE_START=namespace std {\"") + ADD_DEFINITIONS("\"-DCERES_HASH_NAMESPACE_END=}\"") + ENDIF(MSVC90) ELSE (MSVC) # This is known to work with recent versions of Linux and Mac OS X. ADD_DEFINITIONS("\"-DCERES_HASH_NAMESPACE_START=namespace std { namespace tr1 {\"")