VS: Fix VS_SOLUTION_ITEMS for absolute paths

This was missed in commit 0bb13ba0e6 (VS: Add support for Visual Studio
solution items, 2024-10-27).

Fixes: #26593
This commit is contained in:
Lauri Vasama
2025-01-09 15:38:33 +02:00
committed by Brad King
parent 4771754c0d
commit 6c187aae3b
2 changed files with 9 additions and 2 deletions

View File

@@ -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);

View File

@@ -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)