On Tue, Mar 22, 2016 at 12:15 PM, Taylor Braun-Jones
<tay...@braun-jones.org> wrote:
> On Tue, Mar 22, 2016 at 11:49 AM, Brad King <brad.k...@kitware.com> wrote:
>> Please revise 0001 to apply cleanly on top of 78ec0461.
>>
>> Also please revise 0002 to avoid using the ZERO_CHECK target because
>> it does not exist in all VS generators.  I had added custom target
>> to the test case to use instead.
>
> Done - see attached.

Whoops - I didn't update unit test in patch 0002 properly. Here's a
new patch that's not broken.
From 56455ff8caecb1357737b1af533046bda083e382 Mon Sep 17 00:00:00 2001
From: Taylor Braun-Jones <tay...@braun-jones.org>
Date: Mon, 21 Mar 2016 16:01:20 -0400
Subject: [PATCH 2/3] VS: Fix default target support for targets nested inside
 a folder

---
 Source/cmGlobalVisualStudio71Generator.cxx                     | 5 ++++-
 Tests/RunCMake/VSSolution/RunCMakeTest.cmake                   | 1 +
 Tests/RunCMake/VSSolution/StartupProjectUseFolders-check.cmake | 9 +++++++++
 Tests/RunCMake/VSSolution/StartupProjectUseFolders.cmake       | 3 +++
 4 files changed, 17 insertions(+), 1 deletion(-)
 create mode 100644 Tests/RunCMake/VSSolution/StartupProjectUseFolders-check.cmake
 create mode 100644 Tests/RunCMake/VSSolution/StartupProjectUseFolders.cmake

diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx
index f6796a5..289fbb5 100644
--- a/Source/cmGlobalVisualStudio71Generator.cxx
+++ b/Source/cmGlobalVisualStudio71Generator.cxx
@@ -97,7 +97,8 @@ void cmGlobalVisualStudio71Generator
   OrderedTargetDependSet orderedProjectTargets(
     projectTargets, this->GetStartupProjectName(root));
 
-  this->WriteTargetsToSolution(fout, root, orderedProjectTargets);
+  std::stringstream targetsSlnString;
+  this->WriteTargetsToSolution(targetsSlnString, root, orderedProjectTargets);
 
   bool useFolderProperty = this->UseFolderProperty();
   if (useFolderProperty)
@@ -105,6 +106,8 @@ void cmGlobalVisualStudio71Generator
     this->WriteFolders(fout);
     }
 
+  fout << targetsSlnString.str();
+
   // Write out the configurations information for the solution
   fout << "Global\n";
   // Write out the configurations for the solution
diff --git a/Tests/RunCMake/VSSolution/RunCMakeTest.cmake b/Tests/RunCMake/VSSolution/RunCMakeTest.cmake
index 8ae9598..19b309c 100644
--- a/Tests/RunCMake/VSSolution/RunCMakeTest.cmake
+++ b/Tests/RunCMake/VSSolution/RunCMakeTest.cmake
@@ -10,3 +10,4 @@ run_cmake(Override1)
 run_cmake(Override2)
 run_cmake(StartupProject)
 run_cmake(StartupProjectMissing)
+run_cmake(StartupProjectUseFolders)
diff --git a/Tests/RunCMake/VSSolution/StartupProjectUseFolders-check.cmake b/Tests/RunCMake/VSSolution/StartupProjectUseFolders-check.cmake
new file mode 100644
index 0000000..c0a545a
--- /dev/null
+++ b/Tests/RunCMake/VSSolution/StartupProjectUseFolders-check.cmake
@@ -0,0 +1,9 @@
+getProjectNames(projects)
+list(GET projects 0 first_project)
+if(NOT first_project STREQUAL "CMakePredefinedTargets")
+  error("CMakePredefinedTargets is not the first project")
+endif()
+list(GET projects 1 second_project)
+if(NOT second_project STREQUAL "TestStartup")
+  error("TestStartup does not immediately follow the CMakePredefinedTargets project")
+endif()
diff --git a/Tests/RunCMake/VSSolution/StartupProjectUseFolders.cmake b/Tests/RunCMake/VSSolution/StartupProjectUseFolders.cmake
new file mode 100644
index 0000000..8e422a4
--- /dev/null
+++ b/Tests/RunCMake/VSSolution/StartupProjectUseFolders.cmake
@@ -0,0 +1,3 @@
+add_custom_target(TestStartup)
+set_property(GLOBAL PROPERTY USE_FOLDERS ON)
+set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT "TestStartup")
-- 
2.7.2.windows.1

-- 

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

Reply via email to