1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-14 02:08:27 +08:00

VS: Generate .slnx files for VS 2026

Since the `Visual Studio 18 2026` generator is new, we can switch
to the `.slnx` file format without changing behavior for users of
VS 2022 and older.

Fixes: #25887
This commit is contained in:
Brad King
2025-09-17 12:31:19 -04:00
parent 95c2034b32
commit e6aa7742b0
49 changed files with 772 additions and 43 deletions

View File

@@ -36,9 +36,29 @@
#include "cmVersion.h"
#include "cmVisualStudioSlnData.h"
#include "cmVisualStudioSlnParser.h"
#include "cmXMLParser.h"
#include "cmXMLWriter.h"
#include "cmake.h"
class cmSlnxParser : public cmXMLParser
{
public:
std::map<std::string, std::string> ProjectToPath;
void StartElement(std::string const& name, char const** atts) override
{
if (name == "Project"_s) {
if (char const* rawPath = this->FindAttribute(atts, "Path")) {
std::string path = rawPath;
cmSystemTools::ConvertToUnixSlashes(path);
std::string nameOnly =
cmsys::SystemTools::GetFilenameWithoutLastExtension(path);
this->ProjectToPath[cmSystemTools::LowerCase(nameOnly)] = path;
}
}
}
void EndElement(std::string const&) override {}
};
static std::map<std::string, std::vector<cmIDEFlagTable>> loadedFlagJsonFiles;
static void ConvertToWindowsSlashes(std::string& s)
@@ -1079,19 +1099,27 @@ cmGlobalVisualStudio10Generator::GenerateBuildCommand(
// MSBuild is preferred (and required for VS Express), but if the .sln has
// an Intel Fortran .vfproj then we have to use devenv. Parse it to find out.
cmSlnxParser slnxParser;
cmSlnData slnData;
{
if (this->Version >= VSVersion::VS18) {
if (slnxParser.ParseFile(slnFile.c_str())) {
for (auto const& i : slnxParser.ProjectToPath) {
if (cmHasLiteralSuffix(i.second, ".vfproj")) {
useDevEnv = true;
break;
}
}
}
} else {
cmVisualStudioSlnParser parser;
if (parser.ParseFile(slnFile, slnData,
cmVisualStudioSlnParser::DataGroupAll)) {
std::vector<cmSlnProjectEntry> slnProjects = slnData.GetProjects();
for (cmSlnProjectEntry const& project : slnProjects) {
if (useDevEnv) {
break;
}
std::string proj = project.GetRelativePath();
if (proj.size() > 7 && proj.substr(proj.size() - 7) == ".vfproj"_s) {
if (cmHasLiteralSuffix(proj, ".vfproj")) {
useDevEnv = true;
break;
}
}
}
@@ -1127,9 +1155,18 @@ cmGlobalVisualStudio10Generator::GenerateBuildCommand(
std::string targetProject = cmStrCat(tname, ".vcxproj");
if (targetProject.find('/') == std::string::npos) {
// it might be in a subdir
if (cmSlnProjectEntry const* proj = slnData.GetProjectByName(tname)) {
targetProject = proj->GetRelativePath();
cmSystemTools::ConvertToUnixSlashes(targetProject);
if (this->Version >= VSVersion::VS18) {
auto i =
slnxParser.ProjectToPath.find(cmSystemTools::LowerCase(tname));
if (i != slnxParser.ProjectToPath.end()) {
targetProject = i->second;
}
} else {
if (cmSlnProjectEntry const* proj =
slnData.GetProjectByName(tname)) {
targetProject = proj->GetRelativePath();
cmSystemTools::ConvertToUnixSlashes(targetProject);
}
}
}
makeCommand.Add(targetProject);

View File

@@ -1064,19 +1064,22 @@ cm::VS::Solution cmGlobalVisualStudioGenerator::CreateSolution(
}
}
if (!pgExtensibilityGlobals) {
pgExtensibilityGlobals =
solution.GetPropertyGroup("ExtensibilityGlobals"_s);
solution.PropertyGroups.emplace_back(pgExtensibilityGlobals);
}
std::string const solutionGuid =
this->GetGUID(cmStrCat(root->GetProjectName(), ".sln"));
pgExtensibilityGlobals->Map.emplace("SolutionGuid",
cmStrCat('{', solutionGuid, '}'));
if (this->Version <= cm::VS::Version::VS17) {
if (!pgExtensibilityGlobals) {
pgExtensibilityGlobals =
solution.GetPropertyGroup("ExtensibilityGlobals"_s);
solution.PropertyGroups.emplace_back(pgExtensibilityGlobals);
}
std::string const solutionGuid =
this->GetGUID(cmStrCat(root->GetProjectName(), ".sln"));
pgExtensibilityGlobals->Map.emplace("SolutionGuid",
cmStrCat('{', solutionGuid, '}'));
if (!pgExtensibilityAddIns) {
pgExtensibilityAddIns = solution.GetPropertyGroup("ExtensibilityAddIns"_s);
solution.PropertyGroups.emplace_back(pgExtensibilityAddIns);
if (!pgExtensibilityAddIns) {
pgExtensibilityAddIns =
solution.GetPropertyGroup("ExtensibilityAddIns"_s);
solution.PropertyGroups.emplace_back(pgExtensibilityAddIns);
}
}
solution.CanonicalizeOrder();
@@ -1099,6 +1102,9 @@ std::string cmGlobalVisualStudioGenerator::GetSLNFile(
slnFile.push_back('/');
}
slnFile = cmStrCat(slnFile, projectName, ".sln");
if (this->Version >= cm::VS::Version::VS18) {
slnFile += "x";
}
return slnFile;
}
@@ -1162,7 +1168,11 @@ void cmGlobalVisualStudioGenerator::GenerateSolution(
}
cm::VS::Solution const solution = this->CreateSolution(root, projectTargets);
WriteSln(fout, solution);
if (this->Version >= cmGlobalVisualStudioGenerator::VSVersion::VS18) {
WriteSlnx(fout, solution);
} else {
WriteSln(fout, solution);
}
if (fout.Close()) {
this->FileReplacedDuringGenerate(fname);

View File

@@ -10,7 +10,9 @@
#include <cm/string_view>
#include <cmext/string_view>
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmXMLWriter.h"
namespace cm {
namespace VS {
@@ -279,5 +281,94 @@ void WriteSln(std::ostream& sln, Solution const& solution)
sln << "EndGlobal\n";
}
namespace {
void WriteSlnxSolutionConfigurationPlatforms(cmXMLElement& xmlParent,
Solution const& solution)
{
cmXMLElement xmlConfigurations(xmlParent, "Configurations");
for (std::string const& c : solution.Configs) {
cmXMLElement(xmlConfigurations, "BuildType").Attribute("Name", c);
}
cmXMLElement(xmlConfigurations, "Platform")
.Attribute("Name", solution.Platform);
};
void WriteSlnxProject(cmXMLElement& xmlParent, Solution const& solution,
Solution::Project const& project)
{
cmXMLElement xmlProject(xmlParent, "Project");
xmlProject.Attribute("Path", project.Path);
xmlProject.Attribute("Id", cmSystemTools::LowerCase(project.Id));
for (Solution::Project const* d : project.BuildDependencies) {
cmXMLElement(xmlProject, "BuildDependency").Attribute("Project", d->Path);
}
assert(project.Configs.size() == solution.Configs.size());
for (std::size_t i = 0; i < solution.Configs.size(); ++i) {
if (project.Configs[i].Config != solution.Configs[i]) {
cmXMLElement(xmlProject, "BuildType")
.Attribute("Project", project.Configs[i].Config);
}
if (!project.Configs[i].Build) {
cmXMLElement(xmlProject, "Build")
.Attribute("Solution", cmStrCat(solution.Configs[i], "|*"))
.Attribute("Project", "false");
}
if (project.Configs[i].Deploy) {
cmXMLElement(xmlProject, "Deploy")
.Attribute("Solution", cmStrCat(solution.Configs[i], "|*"));
}
}
if (project.Platform != solution.Platform) {
cmXMLElement(xmlProject, "Platform")
.Attribute("Project", project.Platform);
}
};
void WriteSlnxFolder(cmXMLElement& xmlParent, Solution const& solution,
Solution::Folder const& folder)
{
cmXMLElement xmlFolder(xmlParent, "Folder");
xmlFolder.Attribute("Name", cmStrCat('/', folder.Name, '/'));
for (std::string const& filePath : folder.Files) {
cmXMLElement(xmlFolder, "File").Attribute("Path", filePath);
}
for (Solution::Project const* project : folder.Projects) {
WriteSlnxProject(xmlFolder, solution, *project);
}
};
void WriteSlnxPropertyGroup(cmXMLElement& xmlParent,
Solution::PropertyGroup const& pg)
{
cmXMLElement xmlProperties(xmlParent, "Properties");
xmlProperties.Attribute("Name", pg.Name);
if (pg.Scope == Solution::PropertyGroup::Load::Post) {
xmlProperties.Attribute("Scope", "PostLoad");
}
for (auto const& i : pg.Map) {
cmXMLElement(xmlProperties, "Properties")
.Attribute("Name", i.first)
.Attribute("Value", i.second);
}
}
}
void WriteSlnx(std::ostream& slnx, Solution const& solution)
{
cmXMLWriter xw(slnx);
cmXMLDocument xml(xw);
cmXMLElement xmlSolution(xml, "Solution");
WriteSlnxSolutionConfigurationPlatforms(xmlSolution, solution);
for (Solution::Project const* project : solution.Projects) {
WriteSlnxProject(xmlSolution, solution, *project);
}
for (Solution::Folder const* folder : solution.Folders) {
WriteSlnxFolder(xmlSolution, solution, *folder);
}
for (Solution::PropertyGroup const* pg : solution.PropertyGroups) {
WriteSlnxPropertyGroup(xmlSolution, *pg);
}
}
}
}

View File

@@ -165,5 +165,8 @@ private:
/** Write the .sln-format representation. */
void WriteSln(std::ostream& sln, Solution const& solution);
/** Write the .slnx-format representation. */
void WriteSlnx(std::ostream& slnx, Solution const& solution);
}
}

View File

@@ -342,6 +342,31 @@ function(ensure_files_match expected_file actual_file)
endif()
endfunction()
function(RunCMake_check_file type file expect_content)
if(EXISTS "${file}")
file(READ "${file}" actual_content)
string(REPLACE "\r\n" "\n" actual_content "${actual_content}")
string(REGEX REPLACE "\n+$" "" actual_content "${actual_content}")
string(REPLACE "\t" " " actual_content "${actual_content}")
if(NOT actual_content MATCHES "${expect_content}")
string(REPLACE "\n" "\n expect-${type}> " expect_content " expect-${type}> ${expect_content}")
string(REPLACE "\n" "\n actual-${type}> " actual_content " actual-${type}> ${actual_content}")
string(APPEND RunCMake_TEST_FAILED "${type} does not match that expected.\n"
"Expected ${type} to match:\n${expect_content}\n"
"Actual ${type}:\n${actual_content}\n"
)
endif()
else()
string(APPEND RunCMake_TEST_FAILED "${type} file does not exist:\n ${file}\n")
endif()
return(PROPAGATE RunCMake_TEST_FAILED)
endfunction()
function(RunCMake_check_slnx slnx_file expect_slnx)
RunCMake_check_file("slnx" "${slnx_file}" "${expect_slnx}")
return(PROPAGATE RunCMake_TEST_FAILED)
endfunction()
# Get the user id on unix if possible.
function(get_unix_uid var)
set("${var}" "" PARENT_SCOPE)

View File

@@ -0,0 +1,19 @@
RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/AddPackageToDefault.slnx" [[
^<\?xml version="1\.0" encoding="UTF-8"\?>
<Solution>
<Configurations>
<BuildType Name="Debug"/>
<BuildType Name="Release"/>
<BuildType Name="MinSizeRel"/>
<BuildType Name="RelWithDebInfo"/>
<Platform Name="[^"]+"/>
</Configurations>
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+">
<BuildDependency Project="ZERO_CHECK\.vcxproj"/>
</Project>
<Project Path="PACKAGE.vcxproj" Id="[0-9a-f-]+">
<BuildDependency Project="ALL_BUILD.vcxproj"/>
<BuildDependency Project="ZERO_CHECK.vcxproj"/>
</Project>
<Project Path="ZERO_CHECK\.vcxproj" Id="[0-9a-f-]+"/>
</Solution>$]])

