summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2002-05-07 13:02:45 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2002-05-07 13:02:45 (GMT)
commit3bc9830686f25304024d3bc2849d530ac057763d (patch)
tree13031f07ef9e2128ca7a3e23d535242ca3634e85
parente9e69b7e5e5a331662093f801ada63494ffac0be (diff)
downloadCMake-3bc9830686f25304024d3bc2849d530ac057763d.zip
CMake-3bc9830686f25304024d3bc2849d530ac057763d.tar.gz
CMake-3bc9830686f25304024d3bc2849d530ac057763d.tar.bz2
ENH: add an edit_cache target that runs ccmake or CMakeSetup
-rw-r--r--Source/cmBorlandMakefileGenerator.cxx16
-rw-r--r--Source/cmNMakeMakefileGenerator.cxx7
-rw-r--r--Source/cmUnixMakefileGenerator.cxx18
-rw-r--r--Source/cmake.cxx19
4 files changed, 53 insertions, 7 deletions
diff --git a/Source/cmBorlandMakefileGenerator.cxx b/Source/cmBorlandMakefileGenerator.cxx
index 0e6fa01..32e76d9 100644
--- a/Source/cmBorlandMakefileGenerator.cxx
+++ b/Source/cmBorlandMakefileGenerator.cxx
@@ -106,17 +106,23 @@ void cmBorlandMakefileGenerator::OutputMakeVariables(std::ostream& fout)
fout << "RM = " << this->ConvertToOutputPath(ccommand.c_str()) << " remove -f\n";
std::string ccompiler = m_Makefile->GetDefinition("CMAKE_C_COMPILER");
fout << "CMAKE_C_COMPILER = "
- << this->ConvertToOutputPath(ccompiler.c_str())
+ << this->ShortPath(ccompiler.c_str())
<< "\n";
std::string cxxcompiler = m_Makefile->GetDefinition("CMAKE_CXX_COMPILER");
fout << "CMAKE_CXX_COMPILER = "
- << this->ConvertToOutputPath(cxxcompiler.c_str())
+ << this->ShortPath(cxxcompiler.c_str())
<< "\n";
-
+
+ if(m_Makefile->GetDefinition("CMAKE_EDIT_COMMAND"))
+ {
+ fout << "CMAKE_EDIT_COMMAND = "
+ << this->ShortPath(m_Makefile->GetDefinition("CMAKE_EDIT_COMMAND"))
+ << "\n";
+ }
std::string cmakecommand = m_Makefile->GetDefinition("CMAKE_COMMAND");
fout << "CMAKE_COMMAND = "
- << this->ConvertToOutputPath(cmakecommand.c_str()) << "\n";
+ << this->ShortPath(cmakecommand.c_str()) << "\n";
fout << replaceVars.c_str();
fout << "CMAKE_CURRENT_SOURCE = "
@@ -135,7 +141,7 @@ void cmBorlandMakefileGenerator::OutputMakeVariables(std::ostream& fout)
std::vector<std::string>& includes = m_Makefile->GetIncludeDirectories();
std::vector<std::string>::iterator i;
fout << "-I" <<
- this->ConvertToOutputPath(m_Makefile->GetStartDirectory()) << " ";
+ this->ShortPath(m_Makefile->GetStartDirectory()) << " ";
for(i = includes.begin(); i != includes.end(); ++i)
{
std::string include = *i;
diff --git a/Source/cmNMakeMakefileGenerator.cxx b/Source/cmNMakeMakefileGenerator.cxx
index eee9685..cdb42b1 100644
--- a/Source/cmNMakeMakefileGenerator.cxx
+++ b/Source/cmNMakeMakefileGenerator.cxx
@@ -192,6 +192,13 @@ void cmNMakeMakefileGenerator::OutputMakeVariables(std::ostream& fout)
fout << "CMAKE_COMMAND = "
<< this->ShortPath(cmakecommand.c_str()) << "\n";
+ if(m_Makefile->GetDefinition("CMAKE_EDIT_COMMAND"))
+ {
+ fout << "CMAKE_EDIT_COMMAND = "
+ << this->ShortPath(m_Makefile->GetDefinition("CMAKE_EDIT_COMMAND"))
+ << "\n";
+ }
+
fout << "CMAKE_CURRENT_SOURCE = "
<< this->ShortPath(m_Makefile->GetStartDirectory() )
<< "\n";
diff --git a/Source/cmUnixMakefileGenerator.cxx b/Source/cmUnixMakefileGenerator.cxx
index 5609bda..2bbd1e9 100644
--- a/Source/cmUnixMakefileGenerator.cxx
+++ b/Source/cmUnixMakefileGenerator.cxx
@@ -1610,6 +1610,12 @@ void cmUnixMakefileGenerator::OutputMakeVariables(std::ostream& fout)
fout << "CMAKE_COMMAND = "
<< this->ConvertToOutputPath(m_Makefile->GetDefinition("CMAKE_COMMAND"))
<< "\n";
+ if(m_Makefile->GetDefinition("CMAKE_EDIT_COMMAND"))
+ {
+ fout << "CMAKE_EDIT_COMMAND = "
+ << this->ConvertToOutputPath(m_Makefile->GetDefinition("CMAKE_EDIT_COMMAND"))
+ << "\n";
+ }
fout << "CMAKE_CURRENT_SOURCE = " <<
this->ConvertToOutputPath(m_Makefile->GetStartDirectory()) << "\n";
@@ -1864,6 +1870,18 @@ void cmUnixMakefileGenerator::OutputMakeRules(std::ostream& fout)
"$(CMAKE_BINARY_DIR)/CMakeCache.txt",
"$(CMAKE_COMMAND) "
"-H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)");
+ // if CMAKE_EDIT_COMMAND is defined then add a rule to run it
+ // called edit_cache
+ if(m_Makefile->GetDefinition("CMAKE_EDIT_COMMAND"))
+ {
+ this->OutputMakeRule(fout,
+ "Edit the CMakeCache.txt file with ccmake or CMakeSetup",
+ "edit_cache",
+ 0,
+ "$(CMAKE_EDIT_COMMAND) "
+ "-H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)");
+ }
+
this->OutputMakeRule(fout,
"Create CMakeCache.txt file",
"$(CMAKE_BINARY_DIR)/CMakeCache.txt",
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 47f204c..95f62ea 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -254,10 +254,10 @@ void cmake::AddCMakePaths(const std::vector<std::string>& args)
// Find ccommand
std::string cCommand = cmSystemTools::GetFilenamePath(cMakeSelf) +
"/ccommand" + cmSystemTools::GetFilenameExtension(cMakeSelf);
- if( !cmSystemTools::FileExists(cMakeSelf.c_str()))
+ if( !cmSystemTools::FileExists(cCommand.c_str()))
{
cmSystemTools::Error("CMAKE can not find the command line program "
- "ccommand. Attempted path: ", cMakeSelf.c_str());
+ "ccommand. Attempted path: ", cCommand.c_str());
return;
}
@@ -265,6 +265,21 @@ void cmake::AddCMakePaths(const std::vector<std::string>& args)
cmCacheManager::GetInstance()->AddCacheEntry
("CCOMMAND_COMMAND",cCommand.c_str(),
"Path to CMakeCommand executable.", cmCacheManager::INTERNAL);
+
+ // Find and save the command to edit the cache
+ std::string editCacheCommand = cmSystemTools::GetFilenamePath(cMakeSelf) +
+ "/ccmake" + cmSystemTools::GetFilenameExtension(cMakeSelf);
+ if( !cmSystemTools::FileExists(editCacheCommand.c_str()))
+ {
+ editCacheCommand = cmSystemTools::GetFilenamePath(cMakeSelf) +
+ "/CMakeSetup" + cmSystemTools::GetFilenameExtension(cMakeSelf);
+ }
+ if(cmSystemTools::FileExists(editCacheCommand.c_str()))
+ {
+ cmCacheManager::GetInstance()->AddCacheEntry
+ ("CMAKE_EDIT_COMMAND", editCacheCommand.c_str(),
+ "Path to cache edit program executable.", cmCacheManager::INTERNAL);
+ }
// do CMAKE_ROOT, look for the environment variable first
std::string cMakeRoot;