[Cmake-commits] CMake branch, next, updated. v2.8.11-2288-g14bc56a

Stephen Kelly steveire at gmail.com
Tue May 28 14:39:04 EDT 2013


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  14bc56ac6962a4cf8768b8a91d7634628ba7e9ff (commit)
       via  31084c207d23c98f85f160ab98e37ff8a705818c (commit)
      from  ffabbf861be0e5012581f5c0cecea703606a6f72 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=14bc56ac6962a4cf8768b8a91d7634628ba7e9ff
commit 14bc56ac6962a4cf8768b8a91d7634628ba7e9ff
Merge: ffabbf8 31084c2
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue May 28 14:39:01 2013 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue May 28 14:39:01 2013 -0400

    Merge topic 'suppress-unused-cli-with-value-in-cache' into next
    
    31084c2 CLI: Suppress the unused warning if the key value pair is cached.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=31084c207d23c98f85f160ab98e37ff8a705818c
commit 31084c207d23c98f85f160ab98e37ff8a705818c
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu May 16 21:51:45 2013 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Tue May 28 20:38:18 2013 +0200

    CLI: Suppress the unused warning if the key value pair is cached.
    
    It is common to specify a CMAKE_TOOLCHAIN_FILE and get a warning
    for using it despite it not being used.
    
    The WarnUnusedCliUnused test relies on the warning being emitted
    each time cmake is run on an existing build. That behavior is changed
    by this patch to warn only on the first invokation of CMake, and not
    on subsequent invokations (because the variable is in the cache with
    the same value). For that test, a clean target is added which clears
    the cache and cause the warning to be emitted each time.
    
    As the Ninja generator does not support the feature needed to test
    this, it is not tested with that generator.

diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index 864df8e..ed09545 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -750,6 +750,10 @@ void cmCacheManager::AddCacheEntry(const char* key,
     }
   e.SetProperty("HELPSTRING", helpString? helpString :
                 "(This variable does not exist and should not be used)");
+  if (this->Cache[key].Value == e.Value)
+    {
+    this->CMakeInstance->UnwatchUnusedCli(key);
+    }
   this->Cache[key] = e;
 }
 
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index ae62edb..e757f3a 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -383,11 +383,22 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
       cmCacheManager::CacheEntryType type = cmCacheManager::UNINITIALIZED;
       if(cmCacheManager::ParseEntry(entry.c_str(), var, value, type))
         {
+        // The value is transformed if it is a filepath for example, so
+        // we can't compare whether the value is already in the cache until
+        // after we call AddCacheEntry.
+        const char *cachedValue =
+                              this->CacheManager->GetCacheValue(var.c_str());
+
         this->CacheManager->AddCacheEntry(var.c_str(), value.c_str(),
           "No help, variable specified on the command line.", type);
         if(this->WarnUnusedCli)
           {
-          this->WatchUnusedCli(var.c_str());
+          if (!cachedValue
+              || strcmp(this->CacheManager->GetCacheValue(var.c_str()),
+                        cachedValue) != 0)
+            {
+            this->WatchUnusedCli(var.c_str());
+            }
           }
         }
       else
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 0b221e8..e37c96b 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1618,17 +1618,20 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
     FAIL_REGULAR_EXPRESSION "CMake Warning .*VariableUnusedViaUnset.CMakeLists.txt:5 \\(set\\):")
   list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WarnUnusedUnusedViaUnset")
 
-  add_test(WarnUnusedCliUnused ${CMAKE_CTEST_COMMAND}
-    --build-and-test
-    "${CMake_SOURCE_DIR}/Tests/VariableUsage"
-    "${CMake_BINARY_DIR}/Tests/WarnUnusedCliUnused"
-    ${build_generator_args}
-    --build-noclean
-    --build-project WarnUnusedCliUnused
-    --build-options "-DUNUSED_CLI_VARIABLE=Unused")
-  set_tests_properties(WarnUnusedCliUnused PROPERTIES
-    PASS_REGULAR_EXPRESSION "CMake Warning:.*Manually-specified variables were not used by the project:.*  UNUSED_CLI_VARIABLE")
-  list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WarnUnusedCliUnused")
+  if (NOT CMAKE_TEST_GENERATOR MATCHES "Ninja")
+    # Ninja does not support ADDITIONAL_MAKE_CLEAN_FILES and therefore fails
+    # this test. (See #13371)
+    add_test(WarnUnusedCliUnused ${CMAKE_CTEST_COMMAND}
+      --build-and-test
+      "${CMake_SOURCE_DIR}/Tests/VariableUsage"
+      "${CMake_BINARY_DIR}/Tests/WarnUnusedCliUnused"
+      ${build_generator_args}
+      --build-project WarnUnusedCliUnused
+      --build-options "-DUNUSED_CLI_VARIABLE=Unused")
+    set_tests_properties(WarnUnusedCliUnused PROPERTIES
+      PASS_REGULAR_EXPRESSION "CMake Warning:.*Manually-specified variables were not used by the project:.*  UNUSED_CLI_VARIABLE")
+    list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WarnUnusedCliUnused")
+  endif()
 
   add_test(WarnUnusedCliUsed ${CMAKE_CTEST_COMMAND}
     --build-and-test
diff --git a/Tests/VariableUsage/CMakeLists.txt b/Tests/VariableUsage/CMakeLists.txt
index 4da1f56..cac9830 100644
--- a/Tests/VariableUsage/CMakeLists.txt
+++ b/Tests/VariableUsage/CMakeLists.txt
@@ -1 +1,9 @@
+cmake_minimum_required(VERSION 2.8)
+
 message(STATUS "${USED_VARIABLE}")
+
+set_directory_properties(PROPERTIES
+  ADDITIONAL_MAKE_CLEAN_FILES "${CMAKE_BINARY_DIR}/CMakeCache.txt"
+)
+
+add_library(dummy empty.cpp)
diff --git a/Tests/VariableUsage/empty.cpp b/Tests/VariableUsage/empty.cpp
new file mode 100644
index 0000000..7279c5e
--- /dev/null
+++ b/Tests/VariableUsage/empty.cpp
@@ -0,0 +1,7 @@
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+int empty(void)
+{
+  return 0;
+}

-----------------------------------------------------------------------

Summary of changes:
 Source/cmCacheManager.cxx                        |    4 +++
 Source/cmake.cxx                                 |   13 ++++++++++-
 Tests/CMakeLists.txt                             |   25 ++++++++++++---------
 Tests/VariableUsage/CMakeLists.txt               |    8 +++++++
 Tests/{LibName/bar.c => VariableUsage/empty.cpp} |    4 +-
 5 files changed, 40 insertions(+), 14 deletions(-)
 copy Tests/{LibName/bar.c => VariableUsage/empty.cpp} (62%)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list