View File

@@ -1 +1 @@
include(${CMAKE_CURRENT_LIST_DIR}/AddPackageToDefault-check-sln.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/AddPackageToDefault-check-${sln_ext}.cmake)

View File

@@ -0,0 +1,28 @@
RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/CMP0143-NEW.slnx" [[
^<\?xml version="1\.0" encoding="UTF-8"\?>
<Solution>
<Configurations>
<BuildType Name="Debug"/>
<BuildType Name="Release"/>
<BuildType Name="MinSizeRel"/>
<BuildType Name="RelWithDebInfo"/>
<Platform Name="[^"]+"/>
</Configurations>
<Project Path="TestStartup\.vcxproj" Id="[0-9a-f-]+">
<BuildDependency Project="ZERO_CHECK.vcxproj"/>
<Build Solution="Debug\|\*" Project="false"/>
<Build Solution="Release\|\*" Project="false"/>
<Build Solution="MinSizeRel\|\*" Project="false"/>
<Build Solution="RelWithDebInfo\|\*" Project="false"/>
</Project>
<Folder Name="/CMakePredefinedTargets/">
<Project Path="ALL_BUILD.vcxproj" Id="[0-9a-f-]+">
<BuildDependency Project="ZERO_CHECK.vcxproj"/>
<Build Solution="Debug\|\*" Project="false"/>
<Build Solution="Release\|\*" Project="false"/>
<Build Solution="MinSizeRel\|\*" Project="false"/>
<Build Solution="RelWithDebInfo\|\*" Project="false"/>
</Project>
<Project Path="ZERO_CHECK.vcxproj" Id="[0-9a-f-]+"/>
</Folder>
</Solution>$]])

