[cmake-developers] patch building and testing

Mike Fitzgerald michaeljohnfitzgerald at gmail.com
Fri Jan 8 17:56:49 EST 2016


Thanks, that was exactly what I needed to know!  I was compiling on OS X,
which is what caused the make confusion.  After moving back to Windows,
I've got the attached, which gives me the results I'd expect and doesn't
cause any new test failures.  I tried to follow the code conventions as
best I could.  If I should be adding a test for this property, or
submitting the patch differently, please let me know!

- Mike


>From 2a831f0752ad9e97c5e4e729ced92d640b792386 Mon Sep 17 00:00:00 2001
From: Mike Fitzgerald <michaeljohnfitzgerald at gmail.com>
Date: Fri, 8 Jan 2016 17:33:28 -0500
Subject: [PATCH] fix VS_GLOBAL_* properties in VS 10+

---
 Source/cmVisualStudio10TargetGenerator.cxx | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/Source/cmVisualStudio10TargetGenerator.cxx
b/Source/cmVisualStudio10TargetGenerator.cxx
index 6e1fb5b..0406d25 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -448,6 +448,32 @@ void cmVisualStudio10TargetGenerator::Generate()
     (*this->BuildFileStream) << cmVS10EscapeXML(targetFrameworkVersion)
                              << "</TargetFrameworkVersion>\n";
     }
+
+  std::vector<std::string> keys = this->GeneratorTarget->GetPropertyKeys();
+  for(std::vector<std::string>::const_iterator keyIt = keys.begin();
+      keyIt != keys.end(); ++keyIt)
+    {
+    static const char* prefix = "VS_GLOBAL_";
+    if(keyIt->find(prefix) != 0)
+      continue;
+    std::string globalKey = keyIt->substr(strlen(prefix));
+    // Skip invalid or separately-handled properties.
+    if(globalKey == "" ||
+       globalKey == "PROJECT_TYPES" ||
+       globalKey == "ROOTNAMESPACE" ||
+       globalKey == "KEYWORD")
+      {
+      continue;
+      }
+    const char* value = this->GeneratorTarget->GetProperty(keyIt->c_str());
+    if (!value)
+      continue;
+    this->WriteString("<", 2);
+    (*this->BuildFileStream) << globalKey << ">"
+                             << cmVS10EscapeXML(value)
+                             << "</" << globalKey << ">\n";
+    }
+
   this->WriteString("</PropertyGroup>\n", 1);
   this->WriteString("<Import Project="
                     "\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\"
/>\n",
-- 
1.9.4.msysgit.2


On Fri, Jan 8, 2016 at 11:31 AM, Brad King <brad.king at kitware.com> wrote:

> On 01/07/2016 10:36 PM, Mike Fitzgerald wrote:
> > I wanted to fix an issue (#13666)
>
> Great!
>
> > 1.) Cloned the git repo, ran bootstrap and make.
> > 2.) Wrote some code in cmVisualStudio10TargetGenerator.cxx.
> >
> > Running make again didn't seem to recompile anything
>
> On what platform did you build?  That source file is used only on
> Windows platforms.  It won't compile at all on Linux or OS X hosts
> so it is not expected to re-compile after modification on those
> platforms.
>
> > There appears to be a full suite of tests in the Tests folder
>
> After compiling, run
>
>  bin/ctest
>
> to run the tests.  If you used a VS (or Xcode) generator then run
>
>  bin/Debug/ctest -C Debug
>
> where "Debug" is whatever configuration you built after generating.
>
> You don't actually have to use the bootstrap script to build for
> development.  You can configure/build CMake with an already-installed
> CMake.  This is required on Windows to build with VS.  With this
> approach you should run the tests using the ctest that comes next to
> the already-installed cmake you ran to configure the build tree.
>
> -Brad
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake-developers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20160108/3dd83e20/attachment.html>


More information about the cmake-developers mailing list