From 5452360c21c19d72f9ab9441afb4f99b56bd3df3 Mon Sep 17 00:00:00 2001
From: Kitty Barnett <none@none>
Date: Sun, 22 Aug 2010 05:57:21 +0200
Subject: [PATCH] [Viewer/Build] - added: imported SNOW-788 - Fix boost lib
 detection with Visual Studio to allow multiple VS versions

--HG--
branch : Viewer-Build
---
 indra/cmake/00-Common.cmake | 14 ++++++++++++
 indra/cmake/Boost.cmake     | 45 ++++++++++++++++++++-----------------
 2 files changed, 38 insertions(+), 21 deletions(-)

diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake
index 2dd65e247d..8ba2d92b3e 100644
--- a/indra/cmake/00-Common.cmake
+++ b/indra/cmake/00-Common.cmake
@@ -78,6 +78,20 @@ if (WINDOWS)
   # configure win32 API for windows XP+ compatibility
   set(WINVER "0x0501" CACHE STRING "Win32 API Target version (see http://msdn.microsoft.com/en-us/library/aa383745%28v=VS.85%29.aspx)")
   add_definitions("/DWINVER=${WINVER}" "/D_WIN32_WINNT=${WINVER}")
+    
+  # Various libs are compiler specific, generate some variables here we can just use
+  # when we require them instead of reimplementing the test each time.
+  if (MSVC71)
+	set(MSVC_DIR 7.1)
+	set(MSVC_SUFFIX 71)
+  elseif (MSVC80)
+	set(MSVC_DIR 8.0)
+	set(MSVC_SUFFIX 80)
+  elseif (MSVC90)
+	set(MSVC_DIR 9.0)
+	set(MSVC_SUFFIX 90)
+  endif (MSVC71)
+  
 endif (WINDOWS)
 
 
diff --git a/indra/cmake/Boost.cmake b/indra/cmake/Boost.cmake
index 7ce57a5572..dcbc801663 100644
--- a/indra/cmake/Boost.cmake
+++ b/indra/cmake/Boost.cmake
@@ -16,27 +16,30 @@ else (STANDALONE)
 
   if (WINDOWS)
     set(BOOST_VERSION 1_39)
-    if (MSVC71)
-      set(BOOST_PROGRAM_OPTIONS_LIBRARY 
-          optimized libboost_program_options-vc71-mt-s-${BOOST_VERSION}
-          debug libboost_program_options-vc71-mt-sgd-${BOOST_VERSION})
-      set(BOOST_REGEX_LIBRARY
-          optimized libboost_regex-vc71-mt-s-${BOOST_VERSION}
-          debug libboost_regex-vc71-mt-sgd-${BOOST_VERSION})
-      set(BOOST_SIGNALS_LIBRARY 
-          optimized libboost_signals-vc71-mt-s-${BOOST_VERSION}
-          debug libboost_signals-vc71-mt-sgd-${BOOST_VERSION})
-    else (MSVC71)
-      set(BOOST_PROGRAM_OPTIONS_LIBRARY 
-          optimized libboost_program_options-vc80-mt-${BOOST_VERSION}
-          debug libboost_program_options-vc80-mt-gd-${BOOST_VERSION})
-      set(BOOST_REGEX_LIBRARY
-          optimized libboost_regex-vc80-mt-${BOOST_VERSION}
-          debug libboost_regex-vc80-mt-gd-${BOOST_VERSION})
-      set(BOOST_SIGNALS_LIBRARY 
-          optimized libboost_signals-vc80-mt-${BOOST_VERSION}
-          debug libboost_signals-vc80-mt-gd-${BOOST_VERSION})
-    endif (MSVC71)
+   
+	# SNOW-788
+	# 00-Common.cmake alreay sets MSVC_SUFFIX to be correct for the VS we are using eg VC71, VC80, VC90 etc
+	# The precompiled boost libs for VC71 use a different suffix to VS80 and VS90
+	# This code should ensure the cmake rules are valid for any VS being used in future as long as the approprate
+	# boost libs are avaiable - RC.
+	
+	if (MSVC71)
+	    set(BOOST_OPTIM_SUFFIX mt-s)
+	    set(BOOST_DEBUG_SUFFIX mt-sgd)
+	else (MSVC71)
+	    set(BOOST_OPTIM_SUFFIX mt)
+	    set(BOOST_DEBUG_SUFFIX mt-gd)
+	endif (MSVC71)
+		
+    set(BOOST_PROGRAM_OPTIONS_LIBRARY 
+          optimized libboost_program_options-vc${MSVC_SUFFIX}-${BOOST_OPTIM_SUFFIX}-${BOOST_VERSION}
+          debug libboost_program_options-vc${MSVC_SUFFIX}-${BOOST_DEBUG_SUFFIX}-${BOOST_VERSION})
+    set(BOOST_REGEX_LIBRARY
+          optimized libboost_regex-vc${MSVC_SUFFIX}-${BOOST_OPTIM_SUFFIX}-${BOOST_VERSION}
+          debug libboost_regex-vc${MSVC_SUFFIX}-${BOOST_DEBUG_SUFFIX}-${BOOST_VERSION})
+    set(BOOST_SIGNALS_LIBRARY 
+          optimized libboost_signals-vc${MSVC_SUFFIX}-${BOOST_OPTIM_SUFFIX}-${BOOST_VERSION}
+          debug libboost_signals-vc${MSVC_SUFFIX}-${BOOST_DEBUG_SUFFIX}-${BOOST_VERSION})
   elseif (DARWIN)
     set(BOOST_PROGRAM_OPTIONS_LIBRARY boost_program_options-xgcc40-mt)
     set(BOOST_REGEX_LIBRARY boost_regex-xgcc40-mt)
-- 
GitLab