View File

@@ -1 +1 @@
include(${CMAKE_CURRENT_LIST_DIR}/CMP0143-NEW-check-sln.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/CMP0143-NEW-check-${sln_ext}.cmake)

View File

@@ -0,0 +1,26 @@
RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/CMP0143-OLD.slnx" [[
^<\?xml version="1\.0" encoding="UTF-8"\?>
<Solution>
<Configurations>
<BuildType Name="Debug"/>
<BuildType Name="Release"/>
<BuildType Name="MinSizeRel"/>
<BuildType Name="RelWithDebInfo"/>
<Platform Name="[^"]+"/>
</Configurations>
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+">
<BuildDependency Project="ZERO_CHECK\.vcxproj"/>
<Build Solution="Debug\|\*" Project="false"/>
<Build Solution="Release\|\*" Project="false"/>
<Build Solution="MinSizeRel\|\*" Project="false"/>
<Build Solution="RelWithDebInfo\|\*" Project="false"/>
</Project>
<Project Path="TestStartup.vcxproj" Id="[0-9a-f-]+">
<BuildDependency Project="ZERO_CHECK.vcxproj"/>
<Build Solution="Debug\|\*" Project="false"/>
<Build Solution="Release\|\*" Project="false"/>
<Build Solution="MinSizeRel\|\*" Project="false"/>
<Build Solution="RelWithDebInfo\|\*" Project="false"/>
</Project>
<Project Path="ZERO_CHECK\.vcxproj" Id="[0-9a-f-]+"/>
</Solution>$]])

View File

@@ -1 +1 @@
include(${CMAKE_CURRENT_LIST_DIR}/CMP0143-OLD-check-sln.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/CMP0143-OLD-check-${sln_ext}.cmake)

View File

