[Cmake-commits] CMake branch, next, updated. v2.8.2-985-gab9a029

David Cole david.cole at kitware.com
Sat Oct 2 14:58:03 EDT 2010


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  ab9a029fd8e9b73b8015007d48c73fc70263f658 (commit)
       via  fd3249e11afeb38284ee8e2012134de4d410c92b (commit)
      from  4693b2d84ae3b1cc5495b72fbd76ed90d6922ebb (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=ab9a029fd8e9b73b8015007d48c73fc70263f658
commit ab9a029fd8e9b73b8015007d48c73fc70263f658
Merge: 4693b2d fd3249e
Author:     David Cole <david.cole at kitware.com>
AuthorDate: Sat Oct 2 14:58:02 2010 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Sat Oct 2 14:58:02 2010 -0400

    Merge topic 'vs-project-groups' into next
    
    fd3249e New USE_FOLDERS property OFF by default. (#3796)


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fd3249e11afeb38284ee8e2012134de4d410c92b
commit fd3249e11afeb38284ee8e2012134de4d410c92b
Author:     David Cole <david.cole at kitware.com>
AuthorDate: Fri Oct 1 17:23:53 2010 -0400
Commit:     David Cole <david.cole at kitware.com>
CommitDate: Sat Oct 2 14:31:02 2010 -0400

    New USE_FOLDERS property OFF by default. (#3796)
    
    Visual Studio Express editions do not support solution folders,
    so default behavior should be as if USE_FOLDERS global property
    is OFF.
    
    Also, allow folder names to be the same as target names: internally,
    use a prefix to distinguish folder GUIDs from target GUIDs. Add
    a target and folder with the same name in the ExternalProject
    test to exercise this code.
    
    For CMake itself, provide a new option CMAKE_USE_FOLDERS that
    defaults to ON so that Visual Studio users get a nicely organized
    CMake project. Express edition users will have to turn off the
    CMAKE_USE_FOLDERS option in order to build CMake in the VS Express
    IDE.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index dec502b..f5ec0f6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -173,15 +173,33 @@ MACRO(CMAKE_SETUP_TESTING)
 ENDMACRO(CMAKE_SETUP_TESTING)
 
 
+# Provide a way for Visual Studio Express users to turn OFF the new FOLDER
+# organization feature. Default to ON for non-Express users. Express users must
+# explicitly turn off this option to build CMake in the Express IDE...
+#
+OPTION(CMAKE_USE_FOLDERS "Enable folder grouping of projects in IDEs." ON)
+MARK_AS_ADVANCED(CMAKE_USE_FOLDERS)
+
+
+#-----------------------------------------------------------------------
+# a macro that only sets the FOLDER target property if it's
+# "appropriate"
+#-----------------------------------------------------------------------
 MACRO(CMAKE_SET_TARGET_FOLDER tgt folder)
-  # Really, I just want this to be an "if(TARGET ${tgt})" ...
-  # but I'm not sure that our min req'd., CMake 2.4.5 can handle
-  # that... so I'm just activating this for now, with a version
-  # compare, and only for MSVC builds.
-  IF(MSVC)
-    IF(NOT ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.8)
-      SET_PROPERTY(TARGET "${tgt}" PROPERTY FOLDER "${folder}")
+  IF(CMAKE_USE_FOLDERS)
+    SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON)
+
+    # Really, I just want this to be an "if(TARGET ${tgt})" ...
+    # but I'm not sure that our min req'd., CMake 2.4.5 can handle
+    # that... so I'm just activating this for now, with a version
+    # compare, and only for MSVC builds.
+    IF(MSVC)
+      IF(NOT ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.8)
+        SET_PROPERTY(TARGET "${tgt}" PROPERTY FOLDER "${folder}")
+      ENDIF()
     ENDIF()
+  ELSE()
+    SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS OFF)
   ENDIF()
 ENDMACRO(CMAKE_SET_TARGET_FOLDER)
 
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 8e77294..b9deaef 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1863,9 +1863,10 @@ bool cmGlobalGenerator::UseFolderProperty()
     return cmSystemTools::IsOn(prop);
     }
 
