summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2010-11-16 19:46:20 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2010-11-16 19:46:20 (GMT)
commit8593a9d0106b6d55548e5853592e9ad4b1f1f4f5 (patch)
tree15c1f3a31a8d150a98d1cc2c91710f2ece1a8a5a
parentb61c5be3d79bd890fc5d56ac8313bb84897cc1c1 (diff)
parentb3cf739e2c784fbd6c8a93c1ac91bd4bcea5acbf (diff)
downloadCMake-8593a9d0106b6d55548e5853592e9ad4b1f1f4f5.zip
CMake-8593a9d0106b6d55548e5853592e9ad4b1f1f4f5.tar.gz
CMake-8593a9d0106b6d55548e5853592e9ad4b1f1f4f5.tar.bz2
Merge topic 'fix-FOLDER-plus-include_external_msproject'
b3cf739 Honor FOLDER on include_external_msproject targets (#11436)
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx78
-rw-r--r--Tests/VSExternalInclude/CMakeLists.txt8
2 files changed, 49 insertions, 37 deletions
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index 2b9e5ba..45d6a74 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -279,6 +279,8 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
projectTargets.begin(); tt != projectTargets.end(); ++tt)
{
cmTarget* target = *tt;
+ bool written = false;
+
// handle external vc project files
const char* expath = target->GetProperty("EXTERNAL_MSPROJECT");
if(expath)
@@ -287,6 +289,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
std::string location = expath;
this->WriteExternalProject(fout, project.c_str(),
location.c_str(), target->GetUtilities());
+ written = true;
}
else
{
@@ -300,47 +303,48 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
cmLocalGenerator::START_OUTPUT);
this->WriteProject(fout, vcprojName, dir.c_str(),
*target);
+ written = true;
+ }
+ }
- // Create "solution folder" information from FOLDER target property
- //
- if (this->UseFolderProperty())
+ // Create "solution folder" information from FOLDER target property
+ //
+ if (written && this->UseFolderProperty())
+ {
+ const char *targetFolder = target->GetProperty("FOLDER");
+ if (targetFolder)
+ {
+ std::vector<cmsys::String> tokens =
+ cmSystemTools::SplitString(targetFolder, '/', false);
+
+ std::string cumulativePath = "";
+
+ for(std::vector<cmsys::String>::iterator iter = tokens.begin();
+ iter != tokens.end(); ++iter)
{
- const char *targetFolder = target->GetProperty("FOLDER");
- if (targetFolder)
+ if(!iter->size())
{
- std::vector<cmsys::String> tokens =
- cmSystemTools::SplitString(targetFolder, '/', false);
-
- std::string cumulativePath = "";
-
- for(std::vector<cmsys::String>::iterator iter = tokens.begin();
- iter != tokens.end(); ++iter)
- {
- if(!iter->size())
- {
- continue;
- }
-
- if (cumulativePath.empty())
- {
- cumulativePath = "CMAKE_FOLDER_GUID_" + *iter;
- }
- else
- {
- VisualStudioFolders[cumulativePath].insert(
- cumulativePath + "/" + *iter);
-
- cumulativePath = cumulativePath + "/" + *iter;
- }
-
- this->CreateGUID(cumulativePath.c_str());
- }
-
- if (!cumulativePath.empty())
- {
- VisualStudioFolders[cumulativePath].insert(target->GetName());
- }
+ continue;
}
+
+ if (cumulativePath.empty())
+ {
+ cumulativePath = "CMAKE_FOLDER_GUID_" + *iter;
+ }
+ else
+ {
+ VisualStudioFolders[cumulativePath].insert(
+ cumulativePath + "/" + *iter);
+
+ cumulativePath = cumulativePath + "/" + *iter;
+ }
+
+ this->CreateGUID(cumulativePath.c_str());
+ }
+
+ if (!cumulativePath.empty())
+ {
+ VisualStudioFolders[cumulativePath].insert(target->GetName());
}
}
}
diff --git a/Tests/VSExternalInclude/CMakeLists.txt b/Tests/VSExternalInclude/CMakeLists.txt
index 931e636..1e68968 100644
--- a/Tests/VSExternalInclude/CMakeLists.txt
+++ b/Tests/VSExternalInclude/CMakeLists.txt
@@ -50,3 +50,11 @@ IF(MSVC10)
ADD_DEPENDENCIES(VSExternalInclude lib1)
ENDIF()
+# Interaction testing between the FOLDER target property and
+# INCLUDE_EXTERNAL_MSPROJECT targets:
+set_target_properties(VSExternalInclude PROPERTIES FOLDER folder1/folder2)
+set_target_properties(lib1 PROPERTIES FOLDER folder1/folder2)
+set_target_properties(lib2 PROPERTIES FOLDER folder1/folder2)
+add_custom_target(EmptyCustomTarget)
+set_target_properties(EmptyCustomTarget PROPERTIES FOLDER folder1/folder2)
+set_property(GLOBAL PROPERTY USE_FOLDERS ON)