@@ -0,0 +1,26 @@
RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/CMP0143-WARN.slnx" [[
^<\?xml version="1\.0" encoding="UTF-8"\?>
<Solution>
<Configurations>
<BuildType Name="Debug"/>
<BuildType Name="Release"/>
<BuildType Name="MinSizeRel"/>
<BuildType Name="RelWithDebInfo"/>
<Platform Name="[^"]+"/>
</Configurations>
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+">
<BuildDependency Project="ZERO_CHECK\.vcxproj"/>
<Build Solution="Debug\|\*" Project="false"/>
<Build Solution="Release\|\*" Project="false"/>
<Build Solution="MinSizeRel\|\*" Project="false"/>
<Build Solution="RelWithDebInfo\|\*" Project="false"/>
</Project>
<Project Path="TestStartup.vcxproj" Id="[0-9a-f-]+">
<BuildDependency Project="ZERO_CHECK.vcxproj"/>
<Build Solution="Debug\|\*" Project="false"/>
<Build Solution="Release\|\*" Project="false"/>
<Build Solution="MinSizeRel\|\*" Project="false"/>
<Build Solution="RelWithDebInfo\|\*" Project="false"/>
</Project>
<Project Path="ZERO_CHECK\.vcxproj" Id="[0-9a-f-]+"/>
</Solution>$]])

View File

@@ -1 +1 @@
include(${CMAKE_CURRENT_LIST_DIR}/CMP0143-WARN-check-sln.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/CMP0143-WARN-check-${sln_ext}.cmake)

View File

@@ -0,0 +1,26 @@
RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/DeployEnabled.slnx" [[
^<\?xml version="1\.0" encoding="UTF-8"\?>
<Solution>
<Configurations>
<BuildType Name="Debug"/>
<BuildType Name="Release"/>
<BuildType Name="MinSizeRel"/>
<BuildType Name="RelWithDebInfo"/>
<Platform Name="[^"]+"/>
</Configurations>
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+">
<BuildDependency Project="ZERO_CHECK\.vcxproj"/>
<BuildDependency Project="foo\.vcxproj"/>
<Build Solution="Debug\|\*" Project="false"/>
<Build Solution="Release\|\*" Project="false"/>
<Build Solution="MinSizeRel\|\*" Project="false"/>
<Build Solution="RelWithDebInfo\|\*" Project="false"/>
</Project>
<Project Path="ZERO_CHECK\.vcxproj" Id="[0-9a-f-]+"/>
<Project Path="foo\.vcxproj" Id="[0-9a-f-]+">
<BuildDependency Project="ZERO_CHECK\.vcxproj"/>
<Deploy Solution="Debug\|\*"/>
<Deploy Solution="MinSizeRel\|\*"/>
<Deploy Solution="RelWithDebInfo\|\*"/>
</Project>
</Solution>$]])

View File

@@ -1 +1 @@
include(${CMAKE_CURRENT_LIST_DIR}/DeployEnabled-check-sln.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/DeployEnabled-check-${sln_ext}.cmake)

View File

@@ -0,0 +1,28 @@
RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/MorePost.slnx" [[
^<\?xml version="1\.0" encoding="UTF-8"\?>
<Solution>
<Configurations>
<BuildType Name="Debug"/>
<BuildType Name="Release"/>
<BuildType Name="MinSizeRel"/>
<BuildType Name="RelWithDebInfo"/>
<Platform Name="[^"]+"/>
</Configurations>
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+">
<BuildDependency Project="ZERO_CHECK\.vcxproj"/>
<Build Solution="Debug\|\*" Project="false"/>
<Build Solution="Release\|\*" Project="false"/>
<Build Solution="MinSizeRel\|\*" Project="false"/>
<Build Solution="RelWithDebInfo\|\*" Project="false"/>
</Project>
<Project Path="ZERO_CHECK\.vcxproj" Id="[0-9a-f-]+"/>
<Properties Name="TestSec2" Scope="PostLoad">
<Properties Name="Key1" Value="Value1"/>
<Properties Name="Key2" Value="Value with spaces"/>
</Properties>
<Properties Name="TestSec4" Scope="PostLoad">
<Properties Name="Key6" Value="Value1"/>
<Properties Name="Key7" Value="Value with spaces"/>
<Properties Name="Key8" Value="ValueWithoutSpaces"/>
</Properties>
</Solution>$]])

View File

@@ -1 +1 @@
include(${CMAKE_CURRENT_LIST_DIR}/MorePost-check-sln.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/MorePost-check-${sln_ext}.cmake)

View File

@@ -0,0 +1,28 @@
RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/MorePre.slnx" [[
^<\?xml version="1\.0" encoding="UTF-8"\?>
<Solution>
<Configurations>
<BuildType Name="Debug"/>
<BuildType Name="Release"/>
<BuildType Name="MinSizeRel"/>
<BuildType Name="RelWithDebInfo"/>
<Platform Name="[^"]+"/>
</Configurations>
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+">
<BuildDependency Project="ZERO_CHECK\.vcxproj"/>
<Build Solution="Debug\|\*" Project="false"/>
<Build Solution="Release\|\*" Project="false"/>
<Build Solution="MinSizeRel\|\*" Project="false"/>
<Build Solution="RelWithDebInfo\|\*" Project="false"/>
</Project>
<Project Path="ZERO_CHECK\.vcxproj" Id="[0-9a-f-]+"/>
<Properties Name="TestSec1">
<Properties Name="Key1" Value="Value1"/>
<Properties Name="Key2" Value="Value with spaces"/>
</Properties>
<Properties Name="TestSec3">
<Properties Name="Key3" Value="Value1"/>
<Properties Name="Key4" Value="Value with spaces"/>
<Properties Name="Key5" Value="ValueWithoutSpaces"/>
</Properties>
</Solution>$]])