-  // By default, this feature is ON:
+  // By default, this feature is OFF, since it is not supported in the
+  // Visual Studio Express editions:
   //
-  return true;
+  return false;
 }
 
 //----------------------------------------------------------------------------
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index f455810..e08b1ef 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -323,7 +323,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
 
               if (cumulativePath.empty())
                 {
-                cumulativePath = *iter;
+                cumulativePath = "CMAKE_FOLDER_GUID_" + *iter;
                 }
               else
                 {
@@ -431,14 +431,22 @@ void cmGlobalVisualStudio7Generator
 //----------------------------------------------------------------------------
 void cmGlobalVisualStudio7Generator::WriteFolders(std::ostream& fout)
 {
+  const char *prefix = "CMAKE_FOLDER_GUID_";
+  const std::string::size_type skip_prefix = strlen(prefix);
   std::string guidProjectTypeFolder = "2150E333-8FDC-42A3-9474-1A3956D46DE8";
   for(std::map<std::string,std::set<std::string> >::iterator iter =
     VisualStudioFolders.begin(); iter != VisualStudioFolders.end(); ++iter)
     {
     std::string fullName = iter->first;
     std::string guid = this->GetGUID(fullName.c_str());
-    std::string nameOnly = cmSystemTools::GetFilenameName(fullName);
+
     cmSystemTools::ReplaceString(fullName, "/", "\\");
+    if (cmSystemTools::StringStartsWith(fullName.c_str(), prefix))
+      {
+      fullName = fullName.substr(skip_prefix);
+      }
+
+    std::string nameOnly = cmSystemTools::GetFilenameName(fullName);
 
     fout << "Project(\"{" <<
       guidProjectTypeFolder << "}\") = \"" <<
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 37ff7c5..db26b73 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -3486,7 +3486,7 @@ void cmake::DefineProperties(cmake *cm)
   cm->DefineProperty
     ("USE_FOLDERS", cmProperty::GLOBAL,
      "Use the FOLDER target property to organize targets into folders.",
-     "If not set, CMake treats this property as ON by default. "
+     "If not set, CMake treats this property as OFF by default. "
      "CMake generators that are capable of organizing into a "
      "hierarchy of folders use the values of the FOLDER target "
      "property to name those folders. See also the documentation "
diff --git a/Tests/ExternalProject/CMakeLists.txt b/Tests/ExternalProject/CMakeLists.txt
index 00db5d4..45c1149 100644
--- a/Tests/ExternalProject/CMakeLists.txt
+++ b/Tests/ExternalProject/CMakeLists.txt
@@ -7,6 +7,13 @@ find_package(CVS)
 find_package(Subversion)
 find_package(Git)
 
+option(ExternalProjectTest_USE_FOLDERS "Enable folder grouping in IDEs." ON)
+if(ExternalProjectTest_USE_FOLDERS)
+  set_property(GLOBAL PROPERTY USE_FOLDERS ON)
+else()
+  set_property(GLOBAL PROPERTY USE_FOLDERS OFF)
+endif()
+
 set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER
   "CMakePredefinedTargets-in-ExternalProjectTest")
 
@@ -60,6 +67,15 @@ ExternalProject_Add(${proj}
   INSTALL_COMMAND ""
 )
 
+set(proj TargetNameSameAsFolder)
+ExternalProject_Add(${proj}
+  BUILD_COMMAND ""
+  CONFIGURE_COMMAND ""
+  DOWNLOAD_COMMAND ""
+  INSTALL_COMMAND ""
+)
+set_property(TARGET ${proj} PROPERTY FOLDER "${proj}")
+
 set(proj MinimalNoOpProject)
 ExternalProject_Add(${proj}
   BUILD_COMMAND ""

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

Summary of changes:
 CMakeLists.txt                            |   32 ++++++++++++++++++++++------
 Source/cmGlobalGenerator.cxx              |    5 ++-
 Source/cmGlobalVisualStudio7Generator.cxx |   12 +++++++++-
 Source/cmake.cxx                          |    2 +-
 Tests/ExternalProject/CMakeLists.txt      |   16 ++++++++++++++
 5 files changed, 55 insertions(+), 12 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list