diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 4c1c7a1d0d..9c382d8ef1 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -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 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> 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 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); diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index a1717fe23e..a4e25d8919 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -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); diff --git a/Source/cmVSSolution.cxx b/Source/cmVSSolution.cxx index 99323746bf..ae973e3824 100644 --- a/Source/cmVSSolution.cxx +++ b/Source/cmVSSolution.cxx @@ -10,7 +10,9 @@ #include #include +#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); + } +} + } } diff --git a/Source/cmVSSolution.h b/Source/cmVSSolution.h index adc5127200..e2cf5a147a 100644 --- a/Source/cmVSSolution.h +++ b/Source/cmVSSolution.h @@ -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); + } } diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index edead7524e..9823c95e35 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -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) diff --git a/Tests/RunCMake/VSSolution/AddPackageToDefault-check-slnx.cmake b/Tests/RunCMake/VSSolution/AddPackageToDefault-check-slnx.cmake new file mode 100644 index 0000000000..b60f278f40 --- /dev/null +++ b/Tests/RunCMake/VSSolution/AddPackageToDefault-check-slnx.cmake @@ -0,0 +1,19 @@ +RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/AddPackageToDefault.slnx" [[ +^<\?xml version="1\.0" encoding="UTF-8"\?> + + + + + + + + + + + + + + + + +$]]) diff --git a/Tests/RunCMake/VSSolution/AddPackageToDefault-check.cmake b/Tests/RunCMake/VSSolution/AddPackageToDefault-check.cmake index 4be7fddece..f8eb1fc0b7 100644 --- a/Tests/RunCMake/VSSolution/AddPackageToDefault-check.cmake +++ b/Tests/RunCMake/VSSolution/AddPackageToDefault-check.cmake @@ -1 +1 @@ -include(${CMAKE_CURRENT_LIST_DIR}/AddPackageToDefault-check-sln.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/AddPackageToDefault-check-${sln_ext}.cmake) diff --git a/Tests/RunCMake/VSSolution/CMP0143-NEW-check-slnx.cmake b/Tests/RunCMake/VSSolution/CMP0143-NEW-check-slnx.cmake new file mode 100644 index 0000000000..67d10cb384 --- /dev/null +++ b/Tests/RunCMake/VSSolution/CMP0143-NEW-check-slnx.cmake @@ -0,0 +1,28 @@ +RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/CMP0143-NEW.slnx" [[ +^<\?xml version="1\.0" encoding="UTF-8"\?> + + + + + + + + + + + + + + + + + + + + + + + + + +$]]) diff --git a/Tests/RunCMake/VSSolution/CMP0143-NEW-check.cmake b/Tests/RunCMake/VSSolution/CMP0143-NEW-check.cmake index 269f7ee203..058ef51ad8 100644 --- a/Tests/RunCMake/VSSolution/CMP0143-NEW-check.cmake +++ b/Tests/RunCMake/VSSolution/CMP0143-NEW-check.cmake @@ -1 +1 @@ -include(${CMAKE_CURRENT_LIST_DIR}/CMP0143-NEW-check-sln.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/CMP0143-NEW-check-${sln_ext}.cmake) diff --git a/Tests/RunCMake/VSSolution/CMP0143-OLD-check-slnx.cmake b/Tests/RunCMake/VSSolution/CMP0143-OLD-check-slnx.cmake new file mode 100644 index 0000000000..cfcb5d43b6 --- /dev/null +++ b/Tests/RunCMake/VSSolution/CMP0143-OLD-check-slnx.cmake @@ -0,0 +1,26 @@ +RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/CMP0143-OLD.slnx" [[ +^<\?xml version="1\.0" encoding="UTF-8"\?> + + + + + + + + + + + + + + + + + + + + + + + +$]]) diff --git a/Tests/RunCMake/VSSolution/CMP0143-OLD-check.cmake b/Tests/RunCMake/VSSolution/CMP0143-OLD-check.cmake index 876af451f3..9c777c1c94 100644 --- a/Tests/RunCMake/VSSolution/CMP0143-OLD-check.cmake +++ b/Tests/RunCMake/VSSolution/CMP0143-OLD-check.cmake @@ -1 +1 @@ -include(${CMAKE_CURRENT_LIST_DIR}/CMP0143-OLD-check-sln.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/CMP0143-OLD-check-${sln_ext}.cmake) diff --git a/Tests/RunCMake/VSSolution/CMP0143-WARN-check-slnx.cmake b/Tests/RunCMake/VSSolution/CMP0143-WARN-check-slnx.cmake new file mode 100644 index 0000000000..0c51664732 --- /dev/null +++ b/Tests/RunCMake/VSSolution/CMP0143-WARN-check-slnx.cmake @@ -0,0 +1,26 @@ +RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/CMP0143-WARN.slnx" [[ +^<\?xml version="1\.0" encoding="UTF-8"\?> + + + + + + + + + + + + + + + + + + + + + + + +$]]) diff --git a/Tests/RunCMake/VSSolution/CMP0143-WARN-check.cmake b/Tests/RunCMake/VSSolution/CMP0143-WARN-check.cmake index 04db17e94c..c0013bbff4 100644 --- a/Tests/RunCMake/VSSolution/CMP0143-WARN-check.cmake +++ b/Tests/RunCMake/VSSolution/CMP0143-WARN-check.cmake @@ -1 +1 @@ -include(${CMAKE_CURRENT_LIST_DIR}/CMP0143-WARN-check-sln.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/CMP0143-WARN-check-${sln_ext}.cmake) diff --git a/Tests/RunCMake/VSSolution/DeployEnabled-check-slnx.cmake b/Tests/RunCMake/VSSolution/DeployEnabled-check-slnx.cmake new file mode 100644 index 0000000000..94b297dc80 --- /dev/null +++ b/Tests/RunCMake/VSSolution/DeployEnabled-check-slnx.cmake @@ -0,0 +1,26 @@ +RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/DeployEnabled.slnx" [[ +^<\?xml version="1\.0" encoding="UTF-8"\?> + + + + + + + + + + + + + + + + + + + + + + + +$]]) diff --git a/Tests/RunCMake/VSSolution/DeployEnabled-check.cmake b/Tests/RunCMake/VSSolution/DeployEnabled-check.cmake index 864ccaf37d..d92383e085 100644 --- a/Tests/RunCMake/VSSolution/DeployEnabled-check.cmake +++ b/Tests/RunCMake/VSSolution/DeployEnabled-check.cmake @@ -1 +1 @@ -include(${CMAKE_CURRENT_LIST_DIR}/DeployEnabled-check-sln.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/DeployEnabled-check-${sln_ext}.cmake) diff --git a/Tests/RunCMake/VSSolution/MorePost-check-slnx.cmake b/Tests/RunCMake/VSSolution/MorePost-check-slnx.cmake new file mode 100644 index 0000000000..ef8173b42f --- /dev/null +++ b/Tests/RunCMake/VSSolution/MorePost-check-slnx.cmake @@ -0,0 +1,28 @@ +RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/MorePost.slnx" [[ +^<\?xml version="1\.0" encoding="UTF-8"\?> + + + + + + + + + + + + + + + + + + + + + + + + + +$]]) diff --git a/Tests/RunCMake/VSSolution/MorePost-check.cmake b/Tests/RunCMake/VSSolution/MorePost-check.cmake index cceb165386..5eebe6ecb7 100644 --- a/Tests/RunCMake/VSSolution/MorePost-check.cmake +++ b/Tests/RunCMake/VSSolution/MorePost-check.cmake @@ -1 +1 @@ -include(${CMAKE_CURRENT_LIST_DIR}/MorePost-check-sln.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/MorePost-check-${sln_ext}.cmake) diff --git a/Tests/RunCMake/VSSolution/MorePre-check-slnx.cmake b/Tests/RunCMake/VSSolution/MorePre-check-slnx.cmake new file mode 100644 index 0000000000..d025b6c6bf --- /dev/null +++ b/Tests/RunCMake/VSSolution/MorePre-check-slnx.cmake @@ -0,0 +1,28 @@ +RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/MorePre.slnx" [[ +^<\?xml version="1\.0" encoding="UTF-8"\?> + + + + + + + + + + + + + + + + + + + + + + + + + +$]]) diff --git a/Tests/RunCMake/VSSolution/MorePre-check.cmake b/Tests/RunCMake/VSSolution/MorePre-check.cmake index 92917b68e9..eee3dfa700 100644 --- a/Tests/RunCMake/VSSolution/MorePre-check.cmake +++ b/Tests/RunCMake/VSSolution/MorePre-check.cmake @@ -1 +1 @@ -include(${CMAKE_CURRENT_LIST_DIR}/MorePre-check-sln.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/MorePre-check-${sln_ext}.cmake) diff --git a/Tests/RunCMake/VSSolution/OnePost-check-slnx.cmake b/Tests/RunCMake/VSSolution/OnePost-check-slnx.cmake new file mode 100644 index 0000000000..4556be6bfd --- /dev/null +++ b/Tests/RunCMake/VSSolution/OnePost-check-slnx.cmake @@ -0,0 +1,23 @@ +RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/OnePost.slnx" [[ +^<\?xml version="1\.0" encoding="UTF-8"\?> + + + + + + + + + + + + + + + + + + + + +$]]) diff --git a/Tests/RunCMake/VSSolution/OnePost-check.cmake b/Tests/RunCMake/VSSolution/OnePost-check.cmake index 57536467fb..af89dc7069 100644 --- a/Tests/RunCMake/VSSolution/OnePost-check.cmake +++ b/Tests/RunCMake/VSSolution/OnePost-check.cmake @@ -1 +1 @@ -include(${CMAKE_CURRENT_LIST_DIR}/OnePost-check-sln.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/OnePost-check-${sln_ext}.cmake) diff --git a/Tests/RunCMake/VSSolution/OnePre-check-slnx.cmake b/Tests/RunCMake/VSSolution/OnePre-check-slnx.cmake new file mode 100644 index 0000000000..e01b91a683 --- /dev/null +++ b/Tests/RunCMake/VSSolution/OnePre-check-slnx.cmake @@ -0,0 +1,23 @@ +RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/OnePre.slnx" [[ +^<\?xml version="1\.0" encoding="UTF-8"\?> + + + + + + + + + + + + + + + + + + + + +$]]) diff --git a/Tests/RunCMake/VSSolution/OnePre-check.cmake b/Tests/RunCMake/VSSolution/OnePre-check.cmake index 69d3979a72..3d1aff0ad7 100644 --- a/Tests/RunCMake/VSSolution/OnePre-check.cmake +++ b/Tests/RunCMake/VSSolution/OnePre-check.cmake @@ -1 +1 @@ -include(${CMAKE_CURRENT_LIST_DIR}/OnePre-check-sln.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/OnePre-check-${sln_ext}.cmake) diff --git a/Tests/RunCMake/VSSolution/Override1-check-slnx.cmake b/Tests/RunCMake/VSSolution/Override1-check-slnx.cmake new file mode 100644 index 0000000000..6b53eead35 --- /dev/null +++ b/Tests/RunCMake/VSSolution/Override1-check-slnx.cmake @@ -0,0 +1,26 @@ +RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/Override1.slnx" [[ +^<\?xml version="1\.0" encoding="UTF-8"\?> + + + + + + + + + + + + + + + + + + + + + + + +$]]) diff --git a/Tests/RunCMake/VSSolution/Override1-check.cmake b/Tests/RunCMake/VSSolution/Override1-check.cmake index d365a1159f..200b8f813f 100644 --- a/Tests/RunCMake/VSSolution/Override1-check.cmake +++ b/Tests/RunCMake/VSSolution/Override1-check.cmake @@ -1 +1 @@ -include(${CMAKE_CURRENT_LIST_DIR}/Override1-check-sln.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/Override1-check-${sln_ext}.cmake) diff --git a/Tests/RunCMake/VSSolution/Override2-check-slnx.cmake b/Tests/RunCMake/VSSolution/Override2-check-slnx.cmake new file mode 100644 index 0000000000..8a80a0ec44 --- /dev/null +++ b/Tests/RunCMake/VSSolution/Override2-check-slnx.cmake @@ -0,0 +1,26 @@ +RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/Override2.slnx" [[ +^<\?xml version="1\.0" encoding="UTF-8"\?> + + + + + + + + + + + + + + + + + + + + + + + +$]]) diff --git a/Tests/RunCMake/VSSolution/Override2-check.cmake b/Tests/RunCMake/VSSolution/Override2-check.cmake index 62e0d5af90..601a6db690 100644 --- a/Tests/RunCMake/VSSolution/Override2-check.cmake +++ b/Tests/RunCMake/VSSolution/Override2-check.cmake @@ -1 +1 @@ -include(${CMAKE_CURRENT_LIST_DIR}/Override2-check-sln.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/Override2-check-${sln_ext}.cmake) diff --git a/Tests/RunCMake/VSSolution/Override3-check-slnx.cmake b/Tests/RunCMake/VSSolution/Override3-check-slnx.cmake new file mode 100644 index 0000000000..93d6dc5e53 --- /dev/null +++ b/Tests/RunCMake/VSSolution/Override3-check-slnx.cmake @@ -0,0 +1,23 @@ +RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/Override3.slnx" [[ +^<\?xml version="1\.0" encoding="UTF-8"\?> + + + + + + + + + + + + + + + + + + + + +$]]) diff --git a/Tests/RunCMake/VSSolution/Override3-check.cmake b/Tests/RunCMake/VSSolution/Override3-check.cmake index 54babcb8a0..284fb89b80 100644 --- a/Tests/RunCMake/VSSolution/Override3-check.cmake +++ b/Tests/RunCMake/VSSolution/Override3-check.cmake @@ -1 +1 @@ -include(${CMAKE_CURRENT_LIST_DIR}/Override3-check-sln.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/Override3-check-${sln_ext}.cmake) diff --git a/Tests/RunCMake/VSSolution/PrePost-check-slnx.cmake b/Tests/RunCMake/VSSolution/PrePost-check-slnx.cmake new file mode 100644 index 0000000000..824add6565 --- /dev/null +++ b/Tests/RunCMake/VSSolution/PrePost-check-slnx.cmake @@ -0,0 +1,27 @@ +RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/PrePost.slnx" [[ +^<\?xml version="1\.0" encoding="UTF-8"\?> + + + + + + + + + + + + + + + + + + + + + + + + +$]]) diff --git a/Tests/RunCMake/VSSolution/PrePost-check.cmake b/Tests/RunCMake/VSSolution/PrePost-check.cmake index bb22ea992c..da6da15f36 100644 --- a/Tests/RunCMake/VSSolution/PrePost-check.cmake +++ b/Tests/RunCMake/VSSolution/PrePost-check.cmake @@ -1 +1 @@ -include(${CMAKE_CURRENT_LIST_DIR}/PrePost-check-sln.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/PrePost-check-${sln_ext}.cmake) diff --git a/Tests/RunCMake/VSSolution/RunCMakeTest.cmake b/Tests/RunCMake/VSSolution/RunCMakeTest.cmake index 328a0aaf98..1944614563 100644 --- a/Tests/RunCMake/VSSolution/RunCMakeTest.cmake +++ b/Tests/RunCMake/VSSolution/RunCMakeTest.cmake @@ -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) diff --git a/Tests/RunCMake/VSSolution/SolutionItems-check-slnx.cmake b/Tests/RunCMake/VSSolution/SolutionItems-check-slnx.cmake new file mode 100644 index 0000000000..ee6f654b31 --- /dev/null +++ b/Tests/RunCMake/VSSolution/SolutionItems-check-slnx.cmake @@ -0,0 +1,52 @@ +RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/SolutionItems.slnx" [[ +^<\?xml version="1\.0" encoding="UTF-8"\?> + + + + + + + + + + + + + + + + + + + + + + + + + + +$]]) + +RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/SolutionItems/SolutionItemsSubproject.slnx" [[ +<\?xml version="1\.0" encoding="UTF-8"\?> + + + + + + + + + + + + + + + + + + + +$]]) diff --git a/Tests/RunCMake/VSSolution/SolutionItems-check.cmake b/Tests/RunCMake/VSSolution/SolutionItems-check.cmake index 2812678f4e..dc7e642681 100644 --- a/Tests/RunCMake/VSSolution/SolutionItems-check.cmake +++ b/Tests/RunCMake/VSSolution/SolutionItems-check.cmake @@ -1 +1 @@ -include(${CMAKE_CURRENT_LIST_DIR}/SolutionItems-check-sln.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/SolutionItems-check-${sln_ext}.cmake) diff --git a/Tests/RunCMake/VSSolution/StartupProject-check-slnx.cmake b/Tests/RunCMake/VSSolution/StartupProject-check-slnx.cmake new file mode 100644 index 0000000000..efd6fcd6ab --- /dev/null +++ b/Tests/RunCMake/VSSolution/StartupProject-check-slnx.cmake @@ -0,0 +1,26 @@ +RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/StartupProject.slnx" [[ +^<\?xml version="1\.0" encoding="UTF-8"\?> + + + + + + + + + + + + + + + + + + + + + + + +$]]) diff --git a/Tests/RunCMake/VSSolution/StartupProject-check.cmake b/Tests/RunCMake/VSSolution/StartupProject-check.cmake index 54cbb17875..1d9c80d9e0 100644 --- a/Tests/RunCMake/VSSolution/StartupProject-check.cmake +++ b/Tests/RunCMake/VSSolution/StartupProject-check.cmake @@ -1 +1 @@ -include(${CMAKE_CURRENT_LIST_DIR}/StartupProject-check-sln.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/StartupProject-check-${sln_ext}.cmake) diff --git a/Tests/RunCMake/VSSolution/StartupProjectMissing-check-slnx.cmake b/Tests/RunCMake/VSSolution/StartupProjectMissing-check-slnx.cmake new file mode 100644 index 0000000000..f2de6f324c --- /dev/null +++ b/Tests/RunCMake/VSSolution/StartupProjectMissing-check-slnx.cmake @@ -0,0 +1,19 @@ +RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/StartupProjectMissing.slnx" [[ +^<\?xml version="1\.0" encoding="UTF-8"\?> + + + + + + + + + + + + + + + + +$]]) diff --git a/Tests/RunCMake/VSSolution/StartupProjectMissing-check.cmake b/Tests/RunCMake/VSSolution/StartupProjectMissing-check.cmake index 3d83cf7add..65acbbed60 100644 --- a/Tests/RunCMake/VSSolution/StartupProjectMissing-check.cmake +++ b/Tests/RunCMake/VSSolution/StartupProjectMissing-check.cmake @@ -1 +1 @@ -include(${CMAKE_CURRENT_LIST_DIR}/StartupProjectMissing-check-sln.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/StartupProjectMissing-check-${sln_ext}.cmake) diff --git a/Tests/RunCMake/VSSolution/StartupProjectUseFolders-check-slnx.cmake b/Tests/RunCMake/VSSolution/StartupProjectUseFolders-check-slnx.cmake new file mode 100644 index 0000000000..dcebe09298 --- /dev/null +++ b/Tests/RunCMake/VSSolution/StartupProjectUseFolders-check-slnx.cmake @@ -0,0 +1,28 @@ +RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/StartupProjectUseFolders.slnx" [[ +^<\?xml version="1\.0" encoding="UTF-8"\?> + + + + + + + + + + + + + + + + + + + + + + + + + +$]]) diff --git a/Tests/RunCMake/VSSolution/StartupProjectUseFolders-check.cmake b/Tests/RunCMake/VSSolution/StartupProjectUseFolders-check.cmake index 5451e1b24a..55a673cfbc 100644 --- a/Tests/RunCMake/VSSolution/StartupProjectUseFolders-check.cmake +++ b/Tests/RunCMake/VSSolution/StartupProjectUseFolders-check.cmake @@ -1 +1 @@ -include(${CMAKE_CURRENT_LIST_DIR}/StartupProjectUseFolders-check-sln.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/StartupProjectUseFolders-check-${sln_ext}.cmake) diff --git a/Tests/RunCMake/include_external_msproject/CustomConfig-check-slnx.cmake b/Tests/RunCMake/include_external_msproject/CustomConfig-check-slnx.cmake new file mode 100644 index 0000000000..7ccf4f76d2 --- /dev/null +++ b/Tests/RunCMake/include_external_msproject/CustomConfig-check-slnx.cmake @@ -0,0 +1,24 @@ +RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/CustomConfig.slnx" [[ +^<\?xml version="1\.0" encoding="UTF-8"\?> + + + + + + + + + + + + + + + + + + + + + +$]]) diff --git a/Tests/RunCMake/include_external_msproject/CustomConfig-check.cmake b/Tests/RunCMake/include_external_msproject/CustomConfig-check.cmake index 3157e1513a..65c450eb19 100644 --- a/Tests/RunCMake/include_external_msproject/CustomConfig-check.cmake +++ b/Tests/RunCMake/include_external_msproject/CustomConfig-check.cmake @@ -1 +1 @@ -include(${CMAKE_CURRENT_LIST_DIR}/CustomConfig-check-sln.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/CustomConfig-check-${sln_ext}.cmake) diff --git a/Tests/RunCMake/include_external_msproject/CustomGuid-check-slnx.cmake b/Tests/RunCMake/include_external_msproject/CustomGuid-check-slnx.cmake new file mode 100644 index 0000000000..c03a4280f8 --- /dev/null +++ b/Tests/RunCMake/include_external_msproject/CustomGuid-check-slnx.cmake @@ -0,0 +1,23 @@ +RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/CustomGuid.slnx" [[ +^<\?xml version="1\.0" encoding="UTF-8"\?> + + + + + + + + + + + + + + + + + + + + +$]]) diff --git a/Tests/RunCMake/include_external_msproject/CustomGuid-check.cmake b/Tests/RunCMake/include_external_msproject/CustomGuid-check.cmake index 72647df961..c8f0e399a0 100644 --- a/Tests/RunCMake/include_external_msproject/CustomGuid-check.cmake +++ b/Tests/RunCMake/include_external_msproject/CustomGuid-check.cmake @@ -1 +1 @@ -include(${CMAKE_CURRENT_LIST_DIR}/CustomGuid-check-sln.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/CustomGuid-check-${sln_ext}.cmake) diff --git a/Tests/RunCMake/include_external_msproject/CustomGuidTypePlatform-check-slnx.cmake b/Tests/RunCMake/include_external_msproject/CustomGuidTypePlatform-check-slnx.cmake new file mode 100644 index 0000000000..9792fde7ec --- /dev/null +++ b/Tests/RunCMake/include_external_msproject/CustomGuidTypePlatform-check-slnx.cmake @@ -0,0 +1,24 @@ +RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/CustomGuidTypePlatform.slnx" [[ +^<\?xml version="1\.0" encoding="UTF-8"\?> + + + + + + + + + + + + + + + + + + + + + +$]]) diff --git a/Tests/RunCMake/include_external_msproject/CustomGuidTypePlatform-check.cmake b/Tests/RunCMake/include_external_msproject/CustomGuidTypePlatform-check.cmake index 5a1ce5f7b6..20c0d53f7e 100644 --- a/Tests/RunCMake/include_external_msproject/CustomGuidTypePlatform-check.cmake +++ b/Tests/RunCMake/include_external_msproject/CustomGuidTypePlatform-check.cmake @@ -1 +1 @@ -include(${CMAKE_CURRENT_LIST_DIR}/CustomGuidTypePlatform-check-sln.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/CustomGuidTypePlatform-check-${sln_ext}.cmake) diff --git a/Tests/RunCMake/include_external_msproject/CustomTypePlatform-check-slnx.cmake b/Tests/RunCMake/include_external_msproject/CustomTypePlatform-check-slnx.cmake new file mode 100644 index 0000000000..30156f1542 --- /dev/null +++ b/Tests/RunCMake/include_external_msproject/CustomTypePlatform-check-slnx.cmake @@ -0,0 +1,24 @@ +RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/CustomTypePlatform.slnx" [[ +^<\?xml version="1\.0" encoding="UTF-8"\?> + + + + + + + + + + + + + + + + + + + + + +$]]) diff --git a/Tests/RunCMake/include_external_msproject/CustomTypePlatform-check.cmake b/Tests/RunCMake/include_external_msproject/CustomTypePlatform-check.cmake index d1cc9f317a..8138a3a458 100644 --- a/Tests/RunCMake/include_external_msproject/CustomTypePlatform-check.cmake +++ b/Tests/RunCMake/include_external_msproject/CustomTypePlatform-check.cmake @@ -1 +1 @@ -include(${CMAKE_CURRENT_LIST_DIR}/CustomTypePlatform-check-sln.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/CustomTypePlatform-check-${sln_ext}.cmake) diff --git a/Tests/RunCMake/include_external_msproject/RunCMakeTest.cmake b/Tests/RunCMake/include_external_msproject/RunCMakeTest.cmake index 11be360994..3526e0f34c 100644 --- a/Tests/RunCMake/include_external_msproject/RunCMakeTest.cmake +++ b/Tests/RunCMake/include_external_msproject/RunCMakeTest.cmake @@ -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)