View File

@@ -1 +1 @@
include(${CMAKE_CURRENT_LIST_DIR}/MorePre-check-sln.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/MorePre-check-${sln_ext}.cmake)

View File

@@ -0,0 +1,23 @@
RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/OnePost.slnx" [[
^<\?xml version="1\.0" encoding="UTF-8"\?>
<Solution>
<Configurations>
<BuildType Name="Debug"/>
<BuildType Name="Release"/>
<BuildType Name="MinSizeRel"/>
<BuildType Name="RelWithDebInfo"/>
<Platform Name="[^"]+"/>
</Configurations>
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+">
<BuildDependency Project="ZERO_CHECK\.vcxproj"/>
<Build Solution="Debug\|\*" Project="false"/>
<Build Solution="Release\|\*" Project="false"/>
<Build Solution="MinSizeRel\|\*" Project="false"/>
<Build Solution="RelWithDebInfo\|\*" Project="false"/>
</Project>
<Project Path="ZERO_CHECK\.vcxproj" Id="[0-9a-f-]+"/>
<Properties Name="TestSec2" Scope="PostLoad">
<Properties Name="Key1" Value="Value1"/>
<Properties Name="Key2" Value="Value with spaces"/>
</Properties>
</Solution>$]])

View File

@@ -1 +1 @@
include(${CMAKE_CURRENT_LIST_DIR}/OnePost-check-sln.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/OnePost-check-${sln_ext}.cmake)

View File

@@ -0,0 +1,23 @@
RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/OnePre.slnx" [[
^<\?xml version="1\.0" encoding="UTF-8"\?>
<Solution>
<Configurations>
<BuildType Name="Debug"/>
<BuildType Name="Release"/>
<BuildType Name="MinSizeRel"/>
<BuildType Name="RelWithDebInfo"/>
<Platform Name="[^"]+"/>
</Configurations>
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+">
<BuildDependency Project="ZERO_CHECK\.vcxproj"/>
<Build Solution="Debug\|\*" Project="false"/>
<Build Solution="Release\|\*" Project="false"/>
<Build Solution="MinSizeRel\|\*" Project="false"/>
<Build Solution="RelWithDebInfo\|\*" Project="false"/>
</Project>
<Project Path="ZERO_CHECK\.vcxproj" Id="[0-9a-f-]+"/>
<Properties Name="TestSec1">
<Properties Name="Key1" Value="Value1"/>
<Properties Name="Key2" Value="Value with spaces"/>
</Properties>
</Solution>$]])

View File

@@ -1 +1 @@
include(${CMAKE_CURRENT_LIST_DIR}/OnePre-check-sln.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/OnePre-check-${sln_ext}.cmake)

View File

@@ -0,0 +1,26 @@
RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/Override1.slnx" [[
^<\?xml version="1\.0" encoding="UTF-8"\?>
<Solution>
<Configurations>
<BuildType Name="Debug"/>
<BuildType Name="Release"/>
<BuildType Name="MinSizeRel"/>
<BuildType Name="RelWithDebInfo"/>
<Platform Name="[^"]+"/>
</Configurations>
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+">
<BuildDependency Project="ZERO_CHECK\.vcxproj"/>
<Build Solution="Debug\|\*" Project="false"/>
<Build Solution="Release\|\*" Project="false"/>
<Build Solution="MinSizeRel\|\*" Project="false"/>
<Build Solution="RelWithDebInfo\|\*" Project="false"/>
</Project>
<Project Path="ZERO_CHECK\.vcxproj" Id="[0-9a-f-]+"/>
<Properties Name="ExtensibilityGlobals" Scope="PostLoad">
<Properties Name="Key1" Value="Value1"/>
</Properties>
<Properties Name="TestSec" Scope="PostLoad">
<Properties Name="Key2" Value="Value2"/>
<Properties Name="Key3" Value="Value3"/>
</Properties>
</Solution>$]])

View File

@@ -1 +1 @@
include(${CMAKE_CURRENT_LIST_DIR}/Override1-check-sln.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/Override1-check-${sln_ext}.cmake)

View File

@@ -0,0 +1,26 @@
RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/Override2.slnx" [[
^<\?xml version="1\.0" encoding="UTF-8"\?>
<Solution>
<Configurations>
<BuildType Name="Debug"/>
<BuildType Name="Release"/>
<BuildType Name="MinSizeRel"/>
<BuildType Name="RelWithDebInfo"/>
<Platform Name="[^"]+"/>
</Configurations>
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+">
<BuildDependency Project="ZERO_CHECK\.vcxproj"/>
<Build Solution="Debug\|\*" Project="false"/>
<Build Solution="Release\|\*" Project="false"/>
<Build Solution="MinSizeRel\|\*" Project="false"/>
<Build Solution="RelWithDebInfo\|\*" Project="false"/>
</Project>
<Project Path="ZERO_CHECK\.vcxproj" Id="[0-9a-f-]+"/>
<Properties Name="ExtensibilityAddIns" Scope="PostLoad">
<Properties Name="Key1" Value="Value1"/>
</Properties>
<Properties Name="TestSec">
<Properties Name="Key2" Value="Value2"/>
<Properties Name="Key3" Value="Value3"/>
</Properties>
</Solution>$]])

