Browse Source

Merge topic 'vs-solution-items-absolute'

6c187aae3b VS: Fix VS_SOLUTION_ITEMS for absolute paths

Acked-by: Kitware Robot <[email protected]>
Merge-request: !10153
Brad King 9 months ago
parent
commit
8bd397dce6

+ 4 - 1
Source/cmGlobalVisualStudio14Generator.cxx

@@ -560,7 +560,10 @@ void cmGlobalVisualStudio14Generator::AddSolutionItems(cmLocalGenerator* root)
 
     for (const std::string& relativePath : cmList(n)) {
       pathComponents[2] = relativePath;
-      std::string fullPath = cmSystemTools::JoinPath(pathComponents);
+
+      std::string fullPath = cmSystemTools::FileIsFullPath(relativePath)
+        ? relativePath
+        : cmSystemTools::JoinPath(pathComponents);
 
       cmSourceGroup* sg = makefile->FindSourceGroup(fullPath, sourceGroups);
 

+ 5 - 1
Tests/RunCMake/VS10Project/SolutionItems.cmake

@@ -1,4 +1,8 @@
-set_property(DIRECTORY APPEND PROPERTY VS_SOLUTION_ITEMS solution-item-0-1.txt solution-item-1-1.txt solution-item-2-1.txt solution-item-2-2.txt)
+set_property(DIRECTORY APPEND PROPERTY VS_SOLUTION_ITEMS
+             solution-item-0-1.txt
+             solution-item-1-1.txt
+             "${CMAKE_CURRENT_LIST_DIR}/solution-item-2-1.txt"
+             "${CMAKE_CURRENT_LIST_DIR}/solution-item-2-2.txt")
 source_group("Outer Group" FILES solution-item-1-1.txt)
 source_group("Outer Group/Inner Group" REGULAR_EXPRESSION "solution-item-2-[0-9]+\\.txt")
 add_subdirectory(SolutionItems)