summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2004-03-31 15:01:52 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2004-03-31 15:01:52 (GMT)
commitd0cea4c7bb19fecd5b0f7c7636d089a8ef28825b (patch)
treed770b39b441c777d12a6c8127966549cd9bf8860
parentd1185c59104565a96026ee78498f8739b77b2b3c (diff)
downloadCMake-d0cea4c7bb19fecd5b0f7c7636d089a8ef28825b.zip
CMake-d0cea4c7bb19fecd5b0f7c7636d089a8ef28825b.tar.gz
CMake-d0cea4c7bb19fecd5b0f7c7636d089a8ef28825b.tar.bz2
ENH: make relative paths optional and default off, and add a test for them
-rw-r--r--Source/CMakeLists.txt11
-rw-r--r--Source/cmLocalGenerator.cxx2
-rw-r--r--Source/cmLocalUnixMakefileGenerator.cxx12
-rw-r--r--Source/cmLocalUnixMakefileGenerator.h1
-rw-r--r--Source/cmake.cxx11
5 files changed, 31 insertions, 6 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index bff099f..310e38a 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -322,6 +322,17 @@ IF(BUILD_TESTING)
--build-exe-dir "${CMake_BINARY_DIR}/Tests/ComplexOneConfig/bin"
--test-command complex)
+ ADD_TEST(complexRelativePaths ${CMAKE_CTEST_COMMAND}
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/Complex"
+ "${CMake_BINARY_DIR}/Tests/ComplexRelativePaths"
+ --build-generator ${CMAKE_GENERATOR}
+ --build-project complex
+ --build-makeprogram ${MAKEPROGRAM}
+ --build-exe-dir "${CMake_BINARY_DIR}/Tests/ComplexRelativePaths/bin"
+ --build-options -DCMAKE_USE_RELATIVE_PATHS:BOOL=ON
+ --test-command complex)
+
ENDIF(NOT COMPILER_IS_COMO)
ADD_TEST(Example ${CMAKE_CTEST_COMMAND}
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 27f240d..c27e6af 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -354,7 +354,7 @@ std::string cmLocalGenerator::GetFullTargetName(const char* n,
std::string cmLocalGenerator::ConvertToRelativeOutputPath(const char* p)
{
- if ( m_Makefile->GetDefinition("CMAKE_NO_RELATIVE_PATHS") )
+ if ( !m_Makefile->IsOn("CMAKE_USE_RELATIVE_PATHS") )
{
return cmSystemTools::ConvertToOutputPath(p);
}
diff --git a/Source/cmLocalUnixMakefileGenerator.cxx b/Source/cmLocalUnixMakefileGenerator.cxx
index aec784f..ae30cdd 100644
--- a/Source/cmLocalUnixMakefileGenerator.cxx
+++ b/Source/cmLocalUnixMakefileGenerator.cxx
@@ -32,6 +32,7 @@ cmLocalUnixMakefileGenerator::cmLocalUnixMakefileGenerator()
m_MakefileVariableSize = 0;
m_IgnoreLibPrefix = false;
m_PassMakeflags = false;
+ m_UseRelativePaths = false;
}
cmLocalUnixMakefileGenerator::~cmLocalUnixMakefileGenerator()
@@ -41,6 +42,7 @@ cmLocalUnixMakefileGenerator::~cmLocalUnixMakefileGenerator()
void cmLocalUnixMakefileGenerator::Generate(bool fromTheTop)
{
+ m_UseRelativePaths = m_Makefile->IsOn("CMAKE_USE_RELATIVE_PATHS");
// suppoirt override in output directories
if (m_Makefile->GetDefinition("LIBRARY_OUTPUT_PATH"))
{
@@ -700,12 +702,12 @@ void cmLocalUnixMakefileGenerator::OutputLinkLibraries(std::ostream& fout,
if(emitted.insert(libpath).second)
{
std::string fullLibPath;
- if(!m_WindowsShell)
+ if(!m_WindowsShell && m_UseRelativePaths)
{
fullLibPath = "\"`cd ";
}
fullLibPath += libpath;
- if(!m_WindowsShell)
+ if(!m_WindowsShell && m_UseRelativePaths)
{
fullLibPath += ";pwd`\"";
}
@@ -1076,16 +1078,16 @@ void cmLocalUnixMakefileGenerator::OutputLibraryRule(std::ostream& fout,
std::string outpath;
std::string outdir = this->ConvertToRelativeOutputPath(m_LibraryOutputPath.c_str());
- if(!m_WindowsShell && outdir.size())
+ if(!m_WindowsShell && m_UseRelativePaths && outdir.size())
{
outpath = "\"`cd ";
}
outpath += outdir;
- if(!m_WindowsShell && outdir.size())
+ if(!m_WindowsShell && m_UseRelativePaths && outdir.size())
{
outpath += ";pwd`\"/";
}
- if(outdir.size() == 0 && !m_WindowsShell)
+ if(outdir.size() == 0 && m_UseRelativePaths && !m_WindowsShell)
{
outpath = "\"`pwd`\"/";
}
diff --git a/Source/cmLocalUnixMakefileGenerator.h b/Source/cmLocalUnixMakefileGenerator.h
index ec44e54..76f54f1 100644
--- a/Source/cmLocalUnixMakefileGenerator.h
+++ b/Source/cmLocalUnixMakefileGenerator.h
@@ -246,6 +246,7 @@ protected:
std::string m_ExecutableOutputPath;
std::string m_LibraryOutputPath;
bool m_WindowsShell;
+ bool m_UseRelativePaths;
bool m_PassMakeflags;
private:
};
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 9c4f7d9..5ce680e 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -1085,6 +1085,17 @@ int cmake::Configure()
"Single output directory for building all executables.",
cmCacheManager::PATH);
}
+ if(!m_CacheManager->GetCacheValue("CMAKE_USE_RELATIVE_PATHS"))
+ {
+ m_CacheManager->AddCacheEntry("CMAKE_USE_RELATIVE_PATHS", false,
+ "If true, cmake will use relative paths in makefiles and projects.");
+ cmCacheManager::CacheIterator it =
+ m_CacheManager->GetCacheIterator("CMAKE_USE_RELATIVE_PATHS");
+ if ( !it.PropertyExists("ADVANCED") )
+ {
+ it.SetProperty("ADVANCED", "1");
+ }
+ }
if(cmSystemTools::GetFatalErrorOccured() &&
(!this->m_CacheManager->GetCacheValue("CMAKE_MAKE_PROGRAM") ||