[Cmake-commits] CMake branch, master, updated. v3.12.2-665-g76a19eb

Kitware Robot kwrobot at kitware.com
Wed Sep 19 10:35:05 EDT 2018


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, master has been updated
       via  76a19eb6c16272e4600267aed6ed7aff0fd9c765 (commit)
       via  2428422c02de1feac008d2ba1a6ad075aaf7ba2c (commit)
       via  d686f81e58200c68c1e89094210e9587e0e90983 (commit)
      from  3ada513413e2a911efac2de2c90bbebd820fef5d (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 -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=76a19eb6c16272e4600267aed6ed7aff0fd9c765
commit 76a19eb6c16272e4600267aed6ed7aff0fd9c765
Merge: 3ada513 2428422
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Sep 19 14:32:55 2018 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Wed Sep 19 10:33:01 2018 -0400

    Merge topic 'fix-getsafedef-stdstring'
    
    2428422c02 Fix regression in target output file naming logic
    d686f81e58 Restore possibly regressed CMP0018 logic
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !2402


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2428422c02de1feac008d2ba1a6ad075aaf7ba2c
commit 2428422c02de1feac008d2ba1a6ad075aaf7ba2c
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Sep 19 07:43:34 2018 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Sep 19 08:14:48 2018 -0400

    Fix regression in target output file naming logic
    
    Refactoring in commit f4ff60a803 (cmMakefile: Make GetSafeDefinition
    return std::string const&, 2018-09-05) accidentally changed the logic
    for target artifact prefix and suffix names such that setting a PREFIX
    or SUFFIX target property would cause an empty value to be used.  Revert
    that part of the change and use a simpler alternative.  Add a test case.
    
    Reported-by: Alan W. Irwin <irwin at beluga.phys.uvic.ca>

diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index f563dd8..434e0a3 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -3488,13 +3488,12 @@ void cmGeneratorTarget::GetFullNameInternal(
   }
 
   // if there is no prefix on the target use the cmake definition
-  std::string targetPrefix2, targetSuffix2;
   if (!targetPrefix && prefixVar) {
-    targetPrefix2 = this->Makefile->GetSafeDefinition(prefixVar);
+    targetPrefix = this->Makefile->GetSafeDefinition(prefixVar).c_str();
   }
   // if there is no suffix on the target use the cmake definition
   if (!targetSuffix && suffixVar) {
-    targetSuffix2 = this->Makefile->GetSafeDefinition(suffixVar);
+    targetSuffix = this->Makefile->GetSafeDefinition(suffixVar).c_str();
   }
 
   // frameworks have directory prefix but no suffix
@@ -3502,19 +3501,19 @@ void cmGeneratorTarget::GetFullNameInternal(
   if (this->IsFrameworkOnApple()) {
     fw_prefix = this->GetFrameworkDirectory(config, ContentLevel);
     fw_prefix += "/";
-    targetPrefix2 = fw_prefix;
-    targetSuffix2.clear();
+    targetPrefix = fw_prefix.c_str();
+    targetSuffix = nullptr;
   }
 
   if (this->IsCFBundleOnApple()) {
     fw_prefix = this->GetCFBundleDirectory(config, FullLevel);
     fw_prefix += "/";
-    targetPrefix2 = fw_prefix;
-    targetSuffix2.clear();
+    targetPrefix = fw_prefix.c_str();
+    targetSuffix = nullptr;
   }
 
   // Begin the final name with the prefix.
-  outPrefix = targetPrefix2;
+  outPrefix = targetPrefix ? targetPrefix : "";
 
   // Append the target name or property-specified name.
   outBase += this->GetOutputName(config, artifact);
@@ -3533,7 +3532,7 @@ void cmGeneratorTarget::GetFullNameInternal(
   }
 
   // Append the suffix.
-  outSuffix = targetSuffix2;
+  outSuffix = targetSuffix ? targetSuffix : "";
 }
 
 std::string cmGeneratorTarget::GetLinkerLanguage(
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index a22521b..28aab1c 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -368,6 +368,7 @@ if(BUILD_TESTING)
   ADD_TEST_MACRO(CxxSubdirC CxxSubdirC)
   ADD_TEST_MACRO(IPO COnly/COnly)
   ADD_TEST_MACRO(OutDir runtime/OutDir)
+  ADD_TEST_MACRO(OutName exe.OutName.exe)
   ADD_TEST_MACRO(ObjectLibrary UseCshared)
   ADD_TEST_MACRO(NewlineArgs NewlineArgs)
   ADD_TEST_MACRO(SetLang SetLang)
diff --git a/Tests/OutName/CMakeLists.txt b/Tests/OutName/CMakeLists.txt
new file mode 100644
index 0000000..f024def
--- /dev/null
+++ b/Tests/OutName/CMakeLists.txt
@@ -0,0 +1,6 @@
+cmake_minimum_required(VERSION 3.12)
+project(OutName C)
+
+add_executable(OutName main.c)
+set_property(TARGET OutName PROPERTY PREFIX exe.)
+set_property(TARGET OutName PROPERTY SUFFIX .exe)
diff --git a/Tests/OutName/main.c b/Tests/OutName/main.c
new file mode 100644
index 0000000..8488f4e
--- /dev/null
+++ b/Tests/OutName/main.c
@@ -0,0 +1,4 @@
+int main(void)
+{
+  return 0;
+}

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d686f81e58200c68c1e89094210e9587e0e90983
commit d686f81e58200c68c1e89094210e9587e0e90983
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Sep 19 07:41:22 2018 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Sep 19 07:42:08 2018 -0400

    Restore possibly regressed CMP0018 logic
    
    Refactoring in commit f4ff60a803 (cmMakefile: Make GetSafeDefinition
    return std::string const&, 2018-09-05) changed the treatment of the
    empty string in CMP0018 diagnostic logic.  Restore the behavior.

diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index f504b9f..c45acf7 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -828,11 +828,8 @@ void cmGlobalGenerator::EnableLanguage(
     std::string sharedLibFlagsVar = "CMAKE_SHARED_LIBRARY_";
     sharedLibFlagsVar += lang;
     sharedLibFlagsVar += "_FLAGS";
-    std::string const& sharedLibFlags =
+    this->LanguageToOriginalSharedLibFlags[lang] =
       mf->GetSafeDefinition(sharedLibFlagsVar);
-    if (!sharedLibFlags.empty()) {
-      this->LanguageToOriginalSharedLibFlags[lang] = sharedLibFlags;
-    }
 
     // Translate compiler ids for compatibility.
     this->CheckCompilerIdCompatibility(mf, lang);
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 7eb4ef4..7030725 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1826,7 +1826,7 @@ bool cmLocalGenerator::GetShouldUseOldFlags(bool shared,
     flagsVar += "_FLAGS";
     std::string const& flags = this->Makefile->GetSafeDefinition(flagsVar);
 
-    if (!flags.empty() && flags != originalFlags) {
+    if (flags != originalFlags) {
       switch (this->GetPolicyStatus(cmPolicies::CMP0018)) {
         case cmPolicies::WARN: {
           std::ostringstream e;

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

Summary of changes:
 Source/cmGeneratorTarget.cxx                        | 17 ++++++++---------
 Source/cmGlobalGenerator.cxx                        |  5 +----
 Source/cmLocalGenerator.cxx                         |  2 +-
 Tests/CMakeLists.txt                                |  1 +
 Tests/OutName/CMakeLists.txt                        |  6 ++++++
 Tests/{VSExcludeFromDefaultBuild => OutName}/main.c |  0
 6 files changed, 17 insertions(+), 14 deletions(-)
 create mode 100644 Tests/OutName/CMakeLists.txt
 copy Tests/{VSExcludeFromDefaultBuild => OutName}/main.c (100%)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list