mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-14 02:08:27 +08:00
VS: Restore include_external_msproject type detection
Refactoring in commit 3882718872
(VS: Decouple solution generation from
`.sln` file format, 2025-09-15) accidentally left out automatic
detection of the external project type id from its file extension.
This commit is contained in:
@@ -175,34 +175,6 @@ std::string cmGlobalVisualStudio7Generator::FindDevEnvCommand()
|
|||||||
return vscmd;
|
return vscmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
char const* cmGlobalVisualStudio7Generator::ExternalProjectType(
|
|
||||||
std::string const& location)
|
|
||||||
{
|
|
||||||
std::string extension = cmSystemTools::GetFilenameLastExtension(location);
|
|
||||||
if (extension == ".vbproj"_s) {
|
|
||||||
return "F184B08F-C81C-45F6-A57F-5ABD9991F28F";
|
|
||||||
}
|
|
||||||
if (extension == ".csproj"_s) {
|
|
||||||
return "FAE04EC0-301F-11D3-BF4B-00C04F79EFBC";
|
|
||||||
}
|
|
||||||
if (extension == ".fsproj"_s) {
|
|
||||||
return "F2A71F9B-5D33-465A-A702-920D77279786";
|
|
||||||
}
|
|
||||||
if (extension == ".vdproj"_s) {
|
|
||||||
return "54435603-DBB4-11D2-8724-00A0C9A8B90C";
|
|
||||||
}
|
|
||||||
if (extension == ".dbproj"_s) {
|
|
||||||
return "C8D11400-126E-41CD-887F-60BD40844F9E";
|
|
||||||
}
|
|
||||||
if (extension == ".wixproj"_s) {
|
|
||||||
return "930C7802-8A8C-48F9-8165-68863BCCD9DD";
|
|
||||||
}
|
|
||||||
if (extension == ".pyproj"_s) {
|
|
||||||
return "888888A0-9F3D-457C-B088-3A5042F75D52";
|
|
||||||
}
|
|
||||||
return "8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942";
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<cmGlobalGenerator::GeneratedMakeCommand>
|
std::vector<cmGlobalGenerator::GeneratedMakeCommand>
|
||||||
cmGlobalVisualStudio7Generator::GenerateBuildCommand(
|
cmGlobalVisualStudio7Generator::GenerateBuildCommand(
|
||||||
std::string const& makeProgram, std::string const& projectName,
|
std::string const& makeProgram, std::string const& projectName,
|
||||||
|
@@ -121,8 +121,6 @@ protected:
|
|||||||
std::string const& GetDevEnvCommand();
|
std::string const& GetDevEnvCommand();
|
||||||
virtual std::string FindDevEnvCommand();
|
virtual std::string FindDevEnvCommand();
|
||||||
|
|
||||||
static char const* ExternalProjectType(std::string const& location);
|
|
||||||
|
|
||||||
bool MarmasmEnabled;
|
bool MarmasmEnabled;
|
||||||
bool MasmEnabled;
|
bool MasmEnabled;
|
||||||
bool NasmEnabled;
|
bool NasmEnabled;
|
||||||
|
@@ -774,6 +774,38 @@ bool cmGlobalVisualStudioGenerator::Open(std::string const& bindir,
|
|||||||
return std::async(std::launch::async, OpenSolution, sln).get();
|
return std::async(std::launch::async, OpenSolution, sln).get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cm::string_view cmGlobalVisualStudioGenerator::ExternalProjectTypeId(
|
||||||
|
std::string const& path)
|
||||||
|
{
|
||||||
|
using namespace cm::VS;
|
||||||
|
std::string const extension = cmSystemTools::GetFilenameLastExtension(path);
|
||||||
|
if (extension == ".vfproj"_s) {
|
||||||
|
return Solution::Project::TypeIdFortran;
|
||||||
|
}
|
||||||
|
if (extension == ".vbproj"_s) {
|
||||||
|
return Solution::Project::TypeIdVisualBasic;
|
||||||
|
}
|
||||||
|
if (extension == ".csproj"_s) {
|
||||||
|
return Solution::Project::TypeIdCSharp;
|
||||||
|
}
|
||||||
|
if (extension == ".fsproj"_s) {
|
||||||
|
return Solution::Project::TypeIdFSharp;
|
||||||
|
}
|
||||||
|
if (extension == ".vdproj"_s) {
|
||||||
|
return Solution::Project::TypeIdVDProj;
|
||||||
|
}
|
||||||
|
if (extension == ".dbproj"_s) {
|
||||||
|
return Solution::Project::TypeIdDatabase;
|
||||||
|
}
|
||||||
|
if (extension == ".wixproj"_s) {
|
||||||
|
return Solution::Project::TypeIdWiX;
|
||||||
|
}
|
||||||
|
if (extension == ".pyproj"_s) {
|
||||||
|
return Solution::Project::TypeIdPython;
|
||||||
|
}
|
||||||
|
return Solution::Project::TypeIdDefault;
|
||||||
|
}
|
||||||
|
|
||||||
bool cmGlobalVisualStudioGenerator::IsDependedOn(
|
bool cmGlobalVisualStudioGenerator::IsDependedOn(
|
||||||
TargetDependSet const& projectTargets, cmGeneratorTarget const* gtIn) const
|
TargetDependSet const& projectTargets, cmGeneratorTarget const* gtIn) const
|
||||||
{
|
{
|
||||||
@@ -936,7 +968,7 @@ cm::VS::Solution cmGlobalVisualStudioGenerator::CreateSolution(
|
|||||||
if (!projectType.IsEmpty()) {
|
if (!projectType.IsEmpty()) {
|
||||||
project->TypeId = *projectType;
|
project->TypeId = *projectType;
|
||||||
} else {
|
} else {
|
||||||
project->TypeId = Solution::Project::TypeIdDefault;
|
project->TypeId = this->ExternalProjectTypeId(project->Path);
|
||||||
}
|
}
|
||||||
for (std::string const& config : solution.Configs) {
|
for (std::string const& config : solution.Configs) {
|
||||||
cmList mapConfig{ gt->GetProperty(cmStrCat(
|
cmList mapConfig{ gt->GetProperty(cmStrCat(
|
||||||
|
@@ -183,6 +183,8 @@ protected:
|
|||||||
/** Returns true if the target system support debugging deployment. */
|
/** Returns true if the target system support debugging deployment. */
|
||||||
virtual bool TargetSystemSupportsDeployment() const = 0;
|
virtual bool TargetSystemSupportsDeployment() const = 0;
|
||||||
|
|
||||||
|
static cm::string_view ExternalProjectTypeId(std::string const& path);
|
||||||
|
|
||||||
std::set<std::string> IsPartOfDefaultBuild(
|
std::set<std::string> IsPartOfDefaultBuild(
|
||||||
std::vector<std::string> const& configs,
|
std::vector<std::string> const& configs,
|
||||||
TargetDependSet const& projectTargets,
|
TargetDependSet const& projectTargets,
|
||||||
|
@@ -17,12 +17,25 @@
|
|||||||
namespace cm {
|
namespace cm {
|
||||||
namespace VS {
|
namespace VS {
|
||||||
|
|
||||||
cm::string_view const Solution::Project::TypeIdDefault =
|
|
||||||
"8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942"_s;
|
|
||||||
cm::string_view const Solution::Project::TypeIdCSharp =
|
cm::string_view const Solution::Project::TypeIdCSharp =
|
||||||
"FAE04EC0-301F-11D3-BF4B-00C04F79EFBC"_s;
|
"FAE04EC0-301F-11D3-BF4B-00C04F79EFBC"_s;
|
||||||
|
cm::string_view const Solution::Project::TypeIdDatabase =
|
||||||
|
"C8D11400-126E-41CD-887F-60BD40844F9E"_s;
|
||||||
|
cm::string_view const Solution::Project::TypeIdDefault =
|
||||||
|
"8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942"_s;
|
||||||
|
cm::string_view const Solution::Project::TypeIdFSharp =
|
||||||
|
"F2A71F9B-5D33-465A-A702-920D77279786"_s;
|
||||||
cm::string_view const Solution::Project::TypeIdFortran =
|
cm::string_view const Solution::Project::TypeIdFortran =
|
||||||
"6989167D-11E4-40FE-8C1A-2192A86A7E90"_s;
|
"6989167D-11E4-40FE-8C1A-2192A86A7E90"_s;
|
||||||
|
cm::string_view const Solution::Project::TypeIdPython =
|
||||||
|
"888888A0-9F3D-457C-B088-3A5042F75D52"_s;
|
||||||
|
cm::string_view const Solution::Project::TypeIdVDProj =
|
||||||
|
"54435603-DBB4-11D2-8724-00A0C9A8B90C"_s;
|
||||||
|
cm::string_view const Solution::Project::TypeIdVisualBasic =
|
||||||
|
"F184B08F-C81C-45F6-A57F-5ABD9991F28F"_s;
|
||||||
|
cm::string_view const Solution::Project::TypeIdWiX =
|
||||||
|
"930C7802-8A8C-48F9-8165-68863BCCD9DD"_s;
|
||||||
|
|
||||||
cm::string_view const Solution::Folder::TypeId =
|
cm::string_view const Solution::Folder::TypeId =
|
||||||
"2150E333-8FDC-42A3-9474-1A3956D46DE8"_s;
|
"2150E333-8FDC-42A3-9474-1A3956D46DE8"_s;
|
||||||
|
|
||||||
|
@@ -70,9 +70,15 @@ struct Solution final
|
|||||||
std::vector<Project const*> BuildDependencies;
|
std::vector<Project const*> BuildDependencies;
|
||||||
|
|
||||||
// Project type GUIDs used during creation.
|
// Project type GUIDs used during creation.
|
||||||
static cm::string_view const TypeIdDefault;
|
|
||||||
static cm::string_view const TypeIdCSharp;
|
static cm::string_view const TypeIdCSharp;
|
||||||
|
static cm::string_view const TypeIdDatabase;
|
||||||
|
static cm::string_view const TypeIdDefault;
|
||||||
|
static cm::string_view const TypeIdFSharp;
|
||||||
static cm::string_view const TypeIdFortran;
|
static cm::string_view const TypeIdFortran;
|
||||||
|
static cm::string_view const TypeIdPython;
|
||||||
|
static cm::string_view const TypeIdVDProj;
|
||||||
|
static cm::string_view const TypeIdVisualBasic;
|
||||||
|
static cm::string_view const TypeIdWiX;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Represent one folder in a Solution. */
|
/** Represent one folder in a Solution. */
|
||||||
|
@@ -0,0 +1,8 @@
|
|||||||
|
check_project(AutoType externalCS "" "FAE04EC0-301F-11D3-BF4B-00C04F79EFBC" "" "")
|
||||||
|
check_project(AutoType externalDB "" "C8D11400-126E-41CD-887F-60BD40844F9E" "" "")
|
||||||
|
check_project(AutoType externalFS "" "F2A71F9B-5D33-465A-A702-920D77279786" "" "")
|
||||||
|
check_project(AutoType externalPy "" "888888A0-9F3D-457C-B088-3A5042F75D52" "" "")
|
||||||
|
check_project(AutoType externalVB "" "F184B08F-C81C-45F6-A57F-5ABD9991F28F" "" "")
|
||||||
|
check_project(AutoType externalVD "" "54435603-DBB4-11D2-8724-00A0C9A8B90C" "" "")
|
||||||
|
check_project(AutoType externalVF "" "6989167D-11E4-40FE-8C1A-2192A86A7E90" "" "")
|
||||||
|
check_project(AutoType externalWiX "" "930C7802-8A8C-48F9-8165-68863BCCD9DD" "" "")
|
@@ -0,0 +1,51 @@
|
|||||||
|
RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/AutoType.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\.csproj"/>
|
||||||
|
<BuildDependency Project="external\.dbproj"/>
|
||||||
|
<BuildDependency Project="external\.fsproj"/>
|
||||||
|
<BuildDependency Project="external\.pyproj"/>
|
||||||
|
<BuildDependency Project="external\.vbproj"/>
|
||||||
|
<BuildDependency Project="external\.vdproj"/>
|
||||||
|
<BuildDependency Project="external\.vfproj"/>
|
||||||
|
<BuildDependency Project="external\.wixproj"/>
|
||||||
|
<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\.csproj" Id="[0-9a-f-]+">
|
||||||
|
<BuildDependency Project="ZERO_CHECK.vcxproj"/>
|
||||||
|
</Project>
|
||||||
|
<Project Path="external\.dbproj" Id="[0-9a-f-]+">
|
||||||
|
<BuildDependency Project="ZERO_CHECK.vcxproj"/>
|
||||||
|
</Project>
|
||||||
|
<Project Path="external\.fsproj" Id="[0-9a-f-]+">
|
||||||
|
<BuildDependency Project="ZERO_CHECK.vcxproj"/>
|
||||||
|
</Project>
|
||||||
|
<Project Path="external\.pyproj" Id="[0-9a-f-]+">
|
||||||
|
<BuildDependency Project="ZERO_CHECK.vcxproj"/>
|
||||||
|
</Project>
|
||||||
|
<Project Path="external\.vbproj" Id="[0-9a-f-]+">
|
||||||
|
<BuildDependency Project="ZERO_CHECK.vcxproj"/>
|
||||||
|
</Project>
|
||||||
|
<Project Path="external\.vdproj" Id="[0-9a-f-]+">
|
||||||
|
<BuildDependency Project="ZERO_CHECK.vcxproj"/>
|
||||||
|
</Project>
|
||||||
|
<Project Path="external\.vfproj" Id="[0-9a-f-]+">
|
||||||
|
<BuildDependency Project="ZERO_CHECK.vcxproj"/>
|
||||||
|
</Project>
|
||||||
|
<Project Path="external\.wixproj" Id="[0-9a-f-]+">
|
||||||
|
<BuildDependency Project="ZERO_CHECK.vcxproj"/>
|
||||||
|
</Project>
|
||||||
|
</Solution>$]])
|
@@ -0,0 +1 @@
|
|||||||
|
include(${CMAKE_CURRENT_LIST_DIR}/AutoType-check-${sln_ext}.cmake)
|
8
Tests/RunCMake/include_external_msproject/AutoType.cmake
Normal file
8
Tests/RunCMake/include_external_msproject/AutoType.cmake
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
include_external_msproject(externalCS external.csproj)
|
||||||
|
include_external_msproject(externalDB external.dbproj)
|
||||||
|
include_external_msproject(externalFS external.fsproj)
|
||||||
|
include_external_msproject(externalPy external.pyproj)
|
||||||
|
include_external_msproject(externalVB external.vbproj)
|
||||||
|
include_external_msproject(externalVD external.vdproj)
|
||||||
|
include_external_msproject(externalVF external.vfproj)
|
||||||
|
include_external_msproject(externalWiX external.wixproj)
|
@@ -8,6 +8,7 @@ else()
|
|||||||
set(sln_ext "slnx")
|
set(sln_ext "slnx")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
run_cmake(AutoType)
|
||||||
run_cmake(CustomGuid)
|
run_cmake(CustomGuid)
|
||||||
run_cmake(CustomTypePlatform)
|
run_cmake(CustomTypePlatform)
|
||||||
run_cmake(CustomGuidTypePlatform)
|
run_cmake(CustomGuidTypePlatform)
|
||||||
|
Reference in New Issue
Block a user