summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Modules/FindPython.cmake5
-rw-r--r--Modules/FindPython2.cmake5
-rw-r--r--Modules/FindPython3.cmake5
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/cmSystemTools.cxx25
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx108
-rw-r--r--Source/cmVisualStudio10TargetGenerator.h3
-rw-r--r--Tests/RunCMake/file-RPATH/RunCMakeTest.cmake11
-rw-r--r--Tests/RunCMake/file-RPATH/TextChange-result.txt1
-rw-r--r--Tests/RunCMake/file-RPATH/TextChange-stderr.txt12
-rw-r--r--Tests/RunCMake/file-RPATH/TextChange.cmake3
-rw-r--r--Tests/RunCMake/file-RPATH/TextChangeEmpty.cmake3
-rw-r--r--Tests/RunCMake/file-RPATH/TextCheck.cmake6
-rw-r--r--Tests/RunCMake/file-RPATH/TextCheckEmpty.cmake6
-rw-r--r--Tests/RunCMake/file-RPATH/TextRemove.cmake3
-rw-r--r--Tests/RunCMake/file-RPATH/TextSet-result.txt1
-rw-r--r--Tests/RunCMake/file-RPATH/TextSet-stderr.txt12
-rw-r--r--Tests/RunCMake/file-RPATH/TextSet.cmake3
-rw-r--r--Tests/RunCMake/file-RPATH/TextSetEmpty.cmake3
19 files changed, 159 insertions, 58 deletions
diff --git a/Modules/FindPython.cmake b/Modules/FindPython.cmake
index a4b7a03..375cb70 100644
--- a/Modules/FindPython.cmake
+++ b/Modules/FindPython.cmake
@@ -229,6 +229,11 @@ Hints
* If set to TRUE, search **only** for static libraries.
* If set to FALSE, search **only** for shared libraries.
+ .. note::
+
+ This hint will be ignored on ``Windows`` because static libraries are not
+ available on this platform.
+
``Python_FIND_ABI``
.. versionadded:: 3.16
diff --git a/Modules/FindPython2.cmake b/Modules/FindPython2.cmake
index bb965b9..0888fad 100644
--- a/Modules/FindPython2.cmake
+++ b/Modules/FindPython2.cmake
@@ -215,6 +215,11 @@ Hints
* If set to TRUE, search **only** for static libraries.
* If set to FALSE, search **only** for shared libraries.
+ .. note::
+
+ This hint will be ignored on ``Windows`` because static libraries are not
+ available on this platform.
+
``Python2_FIND_STRATEGY``
.. versionadded:: 3.15
diff --git a/Modules/FindPython3.cmake b/Modules/FindPython3.cmake
index f826fcf..145c95e 100644
--- a/Modules/FindPython3.cmake
+++ b/Modules/FindPython3.cmake
@@ -231,6 +231,11 @@ Hints
* If set to TRUE, search **only** for static libraries.
* If set to FALSE, search **only** for shared libraries.
+ .. note::
+
+ This hint will be ignored on ``Windows`` because static libraries are not
+ available on this platform.
+
``Python3_FIND_ABI``
.. versionadded:: 3.16
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 52b3ed0..b89baa8 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,7 +1,7 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 22)
-set(CMake_VERSION_PATCH 20211201)
+set(CMake_VERSION_PATCH 20211202)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 3699be3..effb837 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -2855,6 +2855,14 @@ bool cmSystemTools::ChangeRPath(std::string const& file,
file, oldRPath, newRPath, removeEnvironmentRPath, emsg, changed)) {
return result.value();
}
+ // The file format is not recognized. Assume it has no RPATH.
+ if (newRPath.empty()) {
+ // The caller wanted no RPATH anyway.
+ return true;
+ }
+ if (emsg) {
+ *emsg = "The file format is not recognized.";
+ }
return false;
}
@@ -2869,6 +2877,14 @@ bool cmSystemTools::SetRPath(std::string const& file,
SetRPathXCOFF(file, newRPath, emsg, changed)) {
return result.value();
}
+ // The file format is not recognized. Assume it has no RPATH.
+ if (newRPath.empty()) {
+ // The caller wanted no RPATH anyway.
+ return true;
+ }
+ if (emsg) {
+ *emsg = "The file format is not recognized.";
+ }
return false;
}
@@ -3198,7 +3214,8 @@ bool cmSystemTools::RemoveRPath(std::string const& file, std::string* emsg,
if (cm::optional<bool> result = RemoveRPathXCOFF(file, emsg, removed)) {
return result.value();
}
- return false;
+ // The file format is not recognized. Assume it has no RPATH.
+ return true;
}
bool cmSystemTools::CheckRPath(std::string const& file,
@@ -3238,9 +3255,9 @@ bool cmSystemTools::CheckRPath(std::string const& file,
return false;
}
#endif
- (void)file;
- (void)newRPath;
- return false;
+ // The file format is not recognized. Assume it has no RPATH.
+ // Therefore we succeed if the new rpath is empty anyway.
+ return newRPath.empty();
}
bool cmSystemTools::RepeatedRemoveDirectory(const std::string& dir)
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index e9ff758..4291a29 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -290,7 +290,8 @@ std::string cmVisualStudio10TargetGenerator::CalcCondition(
oss << config << "|" << this->Platform;
oss << "'";
// handle special case for 32 bit C# targets
- if (this->ProjectType == csproj && this->Platform == "Win32") {
+ if (this->ProjectType == VsProjectType::csproj &&
+ this->Platform == "Win32") {
oss << " Or ";
oss << "'$(Configuration)|$(Platform)'=='";
oss << config << "|x86";
@@ -341,7 +342,7 @@ void cmVisualStudio10TargetGenerator::Generate()
const std::string ProjectFileExtension =
computeProjectFileExtension(this->GeneratorTarget);
if (ProjectFileExtension == ".vcxproj") {
- this->ProjectType = vcxproj;
+ this->ProjectType = VsProjectType::vcxproj;
this->Managed = false;
} else if (ProjectFileExtension == ".csproj") {
if (this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY) {
@@ -351,7 +352,7 @@ void cmVisualStudio10TargetGenerator::Generate()
"disabled in future). Make it a SHARED library instead.";
this->Makefile->IssueMessage(MessageType::DEPRECATION_WARNING, message);
}
- this->ProjectType = csproj;
+ this->ProjectType = VsProjectType::csproj;
this->Managed = true;
}
@@ -446,7 +447,7 @@ void cmVisualStudio10TargetGenerator::Generate()
e1.Element("PreferredToolArchitecture", hostArch);
}
- if (this->ProjectType != csproj) {
+ if (this->ProjectType != VsProjectType::csproj) {
this->WriteProjectConfigurations(e0);
}
@@ -465,7 +466,7 @@ void cmVisualStudio10TargetGenerator::Generate()
this->GeneratorTarget->GetProperty("VS_GLOBAL_PROJECT_TYPES");
if (vsProjectTypes) {
const char* tagName = "ProjectTypes";
- if (this->ProjectType == csproj) {
+ if (this->ProjectType == VsProjectType::csproj) {
tagName = "ProjectTypeGuids";
}
e1.Element(tagName, *vsProjectTypes);
@@ -530,16 +531,16 @@ void cmVisualStudio10TargetGenerator::Generate()
} else if (cmValue tfVer = this->GeneratorTarget->GetProperty(
"DOTNET_TARGET_FRAMEWORK_VERSION")) {
targetFrameworkVersion = *tfVer;
- } else if (this->ProjectType == csproj) {
+ } else if (this->ProjectType == VsProjectType::csproj) {
targetFrameworkVersion =
this->GlobalGenerator->GetTargetFrameworkVersion();
}
- if (this->ProjectType == vcxproj &&
+ if (this->ProjectType == VsProjectType::vcxproj &&
this->GlobalGenerator->TargetsWindowsCE()) {
e1.Element("EnableRedirectPlatform", "true");
e1.Element("RedirectPlatformValue", this->Platform);
}
- if (this->ProjectType == csproj) {
+ if (this->ProjectType == VsProjectType::csproj) {
if (this->GlobalGenerator->TargetsWindowsCE()) {
// FIXME: These target VS_TARGET_FRAMEWORK* target properties
// are undocumented settings only ever supported for WinCE.
@@ -666,7 +667,7 @@ void cmVisualStudio10TargetGenerator::Generate()
}
switch (this->ProjectType) {
- case vcxproj: {
+ case VsProjectType::vcxproj: {
std::string const& props =
this->GlobalGenerator->GetPlatformToolsetVersionProps();
if (!props.empty()) {
@@ -674,7 +675,7 @@ void cmVisualStudio10TargetGenerator::Generate()
}
Elem(e0, "Import").Attribute("Project", VS10_CXX_DEFAULT_PROPS);
} break;
- case csproj:
+ case VsProjectType::csproj:
Elem(e0, "Import")
.Attribute("Project", VS10_CSharp_DEFAULT_PROPS)
.Attribute("Condition", "Exists('" VS10_CSharp_DEFAULT_PROPS "')");
@@ -683,7 +684,7 @@ void cmVisualStudio10TargetGenerator::Generate()
this->WriteProjectConfigurationValues(e0);
- if (this->ProjectType == vcxproj) {
+ if (this->ProjectType == VsProjectType::vcxproj) {
Elem(e0, "Import").Attribute("Project", VS10_CXX_PROPS);
}
{
@@ -729,10 +730,10 @@ void cmVisualStudio10TargetGenerator::Generate()
e1.Attribute("Label", "PropertySheets");
std::string props;
switch (this->ProjectType) {
- case vcxproj:
+ case VsProjectType::vcxproj:
props = VS10_CXX_USER_PROPS;
break;
- case csproj:
+ case VsProjectType::csproj:
props = VS10_CSharp_USER_PROPS;
break;
}
@@ -767,10 +768,10 @@ void cmVisualStudio10TargetGenerator::Generate()
this->WriteProjectReferences(e0);
this->WriteSDKReferences(e0);
switch (this->ProjectType) {
- case vcxproj:
+ case VsProjectType::vcxproj:
Elem(e0, "Import").Attribute("Project", VS10_CXX_TARGETS);
break;
- case csproj:
+ case VsProjectType::csproj:
if (this->GlobalGenerator->TargetsWindowsCE()) {
Elem(e0, "Import").Attribute("Project", VS10_CSharp_NETCF_TARGETS);
} else {
@@ -811,12 +812,13 @@ void cmVisualStudio10TargetGenerator::Generate()
Elem(e1, "Import").Attribute("Project", nasmTargets);
}
}
- if (this->ProjectType == vcxproj && this->HaveCustomCommandDepfile) {
+ if (this->ProjectType == VsProjectType::vcxproj &&
+ this->HaveCustomCommandDepfile) {
std::string depfileTargets =
GetCMakeFilePath("Templates/MSBuild/CustomBuildDepFile.targets");
Elem(e0, "Import").Attribute("Project", depfileTargets);
}
- if (this->ProjectType == csproj) {
+ if (this->ProjectType == VsProjectType::csproj) {
for (std::string const& c : this->Configurations) {
Elem e1(e0, "PropertyGroup");
e1.Attribute("Condition", "'$(Configuration)' == '" + c + "'");
@@ -982,7 +984,8 @@ void cmVisualStudio10TargetGenerator::WriteDotNetDocumentationFile(Elem& e0)
std::string const& documentationFile =
this->GeneratorTarget->GetSafeProperty("VS_DOTNET_DOCUMENTATION_FILE");
- if (this->ProjectType == csproj && !documentationFile.empty()) {
+ if (this->ProjectType == VsProjectType::csproj &&
+ !documentationFile.empty()) {
Elem e1(e0, "PropertyGroup");
Elem e2(e1, "DocumentationFile");
e2.Content(documentationFile);
@@ -999,7 +1002,7 @@ void cmVisualStudio10TargetGenerator::WriteEmbeddedResourceGroup(Elem& e0)
std::string obj = oi->GetFullPath();
ConvertToWindowsSlash(obj);
bool useRelativePath = false;
- if (this->ProjectType == csproj && this->InSourceBuild) {
+ if (this->ProjectType == VsProjectType::csproj && this->InSourceBuild) {
// If we do an in-source build and the resource file is in a
// subdirectory
// of the .csproj file, we have to use relative pathnames, otherwise
@@ -1013,7 +1016,7 @@ void cmVisualStudio10TargetGenerator::WriteEmbeddedResourceGroup(Elem& e0)
Elem e2(e1, "EmbeddedResource");
e2.Attribute("Include", obj);
- if (this->ProjectType != csproj) {
+ if (this->ProjectType != VsProjectType::csproj) {
std::string hFileName = obj.substr(0, obj.find_last_of(".")) + ".h";
e2.Element("DependentUpon", hFileName);
@@ -1184,7 +1187,7 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues(Elem& e0)
e1.Attribute("Condition", this->CalcCondition(c));
e1.Attribute("Label", "Configuration");
- if (this->ProjectType != csproj) {
+ if (this->ProjectType != VsProjectType::csproj) {
std::string configType;
if (cmValue vsConfigurationType =
this->GeneratorTarget->GetProperty("VS_CONFIGURATION_TYPE")) {
@@ -1493,7 +1496,7 @@ void cmVisualStudio10TargetGenerator::WriteCustomRule(
std::unique_ptr<Elem> spe1;
std::unique_ptr<Elem> spe2;
- if (this->ProjectType != csproj) {
+ if (this->ProjectType != VsProjectType::csproj) {
spe1 = cm::make_unique<Elem>(e0, "ItemGroup");
spe2 = cm::make_unique<Elem>(*spe1, "CustomBuild");
this->WriteSource(*spe2, source);
@@ -1520,7 +1523,7 @@ void cmVisualStudio10TargetGenerator::WriteCustomRule(
std::stringstream additional_inputs;
{
const char* sep = "";
- if (this->ProjectType == csproj) {
+ if (this->ProjectType == VsProjectType::csproj) {
// csproj files do not attach the command to a specific file
// so the primary input must be listed explicitly.
additional_inputs << source->GetFullPath();
@@ -1550,7 +1553,7 @@ void cmVisualStudio10TargetGenerator::WriteCustomRule(
}
}
}
- if (this->ProjectType != csproj) {
+ if (this->ProjectType != VsProjectType::csproj) {
additional_inputs << sep << "%(AdditionalInputs)";
}
}
@@ -1571,7 +1574,7 @@ void cmVisualStudio10TargetGenerator::WriteCustomRule(
}
}
}
- if (this->ProjectType == csproj) {
+ if (this->ProjectType == VsProjectType::csproj) {
std::string name = "CustomCommand_" + c + "_" +
cmSystemTools::ComputeStringMD5(sourcePath);
this->WriteCustomRuleCSharp(e0, c, name, script, additional_inputs.str(),
@@ -1662,7 +1665,7 @@ static void ConvertToWindowsSlash(std::string& s)
void cmVisualStudio10TargetGenerator::WriteGroups()
{
- if (this->ProjectType == csproj) {
+ if (this->ProjectType == VsProjectType::csproj) {
return;
}
@@ -1927,7 +1930,7 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(
std::string includeInVsix;
std::string ext = cmSystemTools::LowerCase(sf->GetExtension());
- if (this->ProjectType == csproj && !this->InSourceBuild) {
+ if (this->ProjectType == VsProjectType::csproj && !this->InSourceBuild) {
toolHasSettings = true;
}
if (ext == "hlsl") {
@@ -2188,7 +2191,7 @@ void cmVisualStudio10TargetGenerator::WriteSource(Elem& e2,
ConvertToWindowsSlash(sourceFile);
e2.Attribute("Include", sourceFile);
- if (this->ProjectType == csproj && !this->InSourceBuild) {
+ if (this->ProjectType == VsProjectType::csproj && !this->InSourceBuild) {
// For out of source projects we have to provide a link (if not specified
// via property) for every source file (besides .cs files) otherwise they
// will not be visible in VS at all.
@@ -2630,7 +2633,7 @@ void cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
e2.Element("DependentUpon",
fileName.substr(0, fileName.find_last_of(".")));
}
- if (this->ProjectType == csproj) {
+ if (this->ProjectType == VsProjectType::csproj) {
std::string f = source->GetFullPath();
using CsPropMap = std::map<std::string, std::string>;
CsPropMap sourceFileTags;
@@ -2661,7 +2664,7 @@ void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions(
if (ttype > cmStateEnums::GLOBAL_TARGET) {
return;
}
- if (this->ProjectType == csproj) {
+ if (this->ProjectType == VsProjectType::csproj) {
return;
}
@@ -2789,7 +2792,7 @@ void cmVisualStudio10TargetGenerator::OutputLinkIncremental(
if (!this->MSTools) {
return;
}
- if (this->ProjectType == csproj) {
+ if (this->ProjectType == VsProjectType::csproj) {
return;
}
// static libraries and things greater than modules do not need
@@ -2857,11 +2860,11 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
cmGlobalVisualStudio10Generator* gg = this->GlobalGenerator;
std::unique_ptr<Options> pOptions;
switch (this->ProjectType) {
- case vcxproj:
+ case VsProjectType::vcxproj:
pOptions = cm::make_unique<Options>(
this->LocalGenerator, Options::Compiler, gg->GetClFlagTable());
break;
- case csproj:
+ case VsProjectType::csproj:
pOptions =
cm::make_unique<Options>(this->LocalGenerator, Options::CSharpCompiler,
gg->GetCSharpFlagTable());
@@ -2881,7 +2884,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
// Choose a language whose flags to use for ClCompile.
static const char* clLangs[] = { "CXX", "C", "Fortran" };
std::string langForClCompile;
- if (this->ProjectType == csproj) {
+ if (this->ProjectType == VsProjectType::csproj) {
langForClCompile = "CSharp";
} else if (cm::contains(clLangs, linkLanguage)) {
langForClCompile = linkLanguage;
@@ -2911,9 +2914,10 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
// Precompile Headers
std::string pchHeader =
this->GeneratorTarget->GetPchHeader(configName, linkLanguage);
- if (this->MSTools && vcxproj == this->ProjectType && pchHeader.empty()) {
+ if (this->MSTools && VsProjectType::vcxproj == this->ProjectType &&
+ pchHeader.empty()) {
clOptions.AddFlag("PrecompiledHeader", "NotUsing");
- } else if (this->MSTools && vcxproj == this->ProjectType &&
+ } else if (this->MSTools && VsProjectType::vcxproj == this->ProjectType &&
!pchHeader.empty()) {
clOptions.AddFlag("PrecompiledHeader", "Use");
clOptions.AddFlag("PrecompiledHeaderFile", pchHeader);
@@ -2925,7 +2929,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
// Get preprocessor definitions for this directory.
std::string defineFlags = this->Makefile->GetDefineFlags();
if (this->MSTools) {
- if (this->ProjectType == vcxproj) {
+ if (this->ProjectType == VsProjectType::vcxproj) {
clOptions.FixExceptionHandlingDefault();
if (this->GlobalGenerator->GetVersion() >=
cmGlobalVisualStudioGenerator::VS15) {
@@ -2943,7 +2947,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
// check for managed C++ assembly compiler flag. This overrides any
// /clr* compiler flags which may be defined in the flags variable(s).
- if (this->ProjectType != csproj) {
+ if (this->ProjectType != VsProjectType::csproj) {
// Warn if /clr was added manually. This should not be done
// anymore, because cmGeneratorTarget may not be aware that the
// target uses C++/CLI.
@@ -2972,13 +2976,13 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
clOptions.Parse(defineFlags);
std::vector<std::string> targetDefines;
switch (this->ProjectType) {
- case vcxproj:
+ case VsProjectType::vcxproj:
if (!langForClCompile.empty()) {
this->GeneratorTarget->GetCompileDefinitions(targetDefines, configName,
langForClCompile);
}
break;
- case csproj:
+ case VsProjectType::csproj:
this->GeneratorTarget->GetCompileDefinitions(targetDefines, configName,
"CSharp");
cm::erase_if(targetDefines, [](std::string const& def) {
@@ -2988,7 +2992,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
}
clOptions.AddDefines(targetDefines);
- if (this->ProjectType == csproj) {
+ if (this->ProjectType == VsProjectType::csproj) {
clOptions.AppendFlag("DefineConstants", targetDefines);
}
@@ -3051,7 +3055,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
}
}
- if (this->ProjectType != csproj && clOptions.IsManaged()) {
+ if (this->ProjectType != VsProjectType::csproj && clOptions.IsManaged()) {
this->Managed = true;
std::string managedType = clOptions.GetFlag("CompileAsManaged");
if (managedType == "Safe" || managedType == "Pure") {
@@ -3064,7 +3068,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
clOptions.AddFlag("ExceptionHandling", "Async");
clOptions.AddFlag("BasicRuntimeChecks", "Default");
}
- if (this->ProjectType == csproj) {
+ if (this->ProjectType == VsProjectType::csproj) {
// /nowin32manifest overrides /win32manifest: parameter
if (clOptions.HasFlag("NoWin32Manifest")) {
clOptions.RemoveFlag("ApplicationManifest");
@@ -3090,7 +3094,7 @@ void cmVisualStudio10TargetGenerator::WriteClOptions(
Elem& e1, std::string const& configName)
{
Options& clOptions = *(this->ClOptions[configName]);
- if (this->ProjectType == csproj) {
+ if (this->ProjectType == VsProjectType::csproj) {
return;
}
Elem e2(e1, "ClCompile");
@@ -4040,7 +4044,7 @@ void cmVisualStudio10TargetGenerator::WriteLinkOptions(
this->GeneratorTarget->GetType() > cmStateEnums::MODULE_LIBRARY) {
return;
}
- if (this->ProjectType == csproj) {
+ if (this->ProjectType == VsProjectType::csproj) {
return;
}
@@ -4076,7 +4080,7 @@ void cmVisualStudio10TargetGenerator::AddLibraries(
if (!location.empty()) {
ConvertToWindowsSlash(location);
switch (this->ProjectType) {
- case csproj:
+ case VsProjectType::csproj:
// If the target we want to "link" to is an imported managed
// target and this is a C# project, we add a hint reference. This
// reference is written to project file in
@@ -4084,7 +4088,7 @@ void cmVisualStudio10TargetGenerator::AddLibraries(
this->DotNetHintReferences[config].push_back(
DotNetHintReference(l.Target->GetName(), location));
break;
- case vcxproj:
+ case VsProjectType::vcxproj:
// Add path of assembly to list of using-directories, so the
// managed assembly can be used by '#using <assembly.dll>' in
// code.
@@ -4144,7 +4148,7 @@ void cmVisualStudio10TargetGenerator::WriteMidlOptions(
if (!this->MSTools) {
return;
}
- if (this->ProjectType == csproj) {
+ if (this->ProjectType == VsProjectType::csproj) {
return;
}
if (this->GeneratorTarget->GetType() > cmStateEnums::UTILITY) {
@@ -4185,7 +4189,7 @@ void cmVisualStudio10TargetGenerator::WriteMidlOptions(
void cmVisualStudio10TargetGenerator::WriteItemDefinitionGroups(Elem& e0)
{
- if (this->ProjectType == csproj) {
+ if (this->ProjectType == VsProjectType::csproj) {
return;
}
for (const std::string& c : this->Configurations) {
@@ -4204,7 +4208,7 @@ void cmVisualStudio10TargetGenerator::WriteItemDefinitionGroups(Elem& e0)
// output midl flags <Midl></Midl>
this->WriteMidlOptions(e1, c);
// write events
- if (this->ProjectType != csproj) {
+ if (this->ProjectType != VsProjectType::csproj) {
this->WriteEvents(e1, c);
}
// output link flags <Link></Link>
@@ -4273,7 +4277,7 @@ void cmVisualStudio10TargetGenerator::WriteEvent(
}
}
comment = cmVS10EscapeComment(comment);
- if (this->ProjectType != csproj) {
+ if (this->ProjectType != VsProjectType::csproj) {
Elem e2(e1, name);
if (stdPipesUTF8) {
this->WriteStdOutEncodingUtf8(e2);
@@ -5095,7 +5099,7 @@ bool cmVisualStudio10TargetGenerator::ForceOld(const std::string& source) const
void cmVisualStudio10TargetGenerator::GetCSharpSourceProperties(
cmSourceFile const* sf, std::map<std::string, std::string>& tags)
{
- if (this->ProjectType == csproj) {
+ if (this->ProjectType == VsProjectType::csproj) {
const cmPropertyMap& props = sf->GetProperties();
for (const std::string& p : props.GetKeys()) {
static const cm::string_view propNamePrefix = "VS_CSHARP_";
diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h
index e4b48c3..ec6362f 100644
--- a/Source/cmVisualStudio10TargetGenerator.h
+++ b/Source/cmVisualStudio10TargetGenerator.h
@@ -209,7 +209,8 @@ private:
OptionsMap NasmOptions;
OptionsMap LinkOptions;
std::string LangForClCompile;
- enum VsProjectType
+
+ enum class VsProjectType
{
vcxproj,
csproj
diff --git a/Tests/RunCMake/file-RPATH/RunCMakeTest.cmake b/Tests/RunCMake/file-RPATH/RunCMakeTest.cmake
index 1ca2e75..525df09 100644
--- a/Tests/RunCMake/file-RPATH/RunCMakeTest.cmake
+++ b/Tests/RunCMake/file-RPATH/RunCMakeTest.cmake
@@ -5,3 +5,14 @@ run_cmake_command(ELF ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/ELF.cmake)
if(CMAKE_SYSTEM_NAME STREQUAL "AIX")
run_cmake_command(XCOFF ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/XCOFF.cmake)
endif()
+
+run_cmake_command(TextCheck ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/TextCheck.cmake)
+run_cmake_command(TextCheckEmpty ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/TextCheckEmpty.cmake)
+
+run_cmake_command(TextChange ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/TextChange.cmake)
+run_cmake_command(TextChangeEmpty ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/TextChangeEmpty.cmake)
+
+run_cmake_command(TextSet ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/TextSet.cmake)
+run_cmake_command(TextSetEmpty ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/TextSetEmpty.cmake)
+
+run_cmake_command(TextRemove ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/TextRemove.cmake)
diff --git a/Tests/RunCMake/file-RPATH/TextChange-result.txt b/Tests/RunCMake/file-RPATH/TextChange-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/file-RPATH/TextChange-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/file-RPATH/TextChange-stderr.txt b/Tests/RunCMake/file-RPATH/TextChange-stderr.txt
new file mode 100644
index 0000000..48a1bf5
--- /dev/null
+++ b/Tests/RunCMake/file-RPATH/TextChange-stderr.txt
@@ -0,0 +1,12 @@
+^CMake Error at [^
+]*/Tests/RunCMake/file-RPATH/TextChange.cmake:[0-9]+ \(file\):
+ file RPATH_CHANGE could not write new RPATH:
+
+ /new/rpath
+
+ to the file:
+
+ [^
+]*/Tests/RunCMake/file-RPATH/TextChange-build/not_a_binary.txt
+
+ The file format is not recognized\.$
diff --git a/Tests/RunCMake/file-RPATH/TextChange.cmake b/Tests/RunCMake/file-RPATH/TextChange.cmake
new file mode 100644
index 0000000..5c599ec
--- /dev/null
+++ b/Tests/RunCMake/file-RPATH/TextChange.cmake
@@ -0,0 +1,3 @@
+set(f "${CMAKE_CURRENT_BINARY_DIR}/not_a_binary.txt")
+file(WRITE "${f}" "Not a binary.\n")
+file(RPATH_CHANGE FILE "${f}" OLD_RPATH "/old/rpath" NEW_RPATH "/new/rpath")
diff --git a/Tests/RunCMake/file-RPATH/TextChangeEmpty.cmake b/Tests/RunCMake/file-RPATH/TextChangeEmpty.cmake
new file mode 100644
index 0000000..8f855d9
--- /dev/null
+++ b/Tests/RunCMake/file-RPATH/TextChangeEmpty.cmake
@@ -0,0 +1,3 @@
+set(f "${CMAKE_CURRENT_BINARY_DIR}/not_a_binary.txt")
+file(WRITE "${f}" "Not a binary.\n")
+file(RPATH_CHANGE FILE "${f}" OLD_RPATH "/old/rpath" NEW_RPATH "")
diff --git a/Tests/RunCMake/file-RPATH/TextCheck.cmake b/Tests/RunCMake/file-RPATH/TextCheck.cmake
new file mode 100644
index 0000000..1f21ba7
--- /dev/null
+++ b/Tests/RunCMake/file-RPATH/TextCheck.cmake
@@ -0,0 +1,6 @@
+set(f "${CMAKE_CURRENT_BINARY_DIR}/not_a_binary.txt")
+file(WRITE "${f}" "Not a binary.\n")
+file(RPATH_CHECK FILE "${f}" RPATH "/some/rpath")
+if(EXISTS "${f}")
+ message(FATAL_ERROR "RPATH_CHECK did not remove\n ${f}\nfor non-empty RPATH")
+endif()
diff --git a/Tests/RunCMake/file-RPATH/TextCheckEmpty.cmake b/Tests/RunCMake/file-RPATH/TextCheckEmpty.cmake
new file mode 100644
index 0000000..806c73d
--- /dev/null
+++ b/Tests/RunCMake/file-RPATH/TextCheckEmpty.cmake
@@ -0,0 +1,6 @@
+set(f "${CMAKE_CURRENT_BINARY_DIR}/not_a_binary.txt")
+file(WRITE "${f}" "Not a binary.\n")
+file(RPATH_CHECK FILE "${f}" RPATH "")
+if(NOT EXISTS "${f}")
+ message(FATAL_ERROR "RPATH_CHECK removed\n ${f}\nfor empty RPATH")
+endif()
diff --git a/Tests/RunCMake/file-RPATH/TextRemove.cmake b/Tests/RunCMake/file-RPATH/TextRemove.cmake
new file mode 100644
index 0000000..aecaf6f
--- /dev/null
+++ b/Tests/RunCMake/file-RPATH/TextRemove.cmake
@@ -0,0 +1,3 @@
+set(f "${CMAKE_CURRENT_BINARY_DIR}/not_a_binary.txt")
+file(WRITE "${f}" "Not a binary.\n")
+file(RPATH_REMOVE FILE "${f}")
diff --git a/Tests/RunCMake/file-RPATH/TextSet-result.txt b/Tests/RunCMake/file-RPATH/TextSet-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/file-RPATH/TextSet-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/file-RPATH/TextSet-stderr.txt b/Tests/RunCMake/file-RPATH/TextSet-stderr.txt
new file mode 100644
index 0000000..811c9a5
--- /dev/null
+++ b/Tests/RunCMake/file-RPATH/TextSet-stderr.txt
@@ -0,0 +1,12 @@
+^CMake Error at [^
+]*/Tests/RunCMake/file-RPATH/TextSet.cmake:[0-9]+ \(file\):
+ file RPATH_SET could not write new RPATH:
+
+ /new/rpath
+
+ to the file:
+
+ [^
+]*/Tests/RunCMake/file-RPATH/TextSet-build/not_a_binary.txt
+
+ The file format is not recognized\.$
diff --git a/Tests/RunCMake/file-RPATH/TextSet.cmake b/Tests/RunCMake/file-RPATH/TextSet.cmake
new file mode 100644
index 0000000..f4b09d2
--- /dev/null
+++ b/Tests/RunCMake/file-RPATH/TextSet.cmake
@@ -0,0 +1,3 @@
+set(f "${CMAKE_CURRENT_BINARY_DIR}/not_a_binary.txt")
+file(WRITE "${f}" "Not a binary.\n")
+file(RPATH_SET FILE "${f}" NEW_RPATH "/new/rpath")
diff --git a/Tests/RunCMake/file-RPATH/TextSetEmpty.cmake b/Tests/RunCMake/file-RPATH/TextSetEmpty.cmake
new file mode 100644
index 0000000..d9517e0
--- /dev/null
+++ b/Tests/RunCMake/file-RPATH/TextSetEmpty.cmake
@@ -0,0 +1,3 @@
+set(f "${CMAKE_CURRENT_BINARY_DIR}/not_a_binary.txt")
+file(WRITE "${f}" "Not a binary.\n")
+file(RPATH_SET FILE "${f}" NEW_RPATH "")