diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2002-01-15 00:08:38 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2002-01-15 00:08:38 (GMT) |
commit | cb796a7227fe88e28ba9b4f0eb297c3b47770d8b (patch) | |
tree | e93f815704df815ef7abfb1397ea09456bfb304b /Source/cmDSPWriter.cxx | |
parent | 1a31d4b314c679ee5895236da742f55a2ed01642 (diff) | |
download | CMake-cb796a7227fe88e28ba9b4f0eb297c3b47770d8b.zip CMake-cb796a7227fe88e28ba9b4f0eb297c3b47770d8b.tar.gz CMake-cb796a7227fe88e28ba9b4f0eb297c3b47770d8b.tar.bz2 |
ENH: do not depend on the .dsp file but rather depend on .dsp.cmake and if the .dsp actually changes, then write it, so clean and rebuild will not cause many reloads
Diffstat (limited to 'Source/cmDSPWriter.cxx')
-rw-r--r-- | Source/cmDSPWriter.cxx | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/Source/cmDSPWriter.cxx b/Source/cmDSPWriter.cxx index 88fbb15..2d4b885 100644 --- a/Source/cmDSPWriter.cxx +++ b/Source/cmDSPWriter.cxx @@ -136,19 +136,27 @@ void cmDSPWriter::OutputDSPFile() void cmDSPWriter::CreateSingleDSP(const char *lname, cmTarget &target) { + // add to the list of projects + std::string pname = lname; + m_CreatedProjectNames.push_back(pname); + // create the dsp.cmake file std::string fname; fname = m_Makefile->GetStartOutputDirectory(); fname += "/"; fname += lname; fname += ".dsp"; - std::string pname = lname; - m_CreatedProjectNames.push_back(pname); + // save the name of the real dsp file + std::string realDSP = fname; + fname += ".cmake"; std::ofstream fout(fname.c_str()); if(!fout) { cmSystemTools::Error("Error Writing ", fname.c_str()); } this->WriteDSPFile(fout,lname,target); + fout.close(); + // if the dsp file has changed, then write it. + cmSystemTools::CopyFileIfDifferent(fname.c_str(), realDSP.c_str()); } @@ -159,13 +167,13 @@ void cmDSPWriter::AddDSPBuildRule(cmSourceGroup& sourceGroup) { return; } - dspname += ".dsp"; + dspname += ".dsp.cmake"; std::string makefileIn = m_Makefile->GetStartDirectory(); makefileIn += "/"; makefileIn += "CMakeLists.txt"; makefileIn = cmSystemTools::HandleNetworkPaths(makefileIn.c_str()); makefileIn = cmSystemTools::EscapeSpaces(makefileIn.c_str()); - std::string dsprule = "${CMAKE_COMMAND} "; + std::string dsprule = "${CMAKE_COMMAND}"; m_Makefile->ExpandVariablesInString(dsprule); dsprule = cmSystemTools::HandleNetworkPaths(dsprule.c_str()); std::string args = makefileIn; @@ -179,12 +187,30 @@ void cmDSPWriter::AddDSPBuildRule(cmSourceGroup& sourceGroup) args += cmSystemTools::HandleNetworkPaths(m_Makefile->GetHomeOutputDirectory()); args += "\""; m_Makefile->ExpandVariablesInString(args); + + std::string configFile = + m_Makefile->GetDefinition("CMAKE_ROOT"); + configFile += "/Templates/CMakeWindowsSystemConfig.cmake"; + std::vector<std::string> listFiles = m_Makefile->GetListFiles(); + bool found = false; + for(std::vector<std::string>::iterator i = listFiles.begin(); + i != listFiles.end(); ++i) + { + if(*i == configFile) + { + found = true; + } + } + if(!found) + { + listFiles.push_back(configFile); + } std::vector<std::string> outputs; outputs.push_back(dspname); cmCustomCommand cc(makefileIn.c_str(), dsprule.c_str(), args.c_str(), - m_Makefile->GetListFiles(), + listFiles, outputs); sourceGroup.AddCustomCommand(cc); } @@ -455,7 +481,7 @@ cmDSPWriter::CombineCommands(const cmSourceGroup::Commands &commands, c != commands.end(); ++c) { totalCommandStr += "\n\t"; - temp= c->second.m_Command; + temp= c->second.m_Command; cmSystemTools::ConvertToWindowsSlashes(temp); temp = cmSystemTools::EscapeSpaces(temp.c_str()); totalCommandStr += temp; |