View File

@@ -1 +1 @@
include(${CMAKE_CURRENT_LIST_DIR}/Override2-check-sln.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/Override2-check-${sln_ext}.cmake)

View File

@@ -0,0 +1,23 @@
RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/Override3.slnx" [[
^<\?xml version="1\.0" encoding="UTF-8"\?>
<Solution>
<Configurations>
<BuildType Name="Debug"/>
<BuildType Name="Release"/>
<BuildType Name="MinSizeRel"/>
<BuildType Name="RelWithDebInfo"/>
<Platform Name="[^"]+"/>
</Configurations>
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+">
<BuildDependency Project="ZERO_CHECK\.vcxproj"/>
<Build Solution="Debug\|\*" Project="false"/>
<Build Solution="Release\|\*" Project="false"/>
<Build Solution="MinSizeRel\|\*" Project="false"/>
<Build Solution="RelWithDebInfo\|\*" Project="false"/>
</Project>
<Project Path="ZERO_CHECK\.vcxproj" Id="[0-9a-f-]+"/>
<Properties Name="ExtensibilityGlobals" Scope="PostLoad">
<Properties Name="Key1" Value="Value1"/>
<Properties Name="SolutionGuid" Value="{custom-guid}"/>
</Properties>
</Solution>$]])

View File

@@ -1 +1 @@
include(${CMAKE_CURRENT_LIST_DIR}/Override3-check-sln.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/Override3-check-${sln_ext}.cmake)

View File

@@ -0,0 +1,27 @@
RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/PrePost.slnx" [[
^<\?xml version="1\.0" encoding="UTF-8"\?>
<Solution>
<Configurations>
<BuildType Name="Debug"/>
<BuildType Name="Release"/>
<BuildType Name="MinSizeRel"/>
<BuildType Name="RelWithDebInfo"/>
<Platform Name="[^"]+"/>
</Configurations>
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+">
<BuildDependency Project="ZERO_CHECK\.vcxproj"/>
<Build Solution="Debug\|\*" Project="false"/>
<Build Solution="Release\|\*" Project="false"/>
<Build Solution="MinSizeRel\|\*" Project="false"/>
<Build Solution="RelWithDebInfo\|\*" Project="false"/>
</Project>
<Project Path="ZERO_CHECK\.vcxproj" Id="[0-9a-f-]+"/>
<Properties Name="Emptysec" Scope="PostLoad"/>
<Properties Name="Postsec" Scope="PostLoad">
<Properties Name="Key1" Value="Value2"/>
</Properties>
<Properties Name="Presec">
<Properties Name="Key1" Value="Value1"/>
<Properties Name="Key2" Value="Value with some spaces"/>
</Properties>
</Solution>$]])

View File

@@ -1 +1 @@
include(${CMAKE_CURRENT_LIST_DIR}/PrePost-check-sln.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/PrePost-check-${sln_ext}.cmake)

View File

@@ -1,5 +1,12 @@
cmake_minimum_required(VERSION 4.0)
include(RunCMake)
include(${CMAKE_CURRENT_LIST_DIR}/solution_parsing.cmake)
if(RunCMake_GENERATOR MATCHES "Visual Studio 1[4-7]")
include(${CMAKE_CURRENT_LIST_DIR}/solution_parsing.cmake)
set(sln_ext "sln")
else()
set(sln_ext "slnx")
endif()
run_cmake(DeployEnabled)
run_cmake(OnePre)

View File

@@ -0,0 +1,52 @@
RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/SolutionItems.slnx" [[
^<\?xml version="1\.0" encoding="UTF-8"\?>
<Solution>
<Configurations>
<BuildType Name="Debug"/>
<BuildType Name="Release"/>
<BuildType Name="MinSizeRel"/>
<BuildType Name="RelWithDebInfo"/>
<Platform Name="[^"]+"/>
</Configurations>
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+">
<BuildDependency Project="ZERO_CHECK\.vcxproj"/>
<Build Solution="Debug\|\*" Project="false"/>
<Build Solution="Release\|\*" Project="false"/>
<Build Solution="MinSizeRel\|\*" Project="false"/>
<Build Solution="RelWithDebInfo\|\*" Project="false"/>
</Project>
<Project Path="ZERO_CHECK\.vcxproj" Id="[0-9a-f-]+"/>
<Folder Name="/Outer Group/">
<File Path="[^"]*/Tests/RunCMake/VSSolution/solution-item-1-1\.txt"/>
</Folder>
<Folder Name="/Outer Group/Inner Group/">
<File Path="[^"]*/Tests/RunCMake/VSSolution/solution-item-2-1\.txt"/>
<File Path="[^"]*/Tests/RunCMake/VSSolution/solution-item-2-2\.txt"/>
</Folder>
<Folder Name="/Solution Items/">
<File Path="[^"]*/Tests/RunCMake/VSSolution/solution-item-0-1\.txt"/>
</Folder>
</Solution>$]])
RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/SolutionItems/SolutionItemsSubproject.slnx" [[
<\?xml version="1\.0" encoding="UTF-8"\?>
<Solution>
<Configurations>
<BuildType Name="Debug"/>
<BuildType Name="Release"/>
<BuildType Name="MinSizeRel"/>
<BuildType Name="RelWithDebInfo"/>
<Platform Name="[^"]+"/>
</Configurations>
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+">
<BuildDependency Project="\.\./ZERO_CHECK\.vcxproj"/>
<Build Solution="Debug\|\*" Project="false"/>
<Build Solution="Release\|\*" Project="false"/>
<Build Solution="MinSizeRel\|\*" Project="false"/>
<Build Solution="RelWithDebInfo\|\*" Project="false"/>
</Project>
<Project Path="\.\./ZERO_CHECK\.vcxproj" Id="[0-9a-f-]+"/>
<Folder Name="/Extraneous/">
<File Path="[^"]*/Tests/RunCMake/VSSolution/SolutionItems/extraneous\.txt"/>
</Folder>
</Solution>$]])

