From 7c010585a476d93fa64f44bd4f1df112e1727d57 Mon Sep 17 00:00:00 2001
From: Russell Taylor <taylorrj@ornl.gov>
Date: Thu, 24 Mar 2011 18:20:43 +0000
Subject: [PATCH] Small CMake tidy-up so that people don't see messages that
 aren't relevant to their platform. Re #2525

---
 Code/Mantid/Build/CMake/CommonSetup.cmake |  1 -
 Code/Mantid/Build/CMake/LinuxSetup.cmake  | 10 ++++++++++
 Code/Mantid/CMakeLists.txt                | 15 ++++++++-------
 Code/Mantid/Framework/CMakeLists.txt      | 11 -----------
 Code/Mantid/MantidPlot/CMakeLists.txt     |  8 --------
 5 files changed, 18 insertions(+), 27 deletions(-)
 create mode 100644 Code/Mantid/Build/CMake/LinuxSetup.cmake

diff --git a/Code/Mantid/Build/CMake/CommonSetup.cmake b/Code/Mantid/Build/CMake/CommonSetup.cmake
index 1d4eeea9666..9efcdfe79aa 100644
--- a/Code/Mantid/Build/CMake/CommonSetup.cmake
+++ b/Code/Mantid/Build/CMake/CommonSetup.cmake
@@ -76,7 +76,6 @@ endif ()
 
 find_package ( OpenMP )
 if ( OPENMP_FOUND )
-#  add_definitions ( ${OpenMP_CXX_FLAGS} )
   set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}" )
   set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}" )
 endif ()
diff --git a/Code/Mantid/Build/CMake/LinuxSetup.cmake b/Code/Mantid/Build/CMake/LinuxSetup.cmake
new file mode 100644
index 00000000000..c39329defe3
--- /dev/null
+++ b/Code/Mantid/Build/CMake/LinuxSetup.cmake
@@ -0,0 +1,10 @@
+# Look for tcmalloc. Make it optional, for now at least, but on by default
+set ( USE_TCMALLOC ON CACHE BOOL "Flag for replacing regular malloc with tcmalloc" )
+# Note that this is not mandatory, so no REQUIRED
+find_package ( Tcmalloc )
+# If not found, or not wanted, just carry on without it
+if ( USE_TCMALLOC AND TCMALLOC_FOUND )
+  set ( TCMALLOC_LIBRARY ${TCMALLOC_LIBRARIES} )
+  # Make a C++ define to use as flags in, e.g. MemoryManager.cpp
+  add_definitions ( -DUSE_TCMALLOC )
+endif ()
diff --git a/Code/Mantid/CMakeLists.txt b/Code/Mantid/CMakeLists.txt
index 6f7afd7e2d5..535b9552b4e 100644
--- a/Code/Mantid/CMakeLists.txt
+++ b/Code/Mantid/CMakeLists.txt
@@ -17,20 +17,23 @@ if ( NOT THIRD_PARTY )
   endif ()
 endif ()
 
+# Call our setup script
+include ( CommonSetup )
+
+# Add linux-specific things
+if ( ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" )
+  include ( LinuxSetup )
+endif ()
+
 # Add compiler options if using gcc
 if ( CMAKE_COMPILER_IS_GNUCXX )
   include ( GNUSetup )
 endif ()
 
-# Call our setup script
-include ( CommonSetup )
-
 # Now add the components
 
 add_subdirectory ( Framework )
 
-
-
 # Check for Qt
 find_package ( Qt4 COMPONENTS QtCore QtGui QtOpenGL QtXml QtSvg Qt3Support REQUIRED )
 include ( ${QT_USE_FILE} )
@@ -71,5 +74,3 @@ endif ()
 
 
 
-
-
diff --git a/Code/Mantid/Framework/CMakeLists.txt b/Code/Mantid/Framework/CMakeLists.txt
index bb0bcfd3252..6cedbf33f70 100644
--- a/Code/Mantid/Framework/CMakeLists.txt
+++ b/Code/Mantid/Framework/CMakeLists.txt
@@ -44,17 +44,6 @@ configure_file ( ${PROJECT_SOURCE_DIR}/${HEADER_DIR}/MantidVersion.h.in
 # Look for dependencies - bail out if any necessary oned not found
 ###########################################################################
 
-# Look for tcmalloc. Make it optional, for now at least, but on by default
-set ( USE_TCMALLOC ON CACHE BOOL "Flag for replacing regular malloc with tcmalloc" )
-# Note that this is not mandatory, so no REQUIRED
-find_package ( Tcmalloc )
-# If not found, or not wanted, just carry on without it
-if ( USE_TCMALLOC AND TCMALLOC_FOUND )
-  set ( TCMALLOC_LIBRARY ${TCMALLOC_LIBRARIES} )
-  # Make a C++ define to use as flags in, e.g. MemoryManager.cpp
-  add_definitions ( -DUSE_TCMALLOC )
-endif ()
-
 # Might just as well link everything to Boost & Poco (found in CommonSetup)
 set ( MANTIDLIBS  ${Boost_LIBRARIES} ${POCO_LIBRARIES} ${TCMALLOC_LIBRARY} )
 
diff --git a/Code/Mantid/MantidPlot/CMakeLists.txt b/Code/Mantid/MantidPlot/CMakeLists.txt
index 2fbea30d25d..cac07479992 100644
--- a/Code/Mantid/MantidPlot/CMakeLists.txt
+++ b/Code/Mantid/MantidPlot/CMakeLists.txt
@@ -676,14 +676,6 @@ add_definitions ( -DSCRIPTING_MUPARSER )
 add_definitions ( -DSCRIPTING_PYTHON )
 add_definitions ( -DQSCINTILLA_DLL )     # Will only have an effect on Windows (as is desired)
 
-# ----- USE_TCMALLOC FLAG -----
-set ( USE_TCMALLOC ON CACHE BOOL "Flag for replacing regular malloc with tcmalloc" )
-find_package ( Tcmalloc )
-if ( USE_TCMALLOC AND TCMALLOC_FOUND )
-  # Make a C++ define to use as flags 
-  add_definitions ( -DUSE_TCMALLOC )
-endif ()
-
 include_directories ( src )
 
 set ( SRC_FILES ${QTIPLOT_SRCS} ${MANTID_SRCS} ${SIP_SRC} )
-- 
GitLab