CMake: Silence messages about unordered map and shared pointer on second run
authorSergey Sharybin <sergey.vfx@gmail.com>
Thu, 14 Jan 2016 07:57:58 +0000 (12:57 +0500)
committerSergey Sharybin <sergey.vfx@gmail.com>
Thu, 14 Jan 2016 07:57:58 +0000 (12:57 +0500)
This variables are being cached anyway and can only be changed on first run,
no need to keep reporting them again and again.

build_files/cmake/macros.cmake

index a8e17c3b5ef20b86fd35ab98307bc611bf008538..edc5cf925c9fa9c95d65cf36a08204a10e02e94a 100644 (file)
@@ -810,17 +810,24 @@ macro(TEST_STDBOOL_SUPPORT)
        HAVE_STDBOOL_H)
 endmacro()
 
+# Only print message if running CMake first time
+macro(message_first_run)
+       if(FIRST_RUN)
+               message(${ARGV})
+       endif()
+endmacro()
+
 macro(TEST_UNORDERED_MAP_SUPPORT)
        # - Detect unordered_map availability
        # Test if a valid implementation of unordered_map exists
        # and define the include path
        # This module defines
        #  HAVE_UNORDERED_MAP, whether unordered_map implementation was found
-       #  
+       #
        #  HAVE_STD_UNORDERED_MAP_HEADER, <unordered_map.h> was found
        #  HAVE_UNORDERED_MAP_IN_STD_NAMESPACE, unordered_map is in namespace std
        #  HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE, unordered_map is in namespace std::tr1
-       #  
+       #
        #  UNORDERED_MAP_INCLUDE_PREFIX, include path prefix for unordered_map, if found
        #  UNORDERED_MAP_NAMESPACE, namespace for unordered_map, if found
 
@@ -844,7 +851,7 @@ macro(TEST_UNORDERED_MAP_SUPPORT)
                                          }"
                                          HAVE_UNORDERED_MAP_IN_STD_NAMESPACE)
                if(HAVE_UNORDERED_MAP_IN_STD_NAMESPACE)
-                       message(STATUS "Found unordered_map/set in std namespace.")
+                       message_first_run(STATUS "Found unordered_map/set in std namespace.")
 
                        set(HAVE_UNORDERED_MAP "TRUE")
                        set(UNORDERED_MAP_INCLUDE_PREFIX "")
@@ -857,26 +864,26 @@ macro(TEST_UNORDERED_MAP_SUPPORT)
                                                  }"
                                                  HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE)
                        if(HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE)
-                               message(STATUS "Found unordered_map/set in std::tr1 namespace.")
+                               message_first_run(STATUS "Found unordered_map/set in std::tr1 namespace.")
 
                                set(HAVE_UNORDERED_MAP "TRUE")
                                set(UNORDERED_MAP_INCLUDE_PREFIX "")
                                set(UNORDERED_MAP_NAMESPACE "std::tr1")
                        else()
-                               message(STATUS "Found <unordered_map> but cannot find either std::unordered_map "
-                                       "or std::tr1::unordered_map.")
+                               message_first_run(STATUS "Found <unordered_map> but cannot find either std::unordered_map "
+                                                 "or std::tr1::unordered_map.")
                        endif()
                endif()
        else()
                CHECK_INCLUDE_FILE_CXX("tr1/unordered_map" HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE)
                if(HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE)
-                       message(STATUS "Found unordered_map/set in std::tr1 namespace.")
+                       message_first_run(STATUS "Found unordered_map/set in std::tr1 namespace.")
 
                        set(HAVE_UNORDERED_MAP "TRUE")
                        set(UNORDERED_MAP_INCLUDE_PREFIX "tr1")
                        set(UNORDERED_MAP_NAMESPACE "std::tr1")
                else()
-                       message(STATUS "Unable to find <unordered_map> or <tr1/unordered_map>. ")
+                       message_first_run(STATUS "Unable to find <unordered_map> or <tr1/unordered_map>. ")
                endif()
        endif()
 endmacro()
@@ -913,7 +920,7 @@ macro(TEST_SHARED_PTR_SUPPORT)
                                          HAVE_SHARED_PTR_IN_STD_NAMESPACE)
 
                if(HAVE_SHARED_PTR_IN_STD_NAMESPACE)
-                       message("-- Found shared_ptr in std namespace using <memory> header.")
+                       message_first_run("-- Found shared_ptr in std namespace using <memory> header.")
                        set(SHARED_PTR_FOUND TRUE)
                else()
                        CHECK_CXX_SOURCE_COMPILES("#include <memory>
@@ -923,7 +930,7 @@ macro(TEST_SHARED_PTR_SUPPORT)
                                                   }"
                                                  HAVE_SHARED_PTR_IN_TR1_NAMESPACE)
                        if(HAVE_SHARED_PTR_IN_TR1_NAMESPACE)
-                               message("-- Found shared_ptr in std::tr1 namespace using <memory> header.")
+                               message_first_run("-- Found shared_ptr in std::tr1 namespace using <memory> header.")
                                set(SHARED_PTR_TR1_NAMESPACE TRUE)
                                set(SHARED_PTR_FOUND TRUE)
                        endif()
@@ -944,7 +951,7 @@ macro(TEST_SHARED_PTR_SUPPORT)
                                                   }"
                                                   HAVE_SHARED_PTR_IN_TR1_NAMESPACE_FROM_TR1_MEMORY_HEADER)
                        if(HAVE_SHARED_PTR_IN_TR1_NAMESPACE_FROM_TR1_MEMORY_HEADER)
-                               message("-- Found shared_ptr in std::tr1 namespace using <tr1/memory> header.")
+                               message_first_run("-- Found shared_ptr in std::tr1 namespace using <tr1/memory> header.")
                                set(SHARED_PTR_TR1_MEMORY_HEADER TRUE)
                                set(SHARED_PTR_TR1_NAMESPACE TRUE)
                                set(SHARED_PTR_FOUND TRUE)