Remove CMAKE_USE_RELATIVE_PATHS variable.

The test for this variable was removed in commit v2.8.8~330^2~7 (complex:
Remove ancient unused ComplexRelativePaths test, 2011-12-23).

Commit v3.1.0-rc1~425^2~2 (backtrace: Convert to local paths in
IssueMessage, 2014-03-12) appears to have accidentally made some backtraces
print relative paths with the variable because conversions which used to be
done at configure time, before the variable had an effect are now potentially
done at generate time.

The documentation of the variable says not to use it, and the docs are wrong in
that the variable actually applies in per-directory scope.

The read of the variable makes it harder to split conversion methods from
cmLocalGenerator where they don't belong.  Remove it now.
This commit is contained in:
Stephen Kelly 2015-06-01 19:56:46 +02:00 committed by Brad King
parent d3bb5da929
commit 1335992c8f
7 changed files with 13 additions and 60 deletions

View File

@ -0,0 +1,5 @@
remove-CMAKE_USE_RELATIVE_PATHS
-------------------------------
* The :variable:`CMAKE_USE_RELATIVE_PATHS` variable no longer has any
effect. Previously it was partially implemented and unreliable.

View File

@ -1,10 +1,5 @@
CMAKE_USE_RELATIVE_PATHS CMAKE_USE_RELATIVE_PATHS
------------------------ ------------------------
Use relative paths (May not work!). This variable has no effect. The partially implemented effect it
had in previous releases was removed in CMake 3.4.
If this is set to TRUE, then CMake will use relative paths between the
source and binary tree. This option does not work for more
complicated projects, and relative paths are used when possible. In
general, it is not possible to move CMake generated makefiles to a
different location regardless of the value of this variable.

View File

@ -3804,33 +3804,13 @@ void cmGlobalXCodeGenerator::GetDocumentation(cmDocumentationEntry& entry)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
std::string cmGlobalXCodeGenerator::ConvertToRelativeForMake(const char* p) std::string cmGlobalXCodeGenerator::ConvertToRelativeForMake(const char* p)
{ {
if ( !this->CurrentMakefile->IsOn("CMAKE_USE_RELATIVE_PATHS") ) return cmSystemTools::ConvertToOutputPath(p);
{
return cmSystemTools::ConvertToOutputPath(p);
}
else
{
std::string ret =
this->CurrentLocalGenerator->
ConvertToRelativePath(this->CurrentOutputDirectoryComponents, p);
return cmSystemTools::ConvertToOutputPath(ret.c_str());
}
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
std::string cmGlobalXCodeGenerator::ConvertToRelativeForXCode(const char* p) std::string cmGlobalXCodeGenerator::ConvertToRelativeForXCode(const char* p)
{ {
if ( !this->CurrentMakefile->IsOn("CMAKE_USE_RELATIVE_PATHS") ) return cmSystemTools::ConvertToOutputPath(p);
{
return cmSystemTools::ConvertToOutputPath(p);
}
else
{
std::string ret =
this->CurrentLocalGenerator->
ConvertToRelativePath(this->ProjectOutputDirectoryComponents, p);
return cmSystemTools::ConvertToOutputPath(ret.c_str());
}
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View File

@ -59,7 +59,6 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg,
this->Makefile = new cmMakefile(this); this->Makefile = new cmMakefile(this);
this->LinkScriptShell = false; this->LinkScriptShell = false;
this->UseRelativePaths = false;
this->Configured = false; this->Configured = false;
this->EmitUniversalBinaryFlags = true; this->EmitUniversalBinaryFlags = true;
this->BackwardsCompatibility = 0; this->BackwardsCompatibility = 0;
@ -137,10 +136,6 @@ void cmLocalGenerator::Configure()
this->Makefile->AddCMakeDependFilesFromUser(); this->Makefile->AddCMakeDependFilesFromUser();
// Check whether relative paths should be used for optionally
// relative paths.
this->UseRelativePaths = this->Makefile->IsOn("CMAKE_USE_RELATIVE_PATHS");
this->ComputeObjectMaxPath(); this->ComputeObjectMaxPath();
this->Configured = true; this->Configured = true;
@ -2705,7 +2700,7 @@ std::string cmLocalGenerator::Convert(const std::string& source,
// Convert the path to a relative path. // Convert the path to a relative path.
std::string result = source; std::string result = source;
if (!optional || this->UseRelativePaths) if (!optional)
{ {
switch (relative) switch (relative)
{ {
@ -2786,7 +2781,7 @@ std::string cmLocalGenerator::Convert(RelativeRoot remote,
// The relative root must have a path (i.e. not FULL or NONE) // The relative root must have a path (i.e. not FULL or NONE)
assert(remotePath != 0); assert(remotePath != 0);
if(!local.empty() && (!optional || this->UseRelativePaths)) if(!local.empty() && !optional)
{ {
std::vector<std::string> components; std::vector<std::string> components;
cmSystemTools::SplitPath(local, components); cmSystemTools::SplitPath(local, components);

View File

@ -127,8 +127,7 @@ public:
const char* GetRelativeRootPath(RelativeRoot relroot); const char* GetRelativeRootPath(RelativeRoot relroot);
/** /**
* Convert the given path to an output path that is optionally * Convert the given path to an output path. The
* relative based on the cache option CMAKE_USE_RELATIVE_PATHS. The
* remote path must use forward slashes and not already be escaped * remote path must use forward slashes and not already be escaped
* or quoted. * or quoted.
*/ */
@ -460,7 +459,6 @@ protected:
std::set<cmTarget const*> WarnCMP0063; std::set<cmTarget const*> WarnCMP0063;
bool LinkScriptShell; bool LinkScriptShell;
bool UseRelativePaths;
bool Configured; bool Configured;
bool EmitUniversalBinaryFlags; bool EmitUniversalBinaryFlags;

View File

@ -614,13 +614,7 @@ cmMakefileTargetGenerator
} }
// Get the output paths for source and object files. // Get the output paths for source and object files.
std::string sourceFile = source.GetFullPath(); std::string sourceFile = this->Convert(source.GetFullPath(),
if(this->LocalGenerator->UseRelativePaths)
{
sourceFile = this->Convert(sourceFile,
cmLocalGenerator::START_OUTPUT);
}
sourceFile = this->Convert(sourceFile,
cmLocalGenerator::NONE, cmLocalGenerator::NONE,
cmLocalGenerator::SHELL); cmLocalGenerator::SHELL);

View File

@ -1437,20 +1437,6 @@ int cmake::ActualConfigure()
cmState::PATH); cmState::PATH);
} }
} }
if(!this->State
->GetInitializedCacheValue("CMAKE_USE_RELATIVE_PATHS"))
{
this->State->AddCacheEntry
("CMAKE_USE_RELATIVE_PATHS", "OFF",
"If true, cmake will use relative paths in makefiles and projects.",
cmState::BOOL);
if (!this->State->GetCacheEntryProperty("CMAKE_USE_RELATIVE_PATHS",
"ADVANCED"))
{
this->State->SetCacheEntryProperty("CMAKE_USE_RELATIVE_PATHS",
"ADVANCED", "1");
}
}
if(cmSystemTools::GetFatalErrorOccured()) if(cmSystemTools::GetFatalErrorOccured())
{ {