View File

@@ -1 +1 @@
include(${CMAKE_CURRENT_LIST_DIR}/SolutionItems-check-sln.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/SolutionItems-check-${sln_ext}.cmake)

View File

@@ -0,0 +1,26 @@
RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/StartupProject.slnx" [[
^<\?xml version="1\.0" encoding="UTF-8"\?>
<Solution>
<Configurations>
<BuildType Name="Debug"/>
<BuildType Name="Release"/>
<BuildType Name="MinSizeRel"/>
<BuildType Name="RelWithDebInfo"/>
<Platform Name="[^"]+"/>
</Configurations>
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+">
<BuildDependency Project="ZERO_CHECK\.vcxproj"/>
<Build Solution="Debug\|\*" Project="false"/>
<Build Solution="Release\|\*" Project="false"/>
<Build Solution="MinSizeRel\|\*" Project="false"/>
<Build Solution="RelWithDebInfo\|\*" Project="false"/>
</Project>
<Project Path="TestStartup\.vcxproj" Id="[0-9a-f-]+">
<BuildDependency Project="ZERO_CHECK\.vcxproj"/>
<Build Solution="Debug\|\*" Project="false"/>
<Build Solution="Release\|\*" Project="false"/>
<Build Solution="MinSizeRel\|\*" Project="false"/>
<Build Solution="RelWithDebInfo\|\*" Project="false"/>
</Project>
<Project Path="ZERO_CHECK\.vcxproj" Id="[0-9a-f-]+"/>
</Solution>$]])

View File

@@ -1 +1 @@
include(${CMAKE_CURRENT_LIST_DIR}/StartupProject-check-sln.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/StartupProject-check-${sln_ext}.cmake)

View File

@@ -0,0 +1,19 @@
RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/StartupProjectMissing.slnx" [[
^<\?xml version="1\.0" encoding="UTF-8"\?>
<Solution>
<Configurations>
<BuildType Name="Debug"/>
<BuildType Name="Release"/>
<BuildType Name="MinSizeRel"/>
<BuildType Name="RelWithDebInfo"/>
<Platform Name="[^"]+"/>
</Configurations>
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+">
<BuildDependency Project="ZERO_CHECK\.vcxproj"/>
<Build Solution="Debug\|\*" Project="false"/>
<Build Solution="Release\|\*" Project="false"/>
<Build Solution="MinSizeRel\|\*" Project="false"/>
<Build Solution="RelWithDebInfo\|\*" Project="false"/>
</Project>
<Project Path="ZERO_CHECK\.vcxproj" Id="[0-9a-f-]+"/>
</Solution>$]])

View File

@@ -1 +1 @@
include(${CMAKE_CURRENT_LIST_DIR}/StartupProjectMissing-check-sln.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/StartupProjectMissing-check-${sln_ext}.cmake)

View File

@@ -0,0 +1,28 @@
RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/StartupProjectUseFolders.slnx" [[
^<\?xml version="1\.0" encoding="UTF-8"\?>
<Solution>
<Configurations>
<BuildType Name="Debug"/>
<BuildType Name="Release"/>
<BuildType Name="MinSizeRel"/>
<BuildType Name="RelWithDebInfo"/>
<Platform Name="[^"]+"/>
</Configurations>
<Project Path="TestStartup\.vcxproj" Id="[0-9a-f-]+">
<BuildDependency Project="ZERO_CHECK.vcxproj"/>
<Build Solution="Debug\|\*" Project="false"/>
<Build Solution="Release\|\*" Project="false"/>
<Build Solution="MinSizeRel\|\*" Project="false"/>
<Build Solution="RelWithDebInfo\|\*" Project="false"/>
</Project>
<Folder Name="/CMakePredefinedTargets/">
<Project Path="ALL_BUILD.vcxproj" Id="[0-9a-f-]+">
<BuildDependency Project="ZERO_CHECK.vcxproj"/>
<Build Solution="Debug\|\*" Project="false"/>
<Build Solution="Release\|\*" Project="false"/>
<Build Solution="MinSizeRel\|\*" Project="false"/>
<Build Solution="RelWithDebInfo\|\*" Project="false"/>
</Project>
<Project Path="ZERO_CHECK.vcxproj" Id="[0-9a-f-]+"/>
</Folder>
</Solution>$]])

View File

@@ -1 +1 @@
include(${CMAKE_CURRENT_LIST_DIR}/StartupProjectUseFolders-check-sln.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/StartupProjectUseFolders-check-${sln_ext}.cmake)

View File

@@ -0,0 +1,24 @@
RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/CustomConfig.slnx" [[
^<\?xml version="1\.0" encoding="UTF-8"\?>
<Solution>
<Configurations>
<BuildType Name="Debug"/>
<BuildType Name="Release"/>
<BuildType Name="MinSizeRel"/>
<BuildType Name="RelWithDebInfo"/>
<Platform Name="[^"]+"/>
</Configurations>
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+">
<BuildDependency Project="ZERO_CHECK\.vcxproj"/>
<BuildDependency Project="external.project"/>
<Build Solution="Debug\|\*" Project="false"/>
<Build Solution="Release\|\*" Project="false"/>
<Build Solution="MinSizeRel\|\*" Project="false"/>
<Build Solution="RelWithDebInfo\|\*" Project="false"/>
</Project>
<Project Path="ZERO_CHECK\.vcxproj" Id="[0-9a-f-]+"/>
<Project Path="external.project" Id="aaa-bbb-ccc-000">
<BuildDependency Project="ZERO_CHECK.vcxproj"/>
<BuildType Project="Custom - Release"/>
</Project>
</Solution>$]])

View File

@@ -1 +1 @@
include(${CMAKE_CURRENT_LIST_DIR}/CustomConfig-check-sln.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/CustomConfig-check-${sln_ext}.cmake)

View File

@@ -0,0 +1,23 @@
RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/CustomGuid.slnx" [[
^<\?xml version="1\.0" encoding="UTF-8"\?>
<Solution>
<Configurations>
<BuildType Name="Debug"/>
<BuildType Name="Release"/>
<BuildType Name="MinSizeRel"/>
<BuildType Name="RelWithDebInfo"/>
<Platform Name="[^"]+"/>
</Configurations>
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+">
<BuildDependency Project="ZERO_CHECK\.vcxproj"/>
<BuildDependency Project="external.project"/>
<Build Solution="Debug\|\*" Project="false"/>
<Build Solution="Release\|\*" Project="false"/>
<Build Solution="MinSizeRel\|\*" Project="false"/>
<Build Solution="RelWithDebInfo\|\*" Project="false"/>
</Project>
<Project Path="ZERO_CHECK\.vcxproj" Id="[0-9a-f-]+"/>
<Project Path="external.project" Id="aaa-bbb-ccc-000">
<BuildDependency Project="ZERO_CHECK.vcxproj"/>
</Project>
</Solution>$]])

View File

@@ -1 +1 @@
include(${CMAKE_CURRENT_LIST_DIR}/CustomGuid-check-sln.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/CustomGuid-check-${sln_ext}.cmake)

View File

@@ -0,0 +1,24 @@
RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/CustomGuidTypePlatform.slnx" [[
^<\?xml version="1\.0" encoding="UTF-8"\?>
<Solution>
<Configurations>
<BuildType Name="Debug"/>
<BuildType Name="Release"/>
<BuildType Name="MinSizeRel"/>
<BuildType Name="RelWithDebInfo"/>
<Platform Name="[^"]+"/>
</Configurations>
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+">
<BuildDependency Project="ZERO_CHECK\.vcxproj"/>
<BuildDependency Project="external.project"/>
<Build Solution="Debug\|\*" Project="false"/>
<Build Solution="Release\|\*" Project="false"/>
<Build Solution="MinSizeRel\|\*" Project="false"/>
<Build Solution="RelWithDebInfo\|\*" Project="false"/>
</Project>
<Project Path="ZERO_CHECK\.vcxproj" Id="[0-9a-f-]+"/>
<Project Path="external.project" Id="aaa-bbb-ccc-111">
<BuildDependency Project="ZERO_CHECK.vcxproj"/>
<Platform Project="Custom Platform"/>
</Project>
</Solution>$]])

View File

@@ -1 +1 @@
include(${CMAKE_CURRENT_LIST_DIR}/CustomGuidTypePlatform-check-sln.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/CustomGuidTypePlatform-check-${sln_ext}.cmake)

View File

@@ -0,0 +1,24 @@
RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/CustomTypePlatform.slnx" [[
^<\?xml version="1\.0" encoding="UTF-8"\?>
<Solution>
<Configurations>
<BuildType Name="Debug"/>
<BuildType Name="Release"/>
<BuildType Name="MinSizeRel"/>
<BuildType Name="RelWithDebInfo"/>
<Platform Name="[^"]+"/>
</Configurations>
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+">
<BuildDependency Project="ZERO_CHECK\.vcxproj"/>
<BuildDependency Project="external.project"/>
<Build Solution="Debug\|\*" Project="false"/>
<Build Solution="Release\|\*" Project="false"/>
<Build Solution="MinSizeRel\|\*" Project="false"/>
<Build Solution="RelWithDebInfo\|\*" Project="false"/>
</Project>
<Project Path="ZERO_CHECK\.vcxproj" Id="[0-9a-f-]+"/>
<Project Path="external.project" Id="[0-9a-f-]+">
<BuildDependency Project="ZERO_CHECK.vcxproj"/>
<Platform Project="Custom Platform"/>
</Project>
</Solution>$]])

View File

@@ -1 +1 @@
include(${CMAKE_CURRENT_LIST_DIR}/CustomTypePlatform-check-sln.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/CustomTypePlatform-check-${sln_ext}.cmake)

View File

@@ -1,6 +1,13 @@
cmake_minimum_required(VERSION 4.0)
include(RunCMake)
include(${CMAKE_CURRENT_LIST_DIR}/check_utils.cmake)
if(RunCMake_GENERATOR MATCHES "Visual Studio 1[4-7]")
set(sln_ext "sln")
else()
set(sln_ext "slnx")
endif()
run_cmake(CustomGuid)
run_cmake(CustomTypePlatform)
run_cmake(CustomGuidTypePlatform)