summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmAddTestCommand.cxx2
-rw-r--r--Source/cmEnableTestingCommand.cxx2
-rw-r--r--Source/cmGlobalGenerator.cxx74
-rw-r--r--Source/cmGlobalGenerator.h1
-rw-r--r--Source/cmGlobalVisualStudio6Generator.cxx69
-rw-r--r--Source/cmGlobalVisualStudio6Generator.h1
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx57
-rw-r--r--Source/cmGlobalVisualStudio7Generator.h1
-rw-r--r--Source/cmMakefile.cxx21
-rw-r--r--Source/cmMakefile.h1
10 files changed, 99 insertions, 130 deletions
diff --git a/Source/cmAddTestCommand.cxx b/Source/cmAddTestCommand.cxx
index 66203e2..ec539bf 100644
--- a/Source/cmAddTestCommand.cxx
+++ b/Source/cmAddTestCommand.cxx
@@ -44,7 +44,7 @@ void cmAddTestCommand::FinalPass()
std::string fname;
fname = m_Makefile->GetStartOutputDirectory();
fname += "/";
- if ( m_Makefile->IsOn("DART_ROOT") )
+ if ( m_Makefile->IsSet("DART_ROOT") )
{
fname += "DartTestfile.txt";
}
diff --git a/Source/cmEnableTestingCommand.cxx b/Source/cmEnableTestingCommand.cxx
index 9a97083..fe113c6 100644
--- a/Source/cmEnableTestingCommand.cxx
+++ b/Source/cmEnableTestingCommand.cxx
@@ -37,7 +37,7 @@ void cmEnableTestingCommand::CreateDartTestfileForMakefile(cmMakefile *mf)
std::string fname;
fname = mf->GetStartOutputDirectory();
fname += "/";
- if ( m_Makefile->IsOn("DART_ROOT") )
+ if ( m_Makefile->IsSet("DART_ROOT") )
{
fname += "DartTestfile.txt";
}
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 24291e1..d63ff02 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -989,3 +989,77 @@ cmGlobalGenerator::ConvertToRelativePath(const std::vector<std::string>& local,
return relative;
}
+inline std::string removeQuotes(const std::string& s)
+{
+ if(s[0] == '\"' && s[s.size()-1] == '\"')
+ {
+ return s.substr(1, s.size()-2);
+ }
+ return s;
+}
+
+void cmGlobalGenerator::SetupTests()
+{
+ std::string ctest =
+ m_LocalGenerators[0]->GetMakefile()->GetRequiredDefinition("CMAKE_COMMAND");
+ ctest = removeQuotes(ctest);
+ ctest = cmSystemTools::GetFilenamePath(ctest.c_str());
+ ctest += "/";
+ ctest += "ctest";
+ ctest += cmSystemTools::GetExecutableExtension();
+ if(!cmSystemTools::FileExists(ctest.c_str()))
+ {
+ ctest =
+ m_LocalGenerators[0]->GetMakefile()->GetRequiredDefinition("CMAKE_COMMAND");
+ ctest = cmSystemTools::GetFilenamePath(ctest.c_str());
+ ctest += "/Debug/";
+ ctest += "ctest";
+ ctest += cmSystemTools::GetExecutableExtension();
+ }
+ if(!cmSystemTools::FileExists(ctest.c_str()))
+ {
+ ctest =
+ m_LocalGenerators[0]->GetMakefile()->GetRequiredDefinition("CMAKE_COMMAND");
+ ctest = cmSystemTools::GetFilenamePath(ctest.c_str());
+ ctest += "/Release/";
+ ctest += "ctest";
+ ctest += cmSystemTools::GetExecutableExtension();
+ }
+ // if we found ctest
+ if (cmSystemTools::FileExists(ctest.c_str()))
+ {
+ // Create a full path filename for output Testfile
+ std::string fname;
+ fname = m_CMakeInstance->GetStartOutputDirectory();
+ fname += "/";
+ if ( m_LocalGenerators[0]->GetMakefile()->IsSet("DART_ROOT") )
+ {
+ fname += "DartTestfile.txt";
+ }
+ else
+ {
+ fname += "CTestTestfile.txt";
+ }
+
+ // If the file doesn't exist, then ENABLE_TESTING hasn't been run
+ if (cmSystemTools::FileExists(fname.c_str()))
+ {
+ const char* no_output = 0;
+ std::vector<std::string> no_depends;
+ std::map<cmStdString, std::vector<cmLocalGenerator*> >::iterator it;
+ for(it = m_ProjectMap.begin(); it!= m_ProjectMap.end(); ++it)
+ {
+ std::vector<cmLocalGenerator*>& gen = it->second;
+ // add the ALL_BUILD to the first local generator of each project
+ if(gen.size())
+ {
+ gen[0]->GetMakefile()->
+ AddUtilityCommand("RUN_TESTS", false, no_output, no_depends,
+ ctest.c_str(), "-C", "$(IntDir)");
+ }
+ }
+ }
+ }
+}
+
+
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 4ca2be6..bfaf4aa 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -142,6 +142,7 @@ protected:
void FindMakeProgram(cmMakefile*);
void ConfigureRelativePaths();
+ void SetupTests();
bool m_ForceUnixPaths;
cmStdString m_FindMakeProgramFile;
diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx
index aec0eef..e392f55 100644
--- a/Source/cmGlobalVisualStudio6Generator.cxx
+++ b/Source/cmGlobalVisualStudio6Generator.cxx
@@ -371,75 +371,6 @@ void cmGlobalVisualStudio6Generator::OutputDSWFile()
}
}
-
-inline std::string removeQuotes(const std::string& s)
-{
- if(s[0] == '\"' && s[s.size()-1] == '\"')
- {
- return s.substr(1, s.size()-2);
- }
- return s;
-}
-
-
-void cmGlobalVisualStudio6Generator::SetupTests()
-{
- std::string ctest =
- m_LocalGenerators[0]->GetMakefile()->GetRequiredDefinition("CMAKE_COMMAND");
- ctest = removeQuotes(ctest);
- ctest = cmSystemTools::GetFilenamePath(ctest.c_str());
- ctest += "/";
- ctest += "ctest";
- ctest += cmSystemTools::GetExecutableExtension();
- if(!cmSystemTools::FileExists(ctest.c_str()))
- {
- ctest =
- m_LocalGenerators[0]->GetMakefile()->GetRequiredDefinition("CMAKE_COMMAND");
- ctest = cmSystemTools::GetFilenamePath(ctest.c_str());
- ctest += "/Debug/";
- ctest += "ctest";
- ctest += cmSystemTools::GetExecutableExtension();
- }
- if(!cmSystemTools::FileExists(ctest.c_str()))
- {
- ctest =
- m_LocalGenerators[0]->GetMakefile()->GetRequiredDefinition("CMAKE_COMMAND");
- ctest = cmSystemTools::GetFilenamePath(ctest.c_str());
- ctest += "/Release/";
- ctest += "ctest";
- ctest += cmSystemTools::GetExecutableExtension();
- }
- // if we found ctest
- if (cmSystemTools::FileExists(ctest.c_str()))
- {
- // Create a full path filename for output Testfile
- std::string fname;
- fname = m_CMakeInstance->GetStartOutputDirectory();
- fname += "/";
- fname += "DartTestfile.txt";
-
- // If the file doesn't exist, then ENABLE_TESTING hasn't been run
- if (cmSystemTools::FileExists(fname.c_str()))
- {
- const char* no_output = 0;
- std::vector<std::string> no_depends;
- std::map<cmStdString, std::vector<cmLocalGenerator*> >::iterator it;
- for(it = m_ProjectMap.begin(); it!= m_ProjectMap.end(); ++it)
- {
- std::vector<cmLocalGenerator*>& gen = it->second;
- // add the ALL_BUILD to the first local generator of each project
- if(gen.size())
- {
- gen[0]->GetMakefile()->
- AddUtilityCommand("RUN_TESTS", false, no_output, no_depends,
- ctest.c_str(), "-C", "$(IntDir)");
- }
- }
- }
- }
-}
-
-
// Write a dsp file into the DSW file,
// Note, that dependencies from executables to
// the libraries it uses are also done here
diff --git a/Source/cmGlobalVisualStudio6Generator.h b/Source/cmGlobalVisualStudio6Generator.h
index 98c8b12..5dbef61 100644
--- a/Source/cmGlobalVisualStudio6Generator.h
+++ b/Source/cmGlobalVisualStudio6Generator.h
@@ -78,7 +78,6 @@ public:
std::vector<cmLocalGenerator*>& generators);
private:
void GenerateConfigurations(cmMakefile* mf);
- void SetupTests();
void WriteDSWFile(std::ostream& fout);
void WriteDSWHeader(std::ostream& fout);
void WriteProject(std::ostream& fout,
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index 238d392..ef2faf8 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -128,63 +128,6 @@ cmLocalGenerator *cmGlobalVisualStudio7Generator::CreateLocalGenerator()
return lg;
}
-
-void cmGlobalVisualStudio7Generator::SetupTests()
-{
- std::string ctest =
- m_LocalGenerators[0]->GetMakefile()->GetRequiredDefinition("CMAKE_COMMAND");
- ctest = cmSystemTools::GetFilenamePath(ctest.c_str());
- ctest += "/";
- ctest += "ctest";
- ctest += cmSystemTools::GetExecutableExtension();
- if(!cmSystemTools::FileExists(ctest.c_str()))
- {
- ctest =
- m_LocalGenerators[0]->GetMakefile()->GetRequiredDefinition("CMAKE_COMMAND");
- ctest = cmSystemTools::GetFilenamePath(ctest.c_str());
- ctest += "/Debug/";
- ctest += "ctest";
- ctest += cmSystemTools::GetExecutableExtension();
- }
- if(!cmSystemTools::FileExists(ctest.c_str()))
- {
- ctest =
- m_LocalGenerators[0]->GetMakefile()->GetRequiredDefinition("CMAKE_COMMAND");
- ctest = cmSystemTools::GetFilenamePath(ctest.c_str());
- ctest += "/Release/";
- ctest += "ctest";
- ctest += cmSystemTools::GetExecutableExtension();
- }
- // if we found ctest
- if (cmSystemTools::FileExists(ctest.c_str()))
- {
- // Create a full path filename for output Testfile
- std::string fname;
- fname = m_CMakeInstance->GetStartOutputDirectory();
- fname += "/";
- fname += "DartTestfile.txt";
-
- // If the file doesn't exist, then ENABLE_TESTING hasn't been run
- if (cmSystemTools::FileExists(fname.c_str()))
- {
- const char* no_output = 0;
- std::vector<std::string> no_depends;
- std::map<cmStdString, std::vector<cmLocalGenerator*> >::iterator it;
- for(it = m_ProjectMap.begin(); it!= m_ProjectMap.end(); ++it)
- {
- std::vector<cmLocalGenerator*>& gen = it->second;
- // add the ALL_BUILD to the first local generator of each project
- if(gen.size())
- {
- gen[0]->GetMakefile()->
- AddUtilityCommand("RUN_TESTS", false, no_output, no_depends,
- ctest.c_str(), "-C", "$(IntDir)");
- }
- }
- }
- }
-}
-
void cmGlobalVisualStudio7Generator::GenerateConfigurations(cmMakefile* mf)
{
// process the configurations
diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h
index 9a9199c..fbc1489 100644
--- a/Source/cmGlobalVisualStudio7Generator.h
+++ b/Source/cmGlobalVisualStudio7Generator.h
@@ -97,7 +97,6 @@ protected:
virtual void WriteSLNFooter(std::ostream& fout);
virtual void WriteSLNHeader(std::ostream& fout);
- void SetupTests();
void GenerateConfigurations(cmMakefile* mf);
void WriteExternalProject(std::ostream& fout,
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index cd2fa9b..34d44e2 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1232,6 +1232,27 @@ bool cmMakefile::IsOn(const char* name) const
return cmSystemTools::IsOn(value);
}
+bool cmMakefile::IsSet(const char* name) const
+{
+ const char* value = this->GetDefinition(name);
+ if ( !value )
+ {
+ return false;
+ }
+
+ if ( ! *value )
+ {
+ return false;
+ }
+
+ if ( cmSystemTools::IsNOTFOUND(value) )
+ {
+ return false;
+ }
+
+ return true;
+}
+
const char* cmMakefile::GetRequiredDefinition(const char* name) const
{
const char* ret = this->GetDefinition(name);
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index a4492d8..d796d96 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -496,6 +496,7 @@ public:
* returns false if no entry defined.
*/
bool IsOn(const char* name) const;
+ bool IsSet(const char* name) const;
/**
* Get a list of preprocessor define flags.